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

Commit7582d61

Browse files
committed
use the correct client
1 parent5106b19 commit7582d61

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

‎coderd/workspaceapps/apptest/apptest.go‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
6464
// reconnecting-pty proxy server we want to test is mounted.
6565
client:=appDetails.AppClient(t)
6666
testReconnectingPTY(ctx,t,client,appDetails.Agent.ID,"")
67-
assertWorkspaceLastUsedAtUpdated(t,client,appDetails)
67+
assertWorkspaceLastUsedAtUpdated(t,appDetails)
6868
})
6969

7070
t.Run("SignedTokenQueryParameter",func(t*testing.T) {
@@ -93,7 +93,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
9393
// Make an unauthenticated client.
9494
unauthedAppClient:=codersdk.New(appDetails.AppClient(t).URL)
9595
testReconnectingPTY(ctx,t,unauthedAppClient,appDetails.Agent.ID,issueRes.SignedToken)
96-
assertWorkspaceLastUsedAtUpdated(t,appDetails.AppClient(t),appDetails)
96+
assertWorkspaceLastUsedAtUpdated(t,appDetails)
9797
})
9898
})
9999

@@ -121,7 +121,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
121121
require.Contains(t,string(body),"Path-based applications are disabled")
122122
// Even though path-based apps are disabled, the request should indicate
123123
// that the workspace was used.
124-
assertWorkspaceLastUsedAtNotUpdated(t,appDetails.AppClient(t),appDetails)
124+
assertWorkspaceLastUsedAtNotUpdated(t,appDetails)
125125
})
126126

127127
t.Run("LoginWithoutAuthOnPrimary",func(t*testing.T) {
@@ -147,7 +147,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
147147
require.NoError(t,err)
148148
require.True(t,loc.Query().Has("message"))
149149
require.True(t,loc.Query().Has("redirect"))
150-
assertWorkspaceLastUsedAtUpdated(t,appDetails.AppClient(t),appDetails)
150+
assertWorkspaceLastUsedAtUpdated(t,appDetails)
151151
})
152152

153153
t.Run("LoginWithoutAuthOnProxy",func(t*testing.T) {
@@ -185,7 +185,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
185185
// request is getting stripped.
186186
require.Equal(t,u.Path,redirectURI.Path+"/")
187187
require.Equal(t,u.RawQuery,redirectURI.RawQuery)
188-
assertWorkspaceLastUsedAtUpdated(t,appDetails.AppClient(t),appDetails)
188+
assertWorkspaceLastUsedAtUpdated(t,appDetails)
189189
})
190190

191191
t.Run("NoAccessShould404",func(t*testing.T) {
@@ -280,7 +280,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
280280
require.NoError(t,err)
281281
require.Equal(t,proxyTestAppBody,string(body))
282282
require.Equal(t,http.StatusOK,resp.StatusCode)
283-
assertWorkspaceLastUsedAtUpdated(t,appDetails.AppClient(t),appDetails)
283+
assertWorkspaceLastUsedAtUpdated(t,appDetails)
284284
})
285285

286286
t.Run("ProxiesHTTPS",func(t*testing.T) {
@@ -326,7 +326,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
326326
require.NoError(t,err)
327327
require.Equal(t,proxyTestAppBody,string(body))
328328
require.Equal(t,http.StatusOK,resp.StatusCode)
329-
assertWorkspaceLastUsedAtUpdated(t,appDetails.AppClient(t),appDetails)
329+
assertWorkspaceLastUsedAtUpdated(t,appDetails)
330330
})
331331

332332
t.Run("BlocksMe",func(t*testing.T) {
@@ -366,7 +366,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
366366
require.Equal(t,proxyTestAppBody,string(body))
367367
require.Equal(t,http.StatusOK,resp.StatusCode)
368368
require.Equal(t,"1.1.1.1,127.0.0.1",resp.Header.Get("X-Forwarded-For"))
369-
assertWorkspaceLastUsedAtUpdated(t,appDetails.AppClient(t),appDetails)
369+
assertWorkspaceLastUsedAtUpdated(t,appDetails)
370370
})
371371

372372
t.Run("ProxyError",func(t*testing.T) {
@@ -381,7 +381,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
381381
require.Equal(t,http.StatusBadGateway,resp.StatusCode)
382382
// An valid authenticated attempt to access a workspace app
383383
// should count as usage regardless of success.
384-
assertWorkspaceLastUsedAtUpdated(t,appDetails.AppClient(t),appDetails)
384+
assertWorkspaceLastUsedAtUpdated(t,appDetails)
385385
})
386386

387387
t.Run("NoProxyPort",func(t*testing.T) {
@@ -396,7 +396,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
396396
// TODO(@deansheather): This should be 400. There's a todo in the
397397
// resolve request code to fix this.
398398
require.Equal(t,http.StatusInternalServerError,resp.StatusCode)
399-
assertWorkspaceLastUsedAtNotUpdated(t,appDetails.AppClient(t),appDetails)
399+
assertWorkspaceLastUsedAtNotUpdated(t,appDetails)
400400
})
401401
})
402402

@@ -1566,21 +1566,21 @@ func testReconnectingPTY(ctx context.Context, t *testing.T, client *codersdk.Cli
15661566
}
15671567

15681568
// Accessing an app should update the workspace's LastUsedAt.
1569-
funcassertWorkspaceLastUsedAtUpdated(t testing.TB,client*codersdk.Client,details*Details) {
1569+
funcassertWorkspaceLastUsedAtUpdated(t testing.TB,details*Details) {
15701570
t.Helper()
15711571

15721572
details.FlushStats()
1573-
ws,err:=client.Workspace(context.Background(),details.Workspace.ID)
1573+
ws,err:=details.SDKClient.Workspace(context.Background(),details.Workspace.ID)
15741574
require.NoError(t,err)
15751575
require.Greater(t,ws.LastUsedAt,details.Workspace.LastUsedAt,"workspace LastUsedAt not updated when it should have been")
15761576
}
15771577

15781578
// Except when it sometimes shouldn't (e.g. no access)
1579-
funcassertWorkspaceLastUsedAtNotUpdated(t testing.TB,client*codersdk.Client,details*Details) {
1579+
funcassertWorkspaceLastUsedAtNotUpdated(t testing.TB,details*Details) {
15801580
t.Helper()
15811581

15821582
details.FlushStats()
1583-
ws,err:=client.Workspace(context.Background(),details.Workspace.ID)
1583+
ws,err:=details.SDKClient.Workspace(context.Background(),details.Workspace.ID)
15841584
require.NoError(t,err)
15851585
require.Equal(t,ws.LastUsedAt,details.Workspace.LastUsedAt,"workspace LastUsedAt updated when it should not have been")
15861586
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp