mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
fix: fix workspacesdk to return error on API mismatch (#13683)
This commit is contained in:
@ -46,8 +46,9 @@ func TestBlockNonBrowser(t *testing.T) {
|
||||
},
|
||||
})
|
||||
r := setupWorkspaceAgent(t, client, user, 0)
|
||||
ctx := testutil.Context(t, testutil.WaitShort)
|
||||
//nolint:gocritic // Testing that even the owner gets blocked.
|
||||
_, err := workspacesdk.New(client).DialAgent(context.Background(), r.sdkAgent.ID, nil)
|
||||
_, err := workspacesdk.New(client).DialAgent(ctx, r.sdkAgent.ID, nil)
|
||||
var apiErr *codersdk.Error
|
||||
require.ErrorAs(t, err, &apiErr)
|
||||
require.Equal(t, http.StatusConflict, apiErr.StatusCode())
|
||||
@ -65,8 +66,9 @@ func TestBlockNonBrowser(t *testing.T) {
|
||||
},
|
||||
})
|
||||
r := setupWorkspaceAgent(t, client, user, 0)
|
||||
ctx := testutil.Context(t, testutil.WaitShort)
|
||||
//nolint:gocritic // Testing RBAC is not the point of this test.
|
||||
conn, err := workspacesdk.New(client).DialAgent(context.Background(), r.sdkAgent.ID, nil)
|
||||
conn, err := workspacesdk.New(client).DialAgent(ctx, r.sdkAgent.ID, nil)
|
||||
require.NoError(t, err)
|
||||
_ = conn.Close()
|
||||
})
|
||||
|
Reference in New Issue
Block a user