diff --git a/integration/app_integration_test.go b/integration/app_integration_test.go index 86e7ca3ff5faf..431367665226b 100644 --- a/integration/app_integration_test.go +++ b/integration/app_integration_test.go @@ -36,6 +36,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" + "github.com/gravitational/teleport" "github.com/gravitational/teleport/api/breaker" apidefaults "github.com/gravitational/teleport/api/defaults" @@ -517,8 +518,9 @@ func (p *pack) appServersHA(t *testing.T) { } testCases := map[string]struct { - packInfo func(pack *pack) packInfo - startAppServers func(pack *pack, count int) []*service.TeleportProcess + packInfo func(pack *pack) packInfo + startAppServers func(pack *pack, count int) []*service.TeleportProcess + waitForTunnelConn func(t *testing.T, pack *pack, count int) }{ "RootServer": { packInfo: func(pack *pack) packInfo { @@ -532,6 +534,9 @@ func (p *pack) appServersHA(t *testing.T) { startAppServers: func(pack *pack, count int) []*service.TeleportProcess { return pack.startRootAppServers(t, count, []service.App{}) }, + waitForTunnelConn: func(t *testing.T, pack *pack, count int) { + waitForActiveTunnelConnections(t, pack.rootCluster.Tunnel, pack.rootCluster.Secrets.SiteName, count) + }, }, "LeafServer": { packInfo: func(pack *pack) packInfo { @@ -545,6 +550,9 @@ func (p *pack) appServersHA(t *testing.T) { startAppServers: func(pack *pack, count int) []*service.TeleportProcess { return pack.startLeafAppServers(t, count, []service.App{}) }, + waitForTunnelConn: func(t *testing.T, pack *pack, count int) { + waitForActiveTunnelConnections(t, pack.leafCluster.Tunnel, pack.leafCluster.Secrets.SiteName, count) + }, }, } @@ -580,7 +588,6 @@ func (p *pack) appServersHA(t *testing.T) { for name, test := range testCases { name, test := name, test t.Run(name, func(t *testing.T) { - // t.Parallel() info := test.packInfo(p) httpCookie := p.createAppSession(t, info.publicHTTPAddr, info.clusterName) wsCookie := p.createAppSession(t, info.publicWSAddr, info.clusterName) @@ -602,11 +609,14 @@ func (p *pack) appServersHA(t *testing.T) { } servers := test.startAppServers(p, 1) + test.waitForTunnelConn(t, p, 1) makeRequests(t, p, httpCookie, wsCookie, responseWithoutError) // Start an additional app server and stop all current running // ones. test.startAppServers(p, 1) + test.waitForTunnelConn(t, p, 2) + for _, appServer := range servers { require.NoError(t, appServer.Close())