mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
chore: reduce the log output of skipped tests (#7520)
With the introduction of the workspace proxy tests there was a lot of output if a test was eventually skipped.
This commit is contained in:
@ -1020,7 +1020,7 @@ func TestAgentMetadata_Timing(t *testing.T) {
|
|||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
// Shell scripting in Windows is a pain, and we have already tested
|
// Shell scripting in Windows is a pain, and we have already tested
|
||||||
// that the OS logic works in the simpler tests.
|
// that the OS logic works in the simpler tests.
|
||||||
t.Skip()
|
t.SkipNow()
|
||||||
}
|
}
|
||||||
testutil.SkipIfNotTiming(t)
|
testutil.SkipIfNotTiming(t)
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
@ -34,7 +34,7 @@ func TestMigrate(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
if testing.Short() {
|
if testing.Short() {
|
||||||
t.Skip()
|
t.SkipNow()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ func TestMigrateUpWithFixtures(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
if testing.Short() {
|
if testing.Short() {
|
||||||
t.Skip()
|
t.SkipNow()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ func TestPostgres(t *testing.T) {
|
|||||||
// t.Parallel()
|
// t.Parallel()
|
||||||
|
|
||||||
if testing.Short() {
|
if testing.Short() {
|
||||||
t.Skip()
|
t.SkipNow()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ func TestPubsub(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
if testing.Short() {
|
if testing.Short() {
|
||||||
t.Skip()
|
t.SkipNow()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,12 @@ import (
|
|||||||
|
|
||||||
// Run runs the entire workspace app test suite against deployments minted
|
// Run runs the entire workspace app test suite against deployments minted
|
||||||
// by the provided factory.
|
// 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 {
|
setupProxyTest := func(t *testing.T, opts *DeploymentOptions) *Details {
|
||||||
return setupProxyTestWithFactory(t, factory, opts)
|
return setupProxyTestWithFactory(t, factory, opts)
|
||||||
}
|
}
|
||||||
@ -109,12 +114,12 @@ func Run(t *testing.T, factory DeploymentFactory) {
|
|||||||
|
|
||||||
t.Run("SignedTokenQueryParameter", func(t *testing.T) {
|
t.Run("SignedTokenQueryParameter", func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
if appHostIsPrimary {
|
||||||
appDetails := setupProxyTest(t, nil)
|
|
||||||
if appDetails.AppHostIsPrimary {
|
|
||||||
t.Skip("Tickets are not used for terminal requests on the primary.")
|
t.Skip("Tickets are not used for terminal requests on the primary.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appDetails := setupProxyTest(t, nil)
|
||||||
|
|
||||||
u := *appDetails.PathAppBaseURL
|
u := *appDetails.PathAppBaseURL
|
||||||
if u.Scheme == "http" {
|
if u.Scheme == "http" {
|
||||||
u.Scheme = "ws"
|
u.Scheme = "ws"
|
||||||
@ -197,7 +202,7 @@ func Run(t *testing.T, factory DeploymentFactory) {
|
|||||||
t.Run("LoginWithoutAuthOnPrimary", func(t *testing.T) {
|
t.Run("LoginWithoutAuthOnPrimary", func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
if !appDetails.AppHostIsPrimary {
|
if !appHostIsPrimary {
|
||||||
t.Skip("This test only applies when testing apps on the primary.")
|
t.Skip("This test only applies when testing apps on the primary.")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +227,7 @@ func Run(t *testing.T, factory DeploymentFactory) {
|
|||||||
t.Run("LoginWithoutAuthOnProxy", func(t *testing.T) {
|
t.Run("LoginWithoutAuthOnProxy", func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
if appDetails.AppHostIsPrimary {
|
if appHostIsPrimary {
|
||||||
t.Skip("This test only applies when testing apps on workspace proxies.")
|
t.Skip("This test only applies when testing apps on workspace proxies.")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +453,7 @@ func Run(t *testing.T, factory DeploymentFactory) {
|
|||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
c := c
|
c := c
|
||||||
|
|
||||||
if c.name == "Path" && appDetails.AppHostIsPrimary {
|
if c.name == "Path" && appHostIsPrimary {
|
||||||
// Workspace application auth does not apply to path apps
|
// Workspace application auth does not apply to path apps
|
||||||
// served from the primary access URL as no smuggling needs
|
// served from the primary access URL as no smuggling needs
|
||||||
// to take place (they're already logged in with a session
|
// to take place (they're already logged in with a session
|
||||||
@ -599,16 +604,15 @@ func Run(t *testing.T, factory DeploymentFactory) {
|
|||||||
// --app-hostname is not set by the admin.
|
// --app-hostname is not set by the admin.
|
||||||
t.Run("WorkspaceAppsProxySubdomainPassthrough", func(t *testing.T) {
|
t.Run("WorkspaceAppsProxySubdomainPassthrough", func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
if !appHostIsPrimary {
|
||||||
|
t.Skip("app hostname does not serve API")
|
||||||
|
}
|
||||||
// No Hostname set.
|
// No Hostname set.
|
||||||
appDetails := setupProxyTest(t, &DeploymentOptions{
|
appDetails := setupProxyTest(t, &DeploymentOptions{
|
||||||
AppHost: "",
|
AppHost: "",
|
||||||
DisableSubdomainApps: true,
|
DisableSubdomainApps: true,
|
||||||
noWorkspace: true,
|
noWorkspace: true,
|
||||||
})
|
})
|
||||||
if !appDetails.AppHostIsPrimary {
|
|
||||||
t.Skip("app hostname does not serve API")
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
|
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -1031,7 +1035,7 @@ func Run(t *testing.T, factory DeploymentFactory) {
|
|||||||
require.NoError(t, err, msg)
|
require.NoError(t, err, msg)
|
||||||
|
|
||||||
expectedPath := "/login"
|
expectedPath := "/login"
|
||||||
if !isPathApp || !appDetails.AppHostIsPrimary {
|
if !isPathApp || !appHostIsPrimary {
|
||||||
expectedPath = "/api/v2/applications/auth-redirect"
|
expectedPath = "/api/v2/applications/auth-redirect"
|
||||||
}
|
}
|
||||||
assert.Equal(t, expectedPath, location.Path, "should not have access, expected redirect to applicable login endpoint. "+msg)
|
assert.Equal(t, expectedPath, location.Path, "should not have access, expected redirect to applicable login endpoint. "+msg)
|
||||||
|
@ -63,11 +63,6 @@ type Deployment struct {
|
|||||||
SDKClient *codersdk.Client
|
SDKClient *codersdk.Client
|
||||||
FirstUser codersdk.CreateFirstUserResponse
|
FirstUser codersdk.CreateFirstUserResponse
|
||||||
PathAppBaseURL *url.URL
|
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,
|
// DeploymentFactory generates a deployment with an API client, a path base URL,
|
||||||
|
@ -252,7 +252,7 @@ func TestWorkspaceApplicationAuth(t *testing.T) {
|
|||||||
func TestWorkspaceApps(t *testing.T) {
|
func TestWorkspaceApps(t *testing.T) {
|
||||||
t.Parallel()
|
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 := coderdtest.DeploymentValues(t)
|
||||||
deploymentValues.DisablePathApps = clibase.Bool(opts.DisablePathApps)
|
deploymentValues.DisablePathApps = clibase.Bool(opts.DisablePathApps)
|
||||||
deploymentValues.Dangerous.AllowPathAppSharing = clibase.Bool(opts.DangerousAllowPathAppSharing)
|
deploymentValues.Dangerous.AllowPathAppSharing = clibase.Bool(opts.DangerousAllowPathAppSharing)
|
||||||
@ -280,11 +280,10 @@ func TestWorkspaceApps(t *testing.T) {
|
|||||||
user := coderdtest.CreateFirstUser(t, client)
|
user := coderdtest.CreateFirstUser(t, client)
|
||||||
|
|
||||||
return &apptest.Deployment{
|
return &apptest.Deployment{
|
||||||
Options: opts,
|
Options: opts,
|
||||||
SDKClient: client,
|
SDKClient: client,
|
||||||
FirstUser: user,
|
FirstUser: user,
|
||||||
PathAppBaseURL: client.URL,
|
PathAppBaseURL: client.URL,
|
||||||
AppHostIsPrimary: true,
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
func TestWorkspaceProxyWorkspaceApps(t *testing.T) {
|
func TestWorkspaceProxyWorkspaceApps(t *testing.T) {
|
||||||
t.Parallel()
|
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 := coderdtest.DeploymentValues(t)
|
||||||
deploymentValues.DisablePathApps = clibase.Bool(opts.DisablePathApps)
|
deploymentValues.DisablePathApps = clibase.Bool(opts.DisablePathApps)
|
||||||
deploymentValues.Dangerous.AllowPathAppSharing = clibase.Bool(opts.DangerousAllowPathAppSharing)
|
deploymentValues.Dangerous.AllowPathAppSharing = clibase.Bool(opts.DangerousAllowPathAppSharing)
|
||||||
@ -61,11 +61,10 @@ func TestWorkspaceProxyWorkspaceApps(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return &apptest.Deployment{
|
return &apptest.Deployment{
|
||||||
Options: opts,
|
Options: opts,
|
||||||
SDKClient: client,
|
SDKClient: client,
|
||||||
FirstUser: user,
|
FirstUser: user,
|
||||||
PathAppBaseURL: proxyAPI.Options.AccessURL,
|
PathAppBaseURL: proxyAPI.Options.AccessURL,
|
||||||
AppHostIsPrimary: false,
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user