mirror of
https://github.com/gravitational/teleport
synced 2024-10-20 17:23:22 +00:00
Improve error handling in Connect gateway integration test (#19145)
mockTSHDEventsClient will most likely be called outside of the test goroutine, so we shouldn't use require.NoError there. helpers.SetupUserCreds returns an error which I did not inspect. The linter didn't warn me about it for some reason.
This commit is contained in:
parent
7895fddc57
commit
519c9aa0df
|
@ -91,7 +91,6 @@ func testGatewayCertRenewal(t *testing.T, pack *dbhelpers.DatabasePack, creds *h
|
|||
require.NoError(t, err)
|
||||
|
||||
tshdEventsClient := &mockTSHDEventsClient{
|
||||
t: t,
|
||||
tc: tc,
|
||||
pack: pack,
|
||||
callCounts: make(map[string]int),
|
||||
|
@ -145,7 +144,8 @@ func testGatewayCertRenewal(t *testing.T, pack *dbhelpers.DatabasePack, creds *h
|
|||
TTL: -time.Hour,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
helpers.SetupUserCreds(tc, pack.Root.Cluster.Config.Proxy.SSHAddr.Addr, *expiredCreds)
|
||||
err = helpers.SetupUserCreds(tc, pack.Root.Cluster.Config.Proxy.SSHAddr.Addr, *expiredCreds)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Open a new connection.
|
||||
// This should trigger the relogin flow. The middleware will notice that the db cert has expired
|
||||
|
@ -172,7 +172,6 @@ func testGatewayCertRenewal(t *testing.T, pack *dbhelpers.DatabasePack, creds *h
|
|||
}
|
||||
|
||||
type mockTSHDEventsClient struct {
|
||||
t *testing.T
|
||||
tc *libclient.TeleportClient
|
||||
pack *dbhelpers.DatabasePack
|
||||
callCounts map[string]int
|
||||
|
@ -186,8 +185,13 @@ func (c *mockTSHDEventsClient) Relogin(context.Context, *api.ReloginRequest, ...
|
|||
Process: c.pack.Root.Cluster.Process,
|
||||
Username: c.pack.Root.User.GetName(),
|
||||
})
|
||||
require.NoError(c.t, err)
|
||||
helpers.SetupUserCreds(c.tc, c.pack.Root.Cluster.Config.Proxy.SSHAddr.Addr, *creds)
|
||||
if err != nil {
|
||||
return nil, trace.Wrap(err)
|
||||
}
|
||||
err = helpers.SetupUserCreds(c.tc, c.pack.Root.Cluster.Config.Proxy.SSHAddr.Addr, *creds)
|
||||
if err != nil {
|
||||
return nil, trace.Wrap(err)
|
||||
}
|
||||
|
||||
return &api.ReloginResponse{}, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue