Skip to content

Commit

Permalink
Fix flaky TestInitDatabaseService
Browse files Browse the repository at this point in the history
Addresses two separate issues caused by using t.TempDir as the
data directory in the test.

- Session recording is disabled to avoid cleanup problems with
  a non-empty data dir
- The debug service is disabled to prevent long unix socket
  paths from failing tests on macOS

Closes #42963
  • Loading branch information
rosstimothy authored and github-actions committed Oct 21, 2024
1 parent 4e06dbb commit 53ddb0a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1785,12 +1785,16 @@ func TestInitDatabaseService(t *testing.T) {

cfg := servicecfg.MakeDefaultConfig()
cfg.DataDir = t.TempDir()
cfg.DebugService = servicecfg.DebugConfig{
Enabled: false,
}
cfg.Auth.StorageConfig.Params["path"] = t.TempDir()
cfg.Hostname = "default.example.com"
cfg.Auth.Enabled = true
cfg.SetAuthServerAddress(utils.NetAddr{AddrNetwork: "tcp", Addr: "127.0.0.1:0"})
cfg.Auth.ListenAddr = utils.NetAddr{AddrNetwork: "tcp", Addr: "127.0.0.1:0"}
cfg.Auth.StorageConfig.Params["path"] = t.TempDir()
cfg.Auth.SessionRecordingConfig.SetMode(types.RecordOff)
cfg.Proxy.Enabled = true
cfg.Proxy.DisableWebInterface = true
cfg.Proxy.WebAddr = utils.NetAddr{AddrNetwork: "tcp", Addr: "localhost:0"}
Expand Down

0 comments on commit 53ddb0a

Please sign in to comment.