Fixes racey tests in tsh (#7416)

Multiple routines were fighting over the global logrus `Logger`
instance, causing the race detector to trip roughly once in every 10
test runs.

This patch addresses this race condition by supplying each of the
competing processes an entirely separate logger, and ensuring that
these log instances are plumbed through to the code that would otherwise
trip the race detector.
This commit is contained in:
Trent Clarke 2021-06-26 10:44:42 +10:00 committed by GitHub
parent 90f186df37
commit 9b7002cf9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View file

@ -2512,6 +2512,7 @@ func (process *TeleportProcess) initProxyEndpoint(conn *Connector) error {
PollingPeriod: process.Config.PollingPeriod,
FIPS: cfg.FIPS,
Emitter: streamEmitter,
Log: process.log,
})
if err != nil {
return trace.Wrap(err)

View file

@ -807,6 +807,7 @@ func makeTestServers(t *testing.T, bootstrap ...types.Resource) (auth *service.T
cfg.Auth.Enabled = true
cfg.Auth.SSHAddr = randomLocalAddr
cfg.Proxy.Enabled = false
cfg.Log = utils.NewLoggerForTests()
auth, err = service.NewTeleport(cfg)
require.NoError(t, err)
@ -844,6 +845,7 @@ func makeTestServers(t *testing.T, bootstrap ...types.Resource) (auth *service.T
cfg.Proxy.SSHAddr = randomLocalAddr
cfg.Proxy.ReverseTunnelListenAddr = randomLocalAddr
cfg.Proxy.DisableWebInterface = true
cfg.Log = utils.NewLoggerForTests()
proxy, err = service.NewTeleport(cfg)
require.NoError(t, err)