You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What would you like to be added:
in the status if we need to validate and assert if some of the items exist in slice. there is no way to validate that. currently assert expects all the items in slice to be provided. example test step fails with "slice length mismatch: 1!= 8"
code kuttl/pkg/test/utils/subset.go
linenumber : 50
function where the change is needed: IsSubset(expected, actual interface{}) error
if reflect.TypeOf(expected).Kind() == reflect.Slice { if reflect.ValueOf(expected).Len() != reflect.ValueOf(actual).Len() { return &SubsetError{ message: fmt.Sprintf("slice length mismatch: %d != %d", reflect.ValueOf(expected).Len(), reflect.ValueOf(actual).Len()), } } for i := 0; i < reflect.ValueOf(expected).Len(); i++ { if err := IsSubset(reflect.ValueOf(expected).Index(i).Interface(), reflect.ValueOf(actual).Index(i).Interface()); err != nil { return err } } }
Why is this needed:
we need a way to assert only given item in the slice . it should not expect all the items in the list. just like we assert fields in status now
The text was updated successfully, but these errors were encountered:
What would you like to be added:
in the status if we need to validate and assert if some of the items exist in slice. there is no way to validate that. currently assert expects all the items in slice to be provided. example test step fails with "slice length mismatch: 1!= 8"
code kuttl/pkg/test/utils/subset.go
linenumber : 50
function where the change is needed: IsSubset(expected, actual interface{}) error
if reflect.TypeOf(expected).Kind() == reflect.Slice { if reflect.ValueOf(expected).Len() != reflect.ValueOf(actual).Len() { return &SubsetError{ message: fmt.Sprintf("slice length mismatch: %d != %d", reflect.ValueOf(expected).Len(), reflect.ValueOf(actual).Len()), } } for i := 0; i < reflect.ValueOf(expected).Len(); i++ { if err := IsSubset(reflect.ValueOf(expected).Index(i).Interface(), reflect.ValueOf(actual).Index(i).Interface()); err != nil { return err } } }
Why is this needed:
we need a way to assert only given item in the slice . it should not expect all the items in the list. just like we assert fields in status now
The text was updated successfully, but these errors were encountered: