@@ -22,6 +22,7 @@ import (
2222 "strings"
2323 "testing"
2424
25+ "github.com/rs/zerolog/log"
2526 "github.com/spf13/cobra"
2627 "github.com/stretchr/testify/assert"
2728)
@@ -185,23 +186,23 @@ func Test_StoreTypesCreateFromTemplatesCmd(t *testing.T) {
185186 assert .True (t , len (storeTypes ) >= 0 , "Expected non-empty list of store types" )
186187
187188 // iterate over the store types and verify that each has a name shortname and storetype
188- for sType := range storeTypes {
189- t .Log ("Creating store type: " + sType )
190- storeType := storeTypes [sType ].(map [string ]interface {})
191- assert .NotNil (t , storeType ["Name" ], "Expected store type to have a name" )
192- assert .NotNil (t , storeType ["ShortName" ], "Expected store type to have short name" )
193-
194- // verify short name is a string
195- _ , ok := storeType ["ShortName" ].(string )
196- assert .True (t , ok , "Expected short name to be a string" )
197- // verify name is a string
198- _ , ok = storeType ["Name" ].(string )
199- assert .True (t , ok , "Expected name to be a string" )
200-
201- // Attempt to create the store type
202- shortName := storeType ["ShortName" ].(string )
203- createStoreTypeTest (t , shortName , false )
204- }
189+ // for sType := range storeTypes {
190+ // t.Log("Creating store type: " + sType)
191+ // storeType := storeTypes[sType].(map[string]interface{})
192+ // assert.NotNil(t, storeType["Name"], "Expected store type to have a name")
193+ // assert.NotNil(t, storeType["ShortName"], "Expected store type to have short name")
194+ //
195+ // // verify short name is a string
196+ // _, ok := storeType["ShortName"].(string)
197+ // assert.True(t, ok, "Expected short name to be a string")
198+ // // verify name is a string
199+ // _, ok = storeType["Name"].(string)
200+ // assert.True(t, ok, "Expected name to be a string")
201+ //
202+ // // Attempt to create the store type
203+ // shortName := storeType["ShortName"].(string)
204+ // createStoreTypeTest(t, shortName, false)
205+ // }
205206 createAllStoreTypes (t , storeTypes )
206207}
207208
@@ -225,6 +226,7 @@ func testCreateStoreType(
225226 allowFail := false
226227 // Attempt to get the AWS store type because it comes with the product
227228 testCmd .SetArgs (testArgs )
229+ t .Log (fmt .Sprintf ("Test args: %s" , testArgs ))
228230 output := captureOutput (
229231 func () {
230232 err := testCmd .Execute ()
@@ -291,21 +293,32 @@ func testCreateStoreType(
291293}
292294
293295func createAllStoreTypes (t * testing.T , storeTypes map [string ]interface {}) {
294- t .Run (
295- fmt .Sprintf ("ONLINE Create ALL StoreTypes" ), func (t * testing.T ) {
296- testCmd := RootCmd
297- // check if I'm running inside a GitHub Action
298- testArgs := []string {"store-types" , "create" , "--all" }
299- testCreateStoreType (t , testCmd , testArgs , storeTypes )
300-
301- },
302- )
296+ // t.Run(
297+ // fmt.Sprintf("ONLINE Create ALL StoreTypes"), func(t *testing.T) {
298+ // testCmd := RootCmd
299+ // // check if I'm running inside a GitHub Action
300+ // testArgs := []string{"store-types", "create", "--all"}
301+ // testCreateStoreType(t, testCmd, testArgs, storeTypes)
302+ //
303+ // },
304+ // )
303305 t .Run (
304306 fmt .Sprintf ("OFFLINE Create ALL StoreTypes" ), func (t * testing.T ) {
305307 testCmd := RootCmd
306- // check if I'm running inside a GitHub Action
307308 testArgs := []string {"store-types" , "create" , "--all" , "--offline" }
308- testCreateStoreType (t , testCmd , testArgs , storeTypes )
309+
310+ var emStoreTypes []interface {}
311+ if err := json .Unmarshal (EmbeddedStoreTypesJSON , & emStoreTypes ); err != nil {
312+ log .Error ().Err (err ).Msg ("Unable to unmarshal embedded store type definitions" )
313+ t .FailNow ()
314+ }
315+ offlineStoreTypes , stErr := formatStoreTypes (& emStoreTypes )
316+ if stErr != nil {
317+ log .Error ().Err (stErr ).Msg ("Unable to format store types" )
318+ t .FailNow ()
319+ }
320+
321+ testCreateStoreType (t , testCmd , testArgs , offlineStoreTypes )
309322 },
310323 )
311324}
0 commit comments