From 45ecd02fecb3b1ebeb83d89d699e98000e727ad3 Mon Sep 17 00:00:00 2001 From: Brandon Croft Date: Fri, 10 Jun 2022 10:01:22 -0600 Subject: [PATCH] try moving test setup --- workspace_integration_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/workspace_integration_test.go b/workspace_integration_test.go index b6f936366..04f0ee553 100644 --- a/workspace_integration_test.go +++ b/workspace_integration_test.go @@ -939,9 +939,6 @@ 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() @@ -949,12 +946,6 @@ func TestWorkspacesUnlock(t *testing.T) { 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) @@ -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) })