Skip to content

Commit

Permalink
Enable debug service on default config (#45464)
Browse files Browse the repository at this point in the history
* feat(servicecfg): enable debug service on default config

* test(tsh): disable debug service on tsh testing to avoid long path error
  • Loading branch information
gabrielcorado authored Aug 14, 2024
1 parent dfbbba6 commit a9df5e9
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/service/servicecfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,9 @@ func ApplyDefaults(cfg *Config) {
cfg.MaxRetryPeriod = defaults.MaxWatcherBackoff
cfg.Testing.ConnectFailureC = make(chan time.Duration, 1)
cfg.CircuitBreakerConfig = breaker.DefaultBreakerConfig(cfg.Clock)

// Debug service defaults.
cfg.DebugService.Enabled = true
}

// FileDescriptor is a file descriptor associated
Expand Down
3 changes: 3 additions & 0 deletions lib/service/servicecfg/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ func TestDefaultConfig(t *testing.T) {

// Misc levers and dials
require.Equal(t, defaults.HighResPollingPeriod, config.RotationConnectionInterval)

// Debug should always be enabled by default.
require.True(t, config.DebugService.Enabled)
}

// TestCheckApp validates application configuration.
Expand Down
4 changes: 4 additions & 0 deletions tool/teleport/testenv/test_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ func MakeTestServer(t *testing.T, opts ...TestServerOptFunc) (process *service.T
cfg.SSH.Addr = utils.NetAddr{AddrNetwork: "tcp", Addr: NewTCPListener(t, service.ListenerNodeSSH, &cfg.FileDescriptors)}
cfg.SSH.DisableCreateHostUser = true

// Disabling debug service for tests so that it doesn't break if the data
// directory path is too long.
cfg.DebugService.Enabled = false

// Apply options
for _, fn := range options.ConfigFuncs {
fn(cfg)
Expand Down
3 changes: 3 additions & 0 deletions tool/tsh/common/app_aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ func makeTestApplicationServer(t *testing.T, proxy *service.TeleportProcess, app
cfg.Apps.Enabled = true
cfg.Apps.Apps = apps
cfg.Log = utils.NewLoggerForTests()
// Disabling debug service for tests so that it doesn't break if the data
// directory path is too long.
cfg.DebugService.Enabled = false

return runTeleport(t, cfg)
}
7 changes: 7 additions & 0 deletions tool/tsh/common/tsh_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func (s *suite) setupRootCluster(t *testing.T, options testSuiteOptions) {
require.NoError(t, err)
cfg.SetToken(staticToken)

// Disabling debug service for tests so that it doesn't break if the data
// directory path is too long.
cfg.DebugService.Enabled = false

user, err := user.Current()
require.NoError(t, err)

Expand Down Expand Up @@ -202,6 +206,9 @@ func (s *suite) setupLeafCluster(t *testing.T, options testSuiteOptions) {
})
require.NoError(t, err)
cfg.SetToken(staticToken)
// Disabling debug service for tests so that it doesn't break if the data
// directory path is too long.
cfg.DebugService.Enabled = false
sshLoginRole, err := types.NewRole("ssh-login", types.RoleSpecV6{
Allow: types.RoleConditions{
Logins: []string{user.Username},
Expand Down
6 changes: 6 additions & 0 deletions tool/tsh/common/tsh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3524,6 +3524,9 @@ func makeTestSSHNode(t *testing.T, authAddr *utils.NetAddr, opts ...testServerOp
cfg.SSH.PublicAddrs = []utils.NetAddr{cfg.SSH.Addr}
cfg.SSH.DisableCreateHostUser = true
cfg.Log = utils.NewLoggerForTests()
// Disabling debug service for tests so that it doesn't break if the data
// directory path is too long.
cfg.DebugService.Enabled = false

for _, fn := range options.configFuncs {
fn(cfg)
Expand Down Expand Up @@ -3569,6 +3572,9 @@ func makeTestServers(t *testing.T, opts ...testServerOptFunc) (auth *service.Tel
cfg.Proxy.ReverseTunnelListenAddr = utils.NetAddr{AddrNetwork: "tcp", Addr: net.JoinHostPort("127.0.0.1", ports.Pop())}
cfg.Proxy.DisableWebInterface = true
cfg.Log = utils.NewLoggerForTests()
// Disabling debug service for tests so that it doesn't break if the data
// directory path is too long.
cfg.DebugService.Enabled = false

for _, fn := range options.configFuncs {
fn(cfg)
Expand Down

0 comments on commit a9df5e9

Please sign in to comment.