Skip to content

Commit

Permalink
Try to fix TestAppServersHA flakiness (#13992)
Browse files Browse the repository at this point in the history
  • Loading branch information
smallinsky authored Jun 30, 2022
1 parent f41d246 commit 86ac49b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions integration/app_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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)
},
},
}

Expand Down Expand Up @@ -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)
Expand All @@ -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())

Expand Down

0 comments on commit 86ac49b

Please sign in to comment.