Skip to content

Commit

Permalink
Attempt to reduce flakiness of TestIntegrations/DiscoveryNode
Browse files Browse the repository at this point in the history
This applies the same measures as #49850
applied to various other flaky integration tests to ensure that
nodes are routable before attempting user connections to them.
Additionally, the debug service is disabled by default for all of
the various ways a TeleInstance can be created. This prevents test
failures on macOS due to unix socket name length.

Closes #16310.
  • Loading branch information
rosstimothy authored and github-actions committed Dec 12, 2024
1 parent 10f7868 commit c111631
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions integration/helpers/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ func (i *TeleInstance) Create(t *testing.T, trustedSecrets []*InstanceSecrets, e
tconf.Proxy.DisableWebInterface = true
tconf.CircuitBreakerConfig = breaker.NoopBreakerConfig()
tconf.InstanceMetadataClient = imds.NewDisabledIMDSClient()
tconf.DebugService.Enabled = false
return i.CreateEx(t, trustedSecrets, tconf)
}

Expand All @@ -469,6 +470,7 @@ func (i *TeleInstance) GenerateConfig(t *testing.T, trustedSecrets []*InstanceSe
tconf.Auth.ClusterName, err = services.NewClusterNameWithRandomID(types.ClusterNameSpecV2{
ClusterName: i.Secrets.SiteName,
})
tconf.DebugService.Enabled = false
if err != nil {
return nil, trace.Wrap(err)
}
Expand Down Expand Up @@ -737,6 +739,7 @@ func (i *TeleInstance) StartNodeWithTargetPort(tconf *servicecfg.Config, authPor
}
tconf.Auth.Enabled = false
tconf.Proxy.Enabled = false
tconf.DebugService.Enabled = false

// Create a new Teleport process and add it to the list of nodes that
// compose this "cluster".
Expand Down Expand Up @@ -779,6 +782,7 @@ func (i *TeleInstance) StartApp(conf *servicecfg.Config) (*service.TeleportProce
conf.Testing.UploadEventsC = i.UploadEventsC
conf.Auth.Enabled = false
conf.Proxy.Enabled = false
conf.DebugService.Enabled = false

// Create a new Teleport process and add it to the list of nodes that
// compose this "cluster".
Expand Down Expand Up @@ -829,6 +833,7 @@ func (i *TeleInstance) StartApps(configs []*servicecfg.Config) ([]*service.Telep
cfg.Testing.UploadEventsC = i.UploadEventsC
cfg.Auth.Enabled = false
cfg.Proxy.Enabled = false
cfg.DebugService.Enabled = false

// Create a new Teleport process and add it to the list of nodes that
// compose this "cluster".
Expand Down Expand Up @@ -894,6 +899,7 @@ func (i *TeleInstance) StartDatabase(conf *servicecfg.Config) (*service.Teleport
conf.Proxy.Enabled = false
conf.Apps.Enabled = false
conf.SSH.Enabled = false
conf.DebugService.Enabled = false

// Create a new Teleport process and add it to the list of nodes that
// compose this "cluster".
Expand Down Expand Up @@ -956,6 +962,7 @@ func (i *TeleInstance) StartKube(t *testing.T, conf *servicecfg.Config, clusterN
conf.Apps.Enabled = false
conf.SSH.Enabled = false
conf.Databases.Enabled = false
conf.DebugService.Enabled = false

conf.Kube.KubeconfigPath = filepath.Join(dataDir, "kube_config")
if err := EnableKube(t, conf, clusterName); err != nil {
Expand Down Expand Up @@ -1031,6 +1038,7 @@ func (i *TeleInstance) StartNodeAndProxy(t *testing.T, name string) (sshPort, we
}
tconf.CircuitBreakerConfig = breaker.NoopBreakerConfig()
tconf.InstanceMetadataClient = imds.NewDisabledIMDSClient()
tconf.DebugService.Enabled = false

// Create a new Teleport process and add it to the list of nodes that
// compose this "cluster".
Expand Down Expand Up @@ -1124,6 +1132,7 @@ func (i *TeleInstance) StartProxy(cfg ProxyConfig, opts ...Option) (reversetunne
tconf.Proxy.DisableALPNSNIListener = cfg.DisableALPNSNIListener
tconf.CircuitBreakerConfig = breaker.NoopBreakerConfig()
tconf.InstanceMetadataClient = imds.NewDisabledIMDSClient()
tconf.DebugService.Enabled = false
tconf.FileDescriptors = cfg.FileDescriptors
// apply options
for _, o := range opts {
Expand Down
6 changes: 6 additions & 0 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4420,12 +4420,18 @@ func testDiscoveryNode(t *testing.T, suite *integrationTestSuite) {
helpers.WaitForActiveTunnelConnections(t, main.Tunnel, helpers.Site, 1)
helpers.WaitForActiveTunnelConnections(t, proxyTunnel, helpers.Site, 1)

// Wait for the nodes to be visible to both Proxy instances.
require.NoError(t, main.WaitForNodeCount(ctx, helpers.Site, 1))
instance := helpers.TeleInstance{Tunnel: proxyTunnel}
require.NoError(t, instance.WaitForNodeCount(ctx, helpers.Site, 1))

// Execute the connection via first proxy.
cfg := helpers.ClientConfig{
Login: suite.Me.Username,
Cluster: helpers.Site,
Host: "cluster-main-node",
}

output, err := runCommand(t, main, []string{"echo", "hello world"}, cfg, 1)
require.NoError(t, err)
require.Equal(t, "hello world\n", output)
Expand Down

0 comments on commit c111631

Please sign in to comment.