Skip to content

Commit

Permalink
fix(tests): store-types create --all will use branch store-types.js…
Browse files Browse the repository at this point in the history
…on for accurate testing.
  • Loading branch information
spbsoluble committed Oct 20, 2023
1 parent 3828c82 commit eacc0ef
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/storeTypes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"encoding/json"
"fmt"
"github.com/stretchr/testify/assert"
"os"
"strings"
"testing"
)
Expand Down Expand Up @@ -212,8 +213,16 @@ func Test_StoreTypesCreateFromTemplatesCmd(t *testing.T) {
func createAllStoreTypes(t *testing.T, storeTypes map[string]interface{}) {
t.Run(fmt.Sprintf("Create ALL StoreTypes"), func(t *testing.T) {
testCmd := RootCmd
// check if I'm running inside a Github Action
testArgs := []string{"store-types", "create", "--all"}
isGhAction := os.Getenv("GITHUB_ACTIONS")
if isGhAction == "true" {
ghBranch := os.Getenv("GITHUB_REF")
testArgs = append(testArgs, "--git-ref", ghBranch)
}

// Attempt to get the AWS store type because it comes with the product
testCmd.SetArgs([]string{"store-types", "create", "--all"})
testCmd.SetArgs(testArgs)
output := captureOutput(func() {
err := testCmd.Execute()
assert.NoError(t, err)
Expand Down

0 comments on commit eacc0ef

Please sign in to comment.