Skip to content

Commit

Permalink
Fix tempdir test flakess in lib/service (#51208)
Browse files Browse the repository at this point in the history
Setting auth's data dir to `t.TempDir()` and then setting the storage
config path to another invocation of `t.TempDir()` ends up creating
two separate directories, when the behavior Teleport generally
expects is that auth's audit storage is a subdirectory of the process
data directory.
  • Loading branch information
zmb3 authored Jan 20, 2025
1 parent 1bcb8ae commit a1b09ce
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions lib/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,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 @@ -135,7 +134,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 @@ -279,7 +277,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 @@ -1624,7 +1621,6 @@ func TestDebugServiceStartSocket(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"] = dataDir
cfg.Auth.ListenAddr = utils.NetAddr{AddrNetwork: "tcp", Addr: "127.0.0.1:0"}
cfg.SSH.Enabled = false
cfg.CircuitBreakerConfig = breaker.NoopBreakerConfig()
Expand Down Expand Up @@ -1740,7 +1736,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 @@ -1804,12 +1799,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 a1b09ce

Please sign in to comment.