MCPcopy Index your code
hub / github.com/coder/coder / assertWorkspaceLastUsedAtNotUpdated

Function assertWorkspaceLastUsedAtNotUpdated

coderd/workspaceapps/apptest/apptest.go:2489–2501  ·  view source on GitHub ↗

Except when it sometimes shouldn't (e.g. no access) NOTE: Despite our efforts with the flush channel, this is inherently racy when used with parallel tests on the same workspace/app. See assertWorkspaceLastUsedAtUpdated for why this takes a duration instead of a context.

(t testing.TB, details *Details, timeout time.Duration)

Source from the content-addressed store, hash-verified

2487// See assertWorkspaceLastUsedAtUpdated for why this takes a duration
2488// instead of a context.
2489func assertWorkspaceLastUsedAtNotUpdated(t testing.TB, details *Details, timeout time.Duration) {
2490 t.Helper()
2491
2492 ctx := testutil.Context(t, timeout)
2493
2494 require.NotNil(t, details.Workspace, "can't assert LastUsedAt on a nil workspace!")
2495 before, err := details.SDKClient.Workspace(ctx, details.Workspace.ID)
2496 require.NoError(t, err)
2497 details.FlushStats()
2498 after, err := details.SDKClient.Workspace(ctx, details.Workspace.ID)
2499 require.NoError(t, err)
2500 require.Equal(t, before.LastUsedAt, after.LastUsedAt, "workspace LastUsedAt updated when it should not have been")
2501}
2502
2503func generateBadJWE(t *testing.T, claims interface{}) string {
2504 t.Helper()

Callers 1

RunFunction · 0.85

Calls 4

ContextFunction · 0.92
WorkspaceMethod · 0.80
HelperMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected