From 3d302441b66aa696fdaf9c4924034767c2f9f7a5 Mon Sep 17 00:00:00 2001 From: Adrien Raffin-Caboisse Date: Mon, 25 Apr 2022 22:07:44 +0200 Subject: [PATCH] fix: order error in the tests --- machine.go | 1 + machine_test.go | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/machine.go b/machine.go index d23f61f4..fd63939b 100644 --- a/machine.go +++ b/machine.go @@ -670,6 +670,7 @@ func getTags( owners, err := expandTagOwners(aclPolicy, tag, stripEmailDomain) if errors.Is(err, errInvalidTag) { invalidTagMap[tag] = true + continue } var found bool for _, owner := range owners { diff --git a/machine_test.go b/machine_test.go index a72dfbf0..a1ddcff4 100644 --- a/machine_test.go +++ b/machine_test.go @@ -385,11 +385,17 @@ func Test_getTags(t *testing.T) { test.args.machine, test.args.stripEmailDomain, ) - if !reflect.DeepEqual(gotValid, test.wantValid) { - t.Errorf("getTags() = %v, want %v", gotValid, test.wantValid) + for _, valid := range gotValid { + if !contains(test.wantValid, valid) { + t.Errorf("valids: getTags() = %v, want %v", gotValid, test.wantValid) + break + } } - if !reflect.DeepEqual(gotInvalid, test.wantInvalid) { - t.Errorf("getTags() = %v, want %v", gotInvalid, test.wantInvalid) + for _, invalid := range gotInvalid { + if !contains(test.wantInvalid, invalid) { + t.Errorf("invalids: getTags() = %v, want %v", gotInvalid, test.wantInvalid) + break + } } }) }