Skip to content

chore: reduce the log output of skipped tests #7520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ func TestAgentMetadata_Timing(t *testing.T) {
if runtime.GOOS == "windows" {
// Shell scripting in Windows is a pain, and we have already tested
// that the OS logic works in the simpler tests.
t.Skip()
t.SkipNow()
}
testutil.SkipIfNotTiming(t)
t.Parallel()
Expand Down
4 changes: 2 additions & 2 deletions coderd/database/migrations/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestMigrate(t *testing.T) {
t.Parallel()

if testing.Short() {
t.Skip()
t.SkipNow()
return
}

Expand Down Expand Up @@ -198,7 +198,7 @@ func TestMigrateUpWithFixtures(t *testing.T) {
t.Parallel()

if testing.Short() {
t.Skip()
t.SkipNow()
return
}

Expand Down
2 changes: 1 addition & 1 deletion coderd/database/postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestPostgres(t *testing.T) {
// t.Parallel()

if testing.Short() {
t.Skip()
t.SkipNow()
return
}

Expand Down
2 changes: 1 addition & 1 deletion coderd/database/pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestPubsub(t *testing.T) {
t.Parallel()

if testing.Short() {
t.Skip()
t.SkipNow()
return
}

Expand Down
28 changes: 16 additions & 12 deletions coderd/workspaceapps/apptest/apptest.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ import (

// Run runs the entire workspace app test suite against deployments minted
// by the provided factory.
func Run(t *testing.T, factory DeploymentFactory) {
//
// appHostIsPrimary is true if the app host is also the primary coder API
// server. This disables any tests that test API passthrough or rely on the
// app server not being the API server.
// nolint:revive
func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
setupProxyTest := func(t *testing.T, opts *DeploymentOptions) *Details {
return setupProxyTestWithFactory(t, factory, opts)
}
Expand Down Expand Up @@ -109,12 +114,12 @@ func Run(t *testing.T, factory DeploymentFactory) {

t.Run("SignedTokenQueryParameter", func(t *testing.T) {
t.Parallel()

appDetails := setupProxyTest(t, nil)
if appDetails.AppHostIsPrimary {
if appHostIsPrimary {
t.Skip("Tickets are not used for terminal requests on the primary.")
}

appDetails := setupProxyTest(t, nil)

u := *appDetails.PathAppBaseURL
if u.Scheme == "http" {
u.Scheme = "ws"
Expand Down Expand Up @@ -197,7 +202,7 @@ func Run(t *testing.T, factory DeploymentFactory) {
t.Run("LoginWithoutAuthOnPrimary", func(t *testing.T) {
t.Parallel()

if !appDetails.AppHostIsPrimary {
if !appHostIsPrimary {
t.Skip("This test only applies when testing apps on the primary.")
}

Expand All @@ -222,7 +227,7 @@ func Run(t *testing.T, factory DeploymentFactory) {
t.Run("LoginWithoutAuthOnProxy", func(t *testing.T) {
t.Parallel()

if appDetails.AppHostIsPrimary {
if appHostIsPrimary {
t.Skip("This test only applies when testing apps on workspace proxies.")
}

Expand Down Expand Up @@ -448,7 +453,7 @@ func Run(t *testing.T, factory DeploymentFactory) {
for _, c := range cases {
c := c

if c.name == "Path" && appDetails.AppHostIsPrimary {
if c.name == "Path" && appHostIsPrimary {
// Workspace application auth does not apply to path apps
// served from the primary access URL as no smuggling needs
// to take place (they're already logged in with a session
Expand Down Expand Up @@ -599,16 +604,15 @@ func Run(t *testing.T, factory DeploymentFactory) {
// --app-hostname is not set by the admin.
t.Run("WorkspaceAppsProxySubdomainPassthrough", func(t *testing.T) {
t.Parallel()

if !appHostIsPrimary {
t.Skip("app hostname does not serve API")
}
// No Hostname set.
appDetails := setupProxyTest(t, &DeploymentOptions{
AppHost: "",
DisableSubdomainApps: true,
noWorkspace: true,
})
if !appDetails.AppHostIsPrimary {
t.Skip("app hostname does not serve API")
}

ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()
Expand Down Expand Up @@ -1031,7 +1035,7 @@ func Run(t *testing.T, factory DeploymentFactory) {
require.NoError(t, err, msg)

expectedPath := "/login"
if !isPathApp || !appDetails.AppHostIsPrimary {
if !isPathApp || !appHostIsPrimary {
expectedPath = "/api/v2/applications/auth-redirect"
}
assert.Equal(t, expectedPath, location.Path, "should not have access, expected redirect to applicable login endpoint. "+msg)
Expand Down
5 changes: 0 additions & 5 deletions coderd/workspaceapps/apptest/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ type Deployment struct {
SDKClient *codersdk.Client
FirstUser codersdk.CreateFirstUserResponse
PathAppBaseURL *url.URL

// AppHostIsPrimary is true if the app host is also the primary coder API
// server. This disables any tests that test API passthrough or rely on the
// app server not being the API server.
AppHostIsPrimary bool
}

// DeploymentFactory generates a deployment with an API client, a path base URL,
Expand Down
11 changes: 5 additions & 6 deletions coderd/workspaceapps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func TestWorkspaceApplicationAuth(t *testing.T) {
func TestWorkspaceApps(t *testing.T) {
t.Parallel()

apptest.Run(t, func(t *testing.T, opts *apptest.DeploymentOptions) *apptest.Deployment {
apptest.Run(t, true, func(t *testing.T, opts *apptest.DeploymentOptions) *apptest.Deployment {
deploymentValues := coderdtest.DeploymentValues(t)
deploymentValues.DisablePathApps = clibase.Bool(opts.DisablePathApps)
deploymentValues.Dangerous.AllowPathAppSharing = clibase.Bool(opts.DangerousAllowPathAppSharing)
Expand Down Expand Up @@ -280,11 +280,10 @@ func TestWorkspaceApps(t *testing.T) {
user := coderdtest.CreateFirstUser(t, client)

return &apptest.Deployment{
Options: opts,
SDKClient: client,
FirstUser: user,
PathAppBaseURL: client.URL,
AppHostIsPrimary: true,
Options: opts,
SDKClient: client,
FirstUser: user,
PathAppBaseURL: client.URL,
}
})
}
11 changes: 5 additions & 6 deletions enterprise/wsproxy/wsproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func TestWorkspaceProxyWorkspaceApps(t *testing.T) {
t.Parallel()

apptest.Run(t, func(t *testing.T, opts *apptest.DeploymentOptions) *apptest.Deployment {
apptest.Run(t, false, func(t *testing.T, opts *apptest.DeploymentOptions) *apptest.Deployment {
deploymentValues := coderdtest.DeploymentValues(t)
deploymentValues.DisablePathApps = clibase.Bool(opts.DisablePathApps)
deploymentValues.Dangerous.AllowPathAppSharing = clibase.Bool(opts.DangerousAllowPathAppSharing)
Expand Down Expand Up @@ -61,11 +61,10 @@ func TestWorkspaceProxyWorkspaceApps(t *testing.T) {
})

return &apptest.Deployment{
Options: opts,
SDKClient: client,
FirstUser: user,
PathAppBaseURL: proxyAPI.Options.AccessURL,
AppHostIsPrimary: false,
Options: opts,
SDKClient: client,
FirstUser: user,
PathAppBaseURL: proxyAPI.Options.AccessURL,
}
})
}