Skip to content

Commit

Permalink
Fix tempdir failure in TestInitDatabaseService (#50717)
Browse files Browse the repository at this point in the history
* Reduce flakiness in TestInitDatabaseService

This test was setting the auth's storage config to use a different
temp dir than the backend's storage dir, which could result in the
non-empty directory that fails during cleanup.

As of #48247 tests don't need to set this at all since the default
behavior now does the right thing.

* Apply the same fix to a few other tests
  • Loading branch information
zmb3 authored Jan 17, 2025
1 parent a9e75b8 commit f78f29e
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions lib/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ func TestAdditionalExpectedRoles(t *testing.T) {
cfg := servicecfg.MakeDefaultConfig()
cfg.DataDir = makeTempDir(t)
cfg.SetAuthServerAddress(utils.NetAddr{AddrNetwork: "tcp", Addr: "127.0.0.1:0"})
cfg.Auth.StorageConfig.Params["path"] = t.TempDir()
cfg.DiagnosticAddr = utils.NetAddr{AddrNetwork: "tcp", Addr: "127.0.0.1:0"}
cfg.Auth.ListenAddr = utils.NetAddr{AddrNetwork: "tcp", Addr: "127.0.0.1:0"}

Expand Down Expand Up @@ -140,7 +139,6 @@ func TestAdditionalExpectedRoles(t *testing.T) {
cfg := servicecfg.MakeDefaultConfig()
cfg.DataDir = makeTempDir(t)
cfg.SetAuthServerAddress(utils.NetAddr{AddrNetwork: "tcp", Addr: "127.0.0.1:0"})
cfg.Auth.StorageConfig.Params["path"] = t.TempDir()
cfg.DiagnosticAddr = utils.NetAddr{AddrNetwork: "tcp", Addr: "127.0.0.1:0"}
cfg.Auth.ListenAddr = utils.NetAddr{AddrNetwork: "tcp", Addr: "127.0.0.1:0"}

Expand Down Expand Up @@ -284,7 +282,6 @@ func TestMonitor(t *testing.T) {
cfg.DiagnosticAddr = utils.NetAddr{AddrNetwork: "tcp", Addr: "127.0.0.1:0"}
cfg.SetAuthServerAddress(utils.NetAddr{AddrNetwork: "tcp", Addr: "127.0.0.1:0"})
cfg.Auth.Enabled = true
cfg.Auth.StorageConfig.Params["path"] = t.TempDir()
cfg.Auth.ListenAddr = utils.NetAddr{AddrNetwork: "tcp", Addr: "127.0.0.1:0"}
cfg.Proxy.Enabled = false
cfg.SSH.Enabled = false
Expand Down Expand Up @@ -1746,7 +1743,6 @@ func TestInstanceMetadata(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
cfg := newCfg()
cfg.DataDir = makeTempDir(t)
cfg.Auth.StorageConfig.Params["path"] = t.TempDir()
cfg.InstanceMetadataClient = tc.imClient

process, err := NewTeleport(cfg)
Expand Down Expand Up @@ -1811,12 +1807,10 @@ func TestInitDatabaseService(t *testing.T) {
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
Expand Down

0 comments on commit f78f29e

Please sign in to comment.