From 16690b3fb57fe825ea75385e486af9f7ea31ac55 Mon Sep 17 00:00:00 2001 From: Sunny Date: Fri, 1 Oct 2021 22:52:18 +0530 Subject: [PATCH] Update tests to be compatible with CR > v0.10.0 Also updates the tests to be compatible with the breaking changes in controller-runtime > v0.10.0. Cherry-picked from 467d97a9bf957a4951a090297131c11db463d9ad. Signed-off-by: Sunny --- controllers/update_test.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/controllers/update_test.go b/controllers/update_test.go index b56b625..9be17ef 100644 --- a/controllers/update_test.go +++ b/controllers/update_test.go @@ -206,11 +206,9 @@ Images: }, }, }, - Status: imagev1_reflect.ImagePolicyStatus{ - LatestImage: "helloworld:v1.0.0", - }, } Expect(k8sClient.Create(context.Background(), policy)).To(Succeed()) + policy.Status.LatestImage = "helloworld:v1.0.0" Expect(k8sClient.Status().Update(context.Background(), policy)).To(Succeed()) // Format the expected message given the generated values @@ -346,11 +344,9 @@ Images: }, }, }, - Status: imagev1_reflect.ImagePolicyStatus{ - LatestImage: "helloworld:v1.0.0", - }, } Expect(k8sClient.Create(context.Background(), policy)).To(Succeed()) + policy.Status.LatestImage = "helloworld:v1.0.0" Expect(k8sClient.Status().Update(context.Background(), policy)).To(Succeed()) // Insert a setter reference into the deployment file, @@ -475,11 +471,9 @@ Images: }, }, }, - Status: imagev1_reflect.ImagePolicyStatus{ - LatestImage: "helloworld:v1.0.0", - }, } Expect(k8sClient.Create(context.Background(), policy)).To(Succeed()) + policy.Status.LatestImage = "helloworld:v1.0.0" Expect(k8sClient.Status().Update(context.Background(), policy)).To(Succeed()) // Insert a setter reference into the deployment file, @@ -696,11 +690,9 @@ Images: }, }, }, - Status: imagev1_reflect.ImagePolicyStatus{ - LatestImage: latestImage, - }, } Expect(k8sClient.Create(context.Background(), policy)).To(Succeed()) + policy.Status.LatestImage = latestImage Expect(k8sClient.Status().Update(context.Background(), policy)).To(Succeed()) })