From 9326dd1383d75ac6cbdb4aeb7956418dbf071640 Mon Sep 17 00:00:00 2001 From: Jaydip Gabani Date: Tue, 29 Oct 2024 23:50:46 +0000 Subject: [PATCH] fixing tests Signed-off-by: Jaydip Gabani --- .../constrainttemplate_controller_test.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/pkg/controller/constrainttemplate/constrainttemplate_controller_test.go b/pkg/controller/constrainttemplate/constrainttemplate_controller_test.go index 11bc7f3cdd5..90e4f1c3486 100644 --- a/pkg/controller/constrainttemplate/constrainttemplate_controller_test.go +++ b/pkg/controller/constrainttemplate/constrainttemplate_controller_test.go @@ -679,16 +679,11 @@ func TestReconcile(t *testing.T) { if vapBindingCreationTime.Before(blockTime) { return fmt.Errorf("VAPBinding should be created after default wait") } - err = retry.OnError(testutils.ConstantRetry, func(_ error) bool { - return true - }, func() error { - return c.Delete(ctx, vapBinding) - }) - if err != nil { - logger.Error(err, "delete vapBinding") - t.Fatal(err) + + if err := c.Delete(ctx, cstr); err != nil { + return err } - return nil + return c.Delete(ctx, vapBinding) }) if err != nil { t.Fatal(err) @@ -815,7 +810,7 @@ func TestReconcile(t *testing.T) { } vapBindingCreationTime := vapBinding.GetCreationTimestamp().Time if vapBindingCreationTime.Before(blockTime) { - t.Fatal("VAPBinding should not be created before the timestamp") + return fmt.Errorf("VAPBinding should not be created before the timestamp") } return nil })