Skip to content

Commit

Permalink
feat(tests): Allow undeleteable type tests to fail.
Browse files Browse the repository at this point in the history
chore(deps): Bump deps

Signed-off-by: spbsoluble <[email protected]>
  • Loading branch information
spbsoluble committed Sep 8, 2024
1 parent f5039a5 commit 30c6175
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions cmd/storeTypes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func createAllStoreTypes(t *testing.T, storeTypes map[string]interface{}) {
t.Log("GITHUB_REF: ", ghBranch)
}
t.Log("testArgs: ", testArgs)

allowFail := false
// Attempt to get the AWS store type because it comes with the product
testCmd.SetArgs(testArgs)
output := captureOutput(
Expand All @@ -239,12 +239,19 @@ func createAllStoreTypes(t *testing.T, storeTypes map[string]interface{}) {
return
}
t.Error("Emsg: ", eMsg)
if !allowFail {
assert.NoError(t, err)
}
}
if !allowFail {
assert.NoError(t, err)
}
assert.NoError(t, err)
},
)
assert.NotNil(t, output, "No output returned from create all command")

if !allowFail {
assert.NotNil(t, output, "No output returned from create all command")
}

// iterate over the store types and verify that each has a name shortname and storetype
for sType := range storeTypes {
Expand All @@ -261,20 +268,23 @@ func createAllStoreTypes(t *testing.T, storeTypes map[string]interface{}) {

// Attempt to create the store type
shortName := storeType["ShortName"].(string)
allowStoreTypeFail := false
if checkIsUnDeleteable(shortName) {
t.Skip("Not processing un-deletable store-type: ", shortName)
return
t.Logf("WARNING: Skipping check for un-deletable store-type: %s", shortName)
allowStoreTypeFail = true
}

assert.Contains(
t,
output,
fmt.Sprintf("Certificate store type %s created with ID", shortName),
"Expected output to contain store type created message",
)
if !allowStoreTypeFail {
assert.Contains(
t,
output,
fmt.Sprintf("Certificate store type %s created with ID", shortName),
"Expected output to contain store type created message",
)
}

// Delete again after create
deleteStoreTypeTest(t, shortName, true)
deleteStoreTypeTest(t, shortName, allowStoreTypeFail)
}
},
)
Expand Down

0 comments on commit 30c6175

Please sign in to comment.