Skip to content

Commit

Permalink
Reuse new test helpers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joerger committed Jan 30, 2025
1 parent bebaeb9 commit 5c887d6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 34 deletions.
3 changes: 0 additions & 3 deletions integration/web/web_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func TestMFAAuthenticateChallenge_IsMFARequiredApp(t *testing.T) {
testserver.WithTestApp(t, "root-app"),
testserver.WithTestApp(t, "root-app-mfa"),
testserver.WithConfig(func(cfg *servicecfg.Config) {
cfg.Auth.NetworkingConfig.SetProxyListenerMode(types.ProxyListenerMode_Multiplex)
cfg.SSH.Enabled = false
cfg.Auth.Preference = &types.AuthPreferenceV2{
Metadata: types.Metadata{
Expand All @@ -98,8 +97,6 @@ func TestMFAAuthenticateChallenge_IsMFARequiredApp(t *testing.T) {
testserver.WithTestApp(t, "leaf-app-mfa"),
testserver.WithConfig(func(cfg *servicecfg.Config) {
cfg.SSH.Enabled = false
cfg.Apps.Enabled = true
cfg.Apps.DebugApp = true
}),
)
leafAuth := leafServer.GetAuthServer()
Expand Down
2 changes: 1 addition & 1 deletion tool/teleport/testenv/test_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func WithProxyKube(t *testing.T) TestServerOptFunc {
}

// WithDebugApp enables the app service and the debug app.
func WithDebugApp(t *testing.T) TestServerOptFunc {
func WithDebugApp() TestServerOptFunc {
return WithConfig(func(cfg *servicecfg.Config) {
cfg.Apps.Enabled = true
cfg.Apps.DebugApp = true
Expand Down
16 changes: 2 additions & 14 deletions tool/tsh/common/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,9 @@ func TestAppCommands(t *testing.T) {
rootServerOpts := []testserver.TestServerOptFunc{
testserver.WithBootstrap(connector, accessUser),
testserver.WithClusterName(t, "root"),
testserver.WithTestApp(t, "rootapp"),
testserver.WithConfig(func(cfg *servicecfg.Config) {
cfg.Auth.NetworkingConfig.SetProxyListenerMode(types.ProxyListenerMode_Multiplex)
cfg.Apps = servicecfg.AppsConfig{
Enabled: true,
Apps: []servicecfg.App{{
Name: "rootapp",
URI: startDummyHTTPServer(t, "rootapp"),
}},
}
}),
}
rootServer := testserver.MakeTestServer(t, rootServerOpts...)
Expand All @@ -124,15 +118,9 @@ func TestAppCommands(t *testing.T) {
leafServerOpts := []testserver.TestServerOptFunc{
testserver.WithBootstrap(accessUser),
testserver.WithClusterName(t, "leaf"),
testserver.WithTestApp(t, "leafapp"),
testserver.WithConfig(func(cfg *servicecfg.Config) {
cfg.Auth.NetworkingConfig.SetProxyListenerMode(types.ProxyListenerMode_Multiplex)
cfg.Apps = servicecfg.AppsConfig{
Enabled: true,
Apps: []servicecfg.App{{
Name: "leafapp",
URI: startDummyHTTPServer(t, "leafapp"),
}},
}
}),
}
leafServer := testserver.MakeTestServer(t, leafServerOpts...)
Expand Down
11 changes: 1 addition & 10 deletions tool/tsh/common/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1482,19 +1482,10 @@ func TestProxyAppWithIdentity(t *testing.T) {
userName = "admin"
)

appURI := startDummyHTTPServer(t, appName)

rootServerOpts := []testserver.TestServerOptFunc{
testserver.WithClusterName(t, clusterName),
testserver.WithTestApp(t, appName),
testserver.WithConfig(func(cfg *servicecfg.Config) {
cfg.Auth.NetworkingConfig.SetProxyListenerMode(types.ProxyListenerMode_Multiplex)
cfg.Apps = servicecfg.AppsConfig{
Enabled: true,
Apps: []servicecfg.App{{
Name: appName,
URI: appURI,
}},
}
}),
}
process := testserver.MakeTestServer(t, rootServerOpts...)
Expand Down
8 changes: 2 additions & 6 deletions tool/tsh/common/tsh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6029,6 +6029,7 @@ func TestListingResourcesAcrossClusters(t *testing.T) {
testserver.WithBootstrap(connector, accessUser),
testserver.WithHostname("node01"),
testserver.WithClusterName(t, "root"),
testserver.WithDebugApp(),
testserver.WithConfig(func(cfg *servicecfg.Config) {
// Enable DB
cfg.Databases.Enabled = true
Expand All @@ -6039,9 +6040,6 @@ func TestListingResourcesAcrossClusters(t *testing.T) {
URI: "localhost:5432",
},
}

cfg.Apps.Enabled = true
cfg.Apps.DebugApp = true
}),
}
rootServer := testserver.MakeTestServer(t, rootServerOpts...)
Expand All @@ -6050,6 +6048,7 @@ func TestListingResourcesAcrossClusters(t *testing.T) {
testserver.WithBootstrap(connector, accessUser),
testserver.WithHostname("node02"),
testserver.WithClusterName(t, "leaf"),
testserver.WithDebugApp(),
testserver.WithConfig(func(cfg *servicecfg.Config) {
// Enable DB
cfg.Databases.Enabled = true
Expand All @@ -6060,9 +6059,6 @@ func TestListingResourcesAcrossClusters(t *testing.T) {
URI: "localhost:5432",
},
}

cfg.Apps.Enabled = true
cfg.Apps.DebugApp = true
}),
}
leafServer := testserver.MakeTestServer(t, leafServerOpts...)
Expand Down

0 comments on commit 5c887d6

Please sign in to comment.