Skip to content

Commit

Permalink
Cleanup ephemeral groups in integration tests (#368)
Browse files Browse the repository at this point in the history
## Changes

These tests left groups around that had to be removed
manually/separately.

## Tests

Manually ran changed integration tests.
  • Loading branch information
pietern authored Apr 14, 2023
1 parent cafc8c9 commit c4dcc5a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions internal/permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func TestAccGenericPermissions(t *testing.T) {
DisplayName: RandomName("go-sdk-"),
})
require.NoError(t, err)
t.Cleanup(func() {
err := w.Groups.DeleteById(ctx, group.Id)
require.NoError(t, err)
})

err = w.Permissions.Set(ctx, permissions.PermissionsRequest{
RequestObjectType: "notebooks",
Expand Down
4 changes: 4 additions & 0 deletions internal/scim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func TestAccGroups(t *testing.T) {
DisplayName: RandomName("go-sdk-"),
})
require.NoError(t, err)
t.Cleanup(func() {
err := w.Groups.DeleteById(ctx, group.Id)
require.True(t, err == nil || apierr.IsMissing(err))
})

// fetch the group we've just created
fetch, err := w.Groups.GetById(ctx, group.Id)
Expand Down
6 changes: 5 additions & 1 deletion internal/secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ func TestAccSecrets(t *testing.T) {
assert.True(t, len(scrts.Secrets) == 1)

group, err := w.Groups.Create(ctx, scim.Group{
DisplayName: RandomName("sdk-go-secret-managers"),
DisplayName: RandomName("go-sdk-"),
})
require.NoError(t, err)
t.Cleanup(func() {
err = w.Groups.DeleteById(ctx, group.Id)
require.NoError(t, err)
})

err = w.Secrets.PutAcl(ctx, secrets.PutAcl{
Scope: scope.Scope,
Expand Down

0 comments on commit c4dcc5a

Please sign in to comment.