Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit70d2203

Browse files
authored
chore: reduce the log output of skipped tests (#7520)
With the introduction of the workspace proxy tests there was a lotof output if a test was eventually skipped.
1 parent9bb0253 commit70d2203

File tree

8 files changed

+31
-34
lines changed

8 files changed

+31
-34
lines changed

‎agent/agent_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ func TestAgentMetadata_Timing(t *testing.T) {
10201020
ifruntime.GOOS=="windows" {
10211021
// Shell scripting in Windows is a pain, and we have already tested
10221022
// that the OS logic works in the simpler tests.
1023-
t.Skip()
1023+
t.SkipNow()
10241024
}
10251025
testutil.SkipIfNotTiming(t)
10261026
t.Parallel()

‎coderd/database/migrations/migrate_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestMigrate(t *testing.T) {
3434
t.Parallel()
3535

3636
iftesting.Short() {
37-
t.Skip()
37+
t.SkipNow()
3838
return
3939
}
4040

@@ -198,7 +198,7 @@ func TestMigrateUpWithFixtures(t *testing.T) {
198198
t.Parallel()
199199

200200
iftesting.Short() {
201-
t.Skip()
201+
t.SkipNow()
202202
return
203203
}
204204

‎coderd/database/postgres/postgres_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestPostgres(t *testing.T) {
2323
// t.Parallel()
2424

2525
iftesting.Short() {
26-
t.Skip()
26+
t.SkipNow()
2727
return
2828
}
2929

‎coderd/database/pubsub_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestPubsub(t *testing.T) {
2424
t.Parallel()
2525

2626
iftesting.Short() {
27-
t.Skip()
27+
t.SkipNow()
2828
return
2929
}
3030

‎coderd/workspaceapps/apptest/apptest.go‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ import (
3232

3333
// Run runs the entire workspace app test suite against deployments minted
3434
// by the provided factory.
35-
funcRun(t*testing.T,factoryDeploymentFactory) {
35+
//
36+
// appHostIsPrimary is true if the app host is also the primary coder API
37+
// server. This disables any tests that test API passthrough or rely on the
38+
// app server not being the API server.
39+
// nolint:revive
40+
funcRun(t*testing.T,appHostIsPrimarybool,factoryDeploymentFactory) {
3641
setupProxyTest:=func(t*testing.T,opts*DeploymentOptions)*Details {
3742
returnsetupProxyTestWithFactory(t,factory,opts)
3843
}
@@ -109,12 +114,12 @@ func Run(t *testing.T, factory DeploymentFactory) {
109114

110115
t.Run("SignedTokenQueryParameter",func(t*testing.T) {
111116
t.Parallel()
112-
113-
appDetails:=setupProxyTest(t,nil)
114-
ifappDetails.AppHostIsPrimary {
117+
ifappHostIsPrimary {
115118
t.Skip("Tickets are not used for terminal requests on the primary.")
116119
}
117120

121+
appDetails:=setupProxyTest(t,nil)
122+
118123
u:=*appDetails.PathAppBaseURL
119124
ifu.Scheme=="http" {
120125
u.Scheme="ws"
@@ -197,7 +202,7 @@ func Run(t *testing.T, factory DeploymentFactory) {
197202
t.Run("LoginWithoutAuthOnPrimary",func(t*testing.T) {
198203
t.Parallel()
199204

200-
if!appDetails.AppHostIsPrimary {
205+
if!appHostIsPrimary {
201206
t.Skip("This test only applies when testing apps on the primary.")
202207
}
203208

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

225-
ifappDetails.AppHostIsPrimary {
230+
ifappHostIsPrimary {
226231
t.Skip("This test only applies when testing apps on workspace proxies.")
227232
}
228233

@@ -448,7 +453,7 @@ func Run(t *testing.T, factory DeploymentFactory) {
448453
for_,c:=rangecases {
449454
c:=c
450455

451-
ifc.name=="Path"&&appDetails.AppHostIsPrimary {
456+
ifc.name=="Path"&&appHostIsPrimary {
452457
// Workspace application auth does not apply to path apps
453458
// served from the primary access URL as no smuggling needs
454459
// to take place (they're already logged in with a session
@@ -599,16 +604,15 @@ func Run(t *testing.T, factory DeploymentFactory) {
599604
// --app-hostname is not set by the admin.
600605
t.Run("WorkspaceAppsProxySubdomainPassthrough",func(t*testing.T) {
601606
t.Parallel()
602-
607+
if!appHostIsPrimary {
608+
t.Skip("app hostname does not serve API")
609+
}
603610
// No Hostname set.
604611
appDetails:=setupProxyTest(t,&DeploymentOptions{
605612
AppHost:"",
606613
DisableSubdomainApps:true,
607614
noWorkspace:true,
608615
})
609-
if!appDetails.AppHostIsPrimary {
610-
t.Skip("app hostname does not serve API")
611-
}
612616

613617
ctx,cancel:=context.WithTimeout(context.Background(),testutil.WaitLong)
614618
defercancel()
@@ -1031,7 +1035,7 @@ func Run(t *testing.T, factory DeploymentFactory) {
10311035
require.NoError(t,err,msg)
10321036

10331037
expectedPath:="/login"
1034-
if!isPathApp||!appDetails.AppHostIsPrimary {
1038+
if!isPathApp||!appHostIsPrimary {
10351039
expectedPath="/api/v2/applications/auth-redirect"
10361040
}
10371041
assert.Equal(t,expectedPath,location.Path,"should not have access, expected redirect to applicable login endpoint. "+msg)

‎coderd/workspaceapps/apptest/setup.go‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ type Deployment struct {
6363
SDKClient*codersdk.Client
6464
FirstUser codersdk.CreateFirstUserResponse
6565
PathAppBaseURL*url.URL
66-
67-
// AppHostIsPrimary is true if the app host is also the primary coder API
68-
// server. This disables any tests that test API passthrough or rely on the
69-
// app server not being the API server.
70-
AppHostIsPrimarybool
7166
}
7267

7368
// DeploymentFactory generates a deployment with an API client, a path base URL,

‎coderd/workspaceapps_test.go‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func TestWorkspaceApplicationAuth(t *testing.T) {
252252
funcTestWorkspaceApps(t*testing.T) {
253253
t.Parallel()
254254

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

282282
return&apptest.Deployment{
283-
Options:opts,
284-
SDKClient:client,
285-
FirstUser:user,
286-
PathAppBaseURL:client.URL,
287-
AppHostIsPrimary:true,
283+
Options:opts,
284+
SDKClient:client,
285+
FirstUser:user,
286+
PathAppBaseURL:client.URL,
288287
}
289288
})
290289
}

‎enterprise/wsproxy/wsproxy_test.go‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
funcTestWorkspaceProxyWorkspaceApps(t*testing.T) {
1717
t.Parallel()
1818

19-
apptest.Run(t,func(t*testing.T,opts*apptest.DeploymentOptions)*apptest.Deployment {
19+
apptest.Run(t,false,func(t*testing.T,opts*apptest.DeploymentOptions)*apptest.Deployment {
2020
deploymentValues:=coderdtest.DeploymentValues(t)
2121
deploymentValues.DisablePathApps=clibase.Bool(opts.DisablePathApps)
2222
deploymentValues.Dangerous.AllowPathAppSharing=clibase.Bool(opts.DangerousAllowPathAppSharing)
@@ -61,11 +61,10 @@ func TestWorkspaceProxyWorkspaceApps(t *testing.T) {
6161
})
6262

6363
return&apptest.Deployment{
64-
Options:opts,
65-
SDKClient:client,
66-
FirstUser:user,
67-
PathAppBaseURL:proxyAPI.Options.AccessURL,
68-
AppHostIsPrimary:false,
64+
Options:opts,
65+
SDKClient:client,
66+
FirstUser:user,
67+
PathAppBaseURL:proxyAPI.Options.AccessURL,
6968
}
7069
})
7170
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp