Skip to content

Commit 5b00475

Browse files
committed
Harden token e2e cleanup
1 parent f73886c commit 5b00475

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

e2e/cli_tests/token_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"strconv"
55
"testing"
66
"time"
7+
8+
"github.com/basecamp/fizzy-cli/e2e/harness"
79
)
810

911
func TestAccessTokenCRUD(t *testing.T) {
@@ -18,8 +20,16 @@ func TestAccessTokenCRUD(t *testing.T) {
1820
}
1921
deleted := false
2022
t.Cleanup(func() {
21-
if !deleted {
22-
newHarness(t).Run("token", "delete", tokenID)
23+
if deleted {
24+
return
25+
}
26+
cleanupDelete := newHarness(t).Run("token", "delete", tokenID)
27+
if cleanupDelete.ExitCode != harness.ExitSuccess {
28+
t.Errorf("cleanup failed deleting token %q: exit=%d stdout=%s stderr=%s", tokenID, cleanupDelete.ExitCode, cleanupDelete.Stdout, cleanupDelete.Stderr)
29+
return
30+
}
31+
if !cleanupDelete.GetDataBool("deleted") {
32+
t.Errorf("cleanup delete for token %q did not report deleted=true", tokenID)
2333
}
2434
})
2535
if create.GetDataString("token") == "" {

0 commit comments

Comments
 (0)