From a9455bdf826d40c3493885f690865495d21598e4 Mon Sep 17 00:00:00 2001 From: rosstimothy <39066650+rosstimothy@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:23:57 -0500 Subject: [PATCH] Attempt to reduce flakiness of TestIntegrations/DiscoveryNode (#50137) This applies the same measures as https://github.com/gravitational/teleport/pull/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 https://github.com/gravitational/teleport/issues/16310. --- integration/helpers/instance.go | 9 +++++++++ integration/integration_test.go | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/integration/helpers/instance.go b/integration/helpers/instance.go index fb4fdc3947f09..a552193cad8e4 100644 --- a/integration/helpers/instance.go +++ b/integration/helpers/instance.go @@ -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) } @@ -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) } @@ -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". @@ -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". @@ -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". @@ -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". @@ -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 { @@ -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". @@ -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 { diff --git a/integration/integration_test.go b/integration/integration_test.go index f99ea4c01eafc..96e10fe53c448 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -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)