diff --git a/integ/workflow/common/dummy_t.go b/integ/workflow/common/dummy_t.go new file mode 100644 index 00000000..f842e121 --- /dev/null +++ b/integ/workflow/common/dummy_t.go @@ -0,0 +1,6 @@ +package common + +// DummyT uses assert.ElementsMatch for comparing slices, but with a bool result. +type DummyT struct{} + +func (t DummyT) Errorf(string, ...interface{}) {} diff --git a/integ/workflow/persistence_loading_policy/routers.go b/integ/workflow/persistence_loading_policy/routers.go index d3a8f110..f834a36e 100644 --- a/integ/workflow/persistence_loading_policy/routers.go +++ b/integ/workflow/persistence_loading_policy/routers.go @@ -7,6 +7,7 @@ import ( "github.com/indeedeng/iwf/integ/workflow/persistence" "github.com/indeedeng/iwf/service" "github.com/indeedeng/iwf/service/common/ptr" + "github.com/stretchr/testify/assert" "log" "net/http" "reflect" @@ -223,7 +224,9 @@ func verifyLoadedAttributes( expectedDataAttributes = []iwfidl.KeyValue{} } - if !reflect.DeepEqual(expectedSearchAttributes, searchAttributes) { + // use ElementsMatch so that the order won't be a problem. + // Internally the SAs are stored as a map and as a result, Golang return it without ordering guarantee + if !assert.ElementsMatch(common.DummyT{}, expectedSearchAttributes, searchAttributes) { panic("Search attributes should be the same") }