From ab66e13ad513b4d53582126bd63118a6dfb668b6 Mon Sep 17 00:00:00 2001 From: Tim Ross Date: Wed, 11 Dec 2024 14:19:50 -0500 Subject: [PATCH] Attempt to reduce flakiness of TestIntegrations/DiscoveryNode 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 cdff68ef04e2a..b132b027b3bef 100644 --- a/integration/helpers/instance.go +++ b/integration/helpers/instance.go @@ -448,6 +448,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) } @@ -473,6 +474,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) } @@ -741,6 +743,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". @@ -783,6 +786,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". @@ -833,6 +837,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". @@ -898,6 +903,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". @@ -960,6 +966,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 { @@ -1035,6 +1042,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". @@ -1128,6 +1136,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 df22af3ee9598..ae3e5c6fdcfa2 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -4306,12 +4306,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)