From 20b558656d7d369e8317a3ce1dd20709ddc53638 Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Thu, 9 May 2019 14:56:38 +0100 Subject: [PATCH] katatestutils: Reset TestConstraints fields on NotValid() call `TestConstraint.NotValid()` is really designed to be called once per test. However, there is no reason it should not be possible to call multiple times. But to allow for that secenario, any settings from a previous `NotValid()` call need to be cleared. Signed-off-by: James O. D. Hunt --- pkg/katatestutils/constraints_api.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/katatestutils/constraints_api.go b/pkg/katatestutils/constraints_api.go index 19c4005fc7..d135a06f4e 100644 --- a/pkg/katatestutils/constraints_api.go +++ b/pkg/katatestutils/constraints_api.go @@ -112,6 +112,11 @@ func (tc *TestConstraint) NotValid(constraints ...Constraint) bool { panic("need atleast one constraint") } + // Reset in case of a previous call + tc.Passed = nil + tc.Failed = nil + tc.Issue = "" + for _, c := range constraints { invalid := tc.constraintInvalid(c) if invalid {