From fe85b0d0797bcdafa08875940b2804e3d805c6c9 Mon Sep 17 00:00:00 2001 From: Pierre HILBERT Date: Tue, 19 Sep 2023 09:22:14 +0200 Subject: [PATCH] Fix test scenarios --- .../upgrade/artifact/download/composed/verifier_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/pkg/agent/application/upgrade/artifact/download/composed/verifier_test.go b/internal/pkg/agent/application/upgrade/artifact/download/composed/verifier_test.go index c514f446826..608a3ca4e2a 100644 --- a/internal/pkg/agent/application/upgrade/artifact/download/composed/verifier_test.go +++ b/internal/pkg/agent/application/upgrade/artifact/download/composed/verifier_test.go @@ -53,22 +53,27 @@ func TestVerifier(t *testing.T) { verifiers: []CheckableVerifier{&ErrorVerifier{}, &SuccVerifier{}, &FailVerifier{}}, checkFunc: func(d []CheckableVerifier) bool { return d[0].Called() && d[1].Called() && !d[2].Called() }, expectedResult: true, + expectedErrors: true, }, { verifiers: []CheckableVerifier{&SuccVerifier{}, &ErrorVerifier{}, &FailVerifier{}}, checkFunc: func(d []CheckableVerifier) bool { return d[0].Called() && !d[1].Called() && !d[2].Called() }, expectedResult: true, + expectedErrors: false, }, { verifiers: []CheckableVerifier{&FailVerifier{}, &ErrorVerifier{}, &SuccVerifier{}}, checkFunc: func(d []CheckableVerifier) bool { return d[0].Called() && d[1].Called() && d[2].Called() }, expectedResult: true, + expectedErrors: true, }, { verifiers: []CheckableVerifier{&ErrorVerifier{}, &FailVerifier{}, &SuccVerifier{}}, checkFunc: func(d []CheckableVerifier) bool { return d[0].Called() && d[1].Called() && d[2].Called() }, expectedResult: true, + expectedErrors: true, }, { verifiers: []CheckableVerifier{&ErrorVerifier{}, &ErrorVerifier{}, &FailVerifier{}}, checkFunc: func(d []CheckableVerifier) bool { return d[0].Called() && d[1].Called() && d[2].Called() }, expectedResult: false, + expectedErrors: true, }, } @@ -77,7 +82,7 @@ func TestVerifier(t *testing.T) { success, err := d.Verify(artifact.Artifact{Name: "a", Cmd: "a", Artifact: "a/a"}, "b", false) assert.Equal(t, tc.expectedResult, success == true) - assert.Equal(t, tc.expectedResult, err == nil) + assert.Equal(t, tc.expectedErrors, err != nil) assert.True(t, tc.checkFunc(tc.verifiers)) } @@ -92,4 +97,5 @@ type verifyTestCase struct { verifiers []CheckableVerifier checkFunc func(verifiers []CheckableVerifier) bool expectedResult bool + expectedErrors bool }