Skip to content

Commit

Permalink
Update tests to exit early if there is a setup error
Browse files Browse the repository at this point in the history
  • Loading branch information
JarrettSpiker committed Oct 21, 2022
1 parent 2213c1e commit e8b91ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions organization_integration_test.go
Expand Up @@ -568,6 +568,8 @@ func TestOrganizationsReadRunTasksEntitlement(t *testing.T) {
}

func TestOrganizationsAllowForceDeleteSetting(t *testing.T) {
skipIfNotCINode(t)

client := testClient(t)
ctx := context.Background()

Expand All @@ -579,12 +581,12 @@ func TestOrganizationsAllowForceDeleteSetting(t *testing.T) {
}

org, err := client.Organizations.Create(ctx, options)
assert.Nil(t, err)
require.NoError(t, err)

t.Cleanup(func() {
err := client.Organizations.Delete(ctx, org.Name)
if err != nil {
t.Logf("error deleting organization (%s): %s", org.Name, err)
t.Errorf("error deleting organization (%s): %s", org.Name, err)
}
})

Expand All @@ -593,11 +595,11 @@ func TestOrganizationsAllowForceDeleteSetting(t *testing.T) {
assert.True(t, org.AllowForceDeleteWorkspaces)

org, err = client.Organizations.Update(ctx, org.Name, OrganizationUpdateOptions{AllowForceDeleteWorkspaces: Bool(false)})
assert.Nil(t, err)
require.NoError(t, err)
assert.False(t, org.AllowForceDeleteWorkspaces)

org, err = client.Organizations.Read(ctx, org.Name)
assert.Nil(t, err)
require.NoError(t, err)
assert.False(t, org.AllowForceDeleteWorkspaces)
})
}
Expand Down
6 changes: 6 additions & 0 deletions workspace_integration_test.go
Expand Up @@ -1212,6 +1212,8 @@ func TestWorkspacesDeleteByID(t *testing.T) {
}

func TestCanForceDeletePermission(t *testing.T) {
skipIfNotCINode(t)

client := testClient(t)
ctx := context.Background()

Expand All @@ -1230,6 +1232,8 @@ func TestCanForceDeletePermission(t *testing.T) {
}

func TestWorkspacesSafeDelete(t *testing.T) {
skipIfNotCINode(t)

client := testClient(t)
ctx := context.Background()

Expand Down Expand Up @@ -1283,6 +1287,8 @@ func TestWorkspacesSafeDelete(t *testing.T) {
}

func TestWorkspacesSafeDeleteByID(t *testing.T) {
skipIfNotCINode(t)

client := testClient(t)
ctx := context.Background()

Expand Down

0 comments on commit e8b91ef

Please sign in to comment.