fix: order error in the tests

This commit is contained in:
Adrien Raffin-Caboisse 2022-04-25 22:07:44 +02:00
parent 8061abe279
commit 3d302441b6
2 changed files with 11 additions and 4 deletions

View File

@ -670,6 +670,7 @@ func getTags(
owners, err := expandTagOwners(aclPolicy, tag, stripEmailDomain) owners, err := expandTagOwners(aclPolicy, tag, stripEmailDomain)
if errors.Is(err, errInvalidTag) { if errors.Is(err, errInvalidTag) {
invalidTagMap[tag] = true invalidTagMap[tag] = true
continue
} }
var found bool var found bool
for _, owner := range owners { for _, owner := range owners {

View File

@ -385,11 +385,17 @@ func Test_getTags(t *testing.T) {
test.args.machine, test.args.machine,
test.args.stripEmailDomain, test.args.stripEmailDomain,
) )
if !reflect.DeepEqual(gotValid, test.wantValid) { for _, valid := range gotValid {
t.Errorf("getTags() = %v, want %v", gotValid, test.wantValid) if !contains(test.wantValid, valid) {
t.Errorf("valids: getTags() = %v, want %v", gotValid, test.wantValid)
break
}
}
for _, invalid := range gotInvalid {
if !contains(test.wantInvalid, invalid) {
t.Errorf("invalids: getTags() = %v, want %v", gotInvalid, test.wantInvalid)
break
} }
if !reflect.DeepEqual(gotInvalid, test.wantInvalid) {
t.Errorf("getTags() = %v, want %v", gotInvalid, test.wantInvalid)
} }
}) })
} }