Skip to content

Commit 181ed76

Browse files
committed
pkg/controller: Update subscription test fixture and avoid setting status at creation time
Update the adoption controller test subscription fixture and remove the status sub-resource block that's shared between tests. When an object is created, it's status sub-resource is now removed, so changes are centered around setting this resource before firing off any Update calls used throughout this test package. Signed-off-by: timflannagan <[email protected]>
1 parent ab87bd4 commit 181ed76

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

pkg/controller/operators/adoption_controller_test.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ var _ = Describe("Adoption Controller", func() {
8080
Spec: &operatorsv1alpha1.SubscriptionSpec{
8181
Package: "poultry",
8282
},
83-
Status: operatorsv1alpha1.SubscriptionStatus{
84-
InstalledCSV: "turkey",
85-
LastUpdated: metav1.Now(),
86-
},
8783
}
8884
sub.SetNamespace(ns.GetName())
8985
sub.SetName(sub.Spec.Package)
@@ -94,13 +90,14 @@ var _ = Describe("Adoption Controller", func() {
9490
created = append(created, sub)
9591

9692
// Set the Subscription's status separately
97-
status := sub.DeepCopy().Status
9893
Eventually(func() error {
9994
if err := k8sClient.Get(ctx, testobj.NamespacedName(sub), sub); err != nil {
10095
return err
10196
}
102-
sub.Status = status
103-
97+
sub.Status = operatorsv1alpha1.SubscriptionStatus{
98+
InstalledCSV: "turkey",
99+
LastUpdated: metav1.Now(),
100+
}
104101
return k8sClient.Status().Update(ctx, sub)
105102
}, timeout, interval).Should(Succeed())
106103

0 commit comments

Comments
 (0)