Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flake TestWorkspacesUnlock #427

Merged
merged 1 commit into from Jun 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions workspace_integration_test.go
Expand Up @@ -939,22 +939,13 @@ func TestWorkspacesUnlock(t *testing.T) {
wTest, wTestCleanup := createWorkspace(t, client, orgTest)
defer wTestCleanup()

wTest2, wTest2Cleanup := createWorkspace(t, client, orgTest)
defer wTest2Cleanup()

w, err := client.Workspaces.Lock(ctx, wTest.ID, WorkspaceLockOptions{})
if err != nil {
orgTestCleanup()
}
require.NoError(t, err)
require.True(t, w.Locked)

_, rTestCleanup := createRun(t, client, wTest2)
defer rTestCleanup()

// Wait for wTest2 to be locked by a run
waitForRunLock(t, client, wTest2.ID)

t.Run("with valid options", func(t *testing.T) {
w, err := client.Workspaces.Unlock(ctx, wTest.ID)
require.NoError(t, err)
Expand All @@ -967,6 +958,15 @@ func TestWorkspacesUnlock(t *testing.T) {
})

t.Run("when a workspace is locked by a run", func(t *testing.T) {
wTest2, wTest2Cleanup := createWorkspace(t, client, orgTest)
defer wTest2Cleanup()

_, rTestCleanup := createRun(t, client, wTest2)
defer rTestCleanup()

// Wait for wTest2 to be locked by a run
waitForRunLock(t, client, wTest2.ID)

_, err = client.Workspaces.Unlock(ctx, wTest2.ID)
assert.Equal(t, ErrWorkspaceLockedByRun, err)
})
Expand Down