Skip to content

Commit 0e94fad

Browse files
committed
Reduce e2e test failure rate
This commit introduces two changes: 1. It reduces the failure rate of the CSV e2e test by allowing the operator to reach a succeeded install before searching for resources. 2. An installplan e2e test was failing a diff check against two installplans because the operator controller was applying a component label to one of the installplans. An update was made to still compare the spec and status of the two installplans but ignores other fields.
1 parent e2b51e2 commit 0e94fad

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

test/e2e/csv_e2e_test.go

+24-10
Original file line numberDiff line numberDiff line change
@@ -1306,28 +1306,42 @@ var _ = Describe("ClusterServiceVersion", func() {
13061306
Expect(err).ShouldNot(HaveOccurred(), "error getting expected APIService")
13071307

13081308
// Should create Service
1309-
_, err = c.GetService(testNamespace, serviceName)
1310-
Expect(err).ShouldNot(HaveOccurred(), "error getting expected Service")
1309+
Eventually(func() error {
1310+
_, err := c.GetService(testNamespace, serviceName)
1311+
return err
1312+
}, timeout, interval).ShouldNot(HaveOccurred())
13111313

13121314
// Should create certificate Secret
13131315
secretName = fmt.Sprintf("%s-cert", serviceName)
1314-
_, err = c.GetSecret(testNamespace, secretName)
1315-
Expect(err).ShouldNot(HaveOccurred(), "error getting expected Secret")
1316+
Eventually(func() error {
1317+
_, err = c.GetSecret(testNamespace, secretName)
1318+
return err
1319+
}, timeout, interval).ShouldNot(HaveOccurred())
13161320

13171321
// Should create a Role for the Secret
13181322
_, err = c.GetRole(testNamespace, secretName)
1319-
Expect(err).ShouldNot(HaveOccurred(), "error getting expected Secret Role")
1323+
Eventually(func() error {
1324+
_, err = c.GetRole(testNamespace, secretName)
1325+
return err
1326+
}, timeout, interval).ShouldNot(HaveOccurred())
13201327

13211328
// Should create a RoleBinding for the Secret
1322-
_, err = c.GetRoleBinding(testNamespace, secretName)
1323-
Expect(err).ShouldNot(HaveOccurred(), "error getting exptected Secret RoleBinding")
1329+
Eventually(func() error {
1330+
_, err = c.GetRoleBinding(testNamespace, secretName)
1331+
return err
1332+
}, timeout, interval).ShouldNot(HaveOccurred())
13241333

13251334
// Should create a system:auth-delegator Cluster RoleBinding
1326-
_, err = c.GetClusterRoleBinding(fmt.Sprintf("%s-system:auth-delegator", serviceName))
1327-
Expect(err).ShouldNot(HaveOccurred(), "error getting expected system:auth-delegator ClusterRoleBinding")
1335+
Eventually(func() error {
1336+
_, err = c.GetClusterRoleBinding(fmt.Sprintf("%s-system:auth-delegator", serviceName))
1337+
return err
1338+
}, timeout, interval).ShouldNot(HaveOccurred())
13281339

13291340
// Should create an extension-apiserver-authentication-reader RoleBinding in kube-system
1330-
_, err = c.GetRoleBinding("kube-system", fmt.Sprintf("%s-auth-reader", serviceName))
1341+
Eventually(func() error {
1342+
_, err = c.GetRoleBinding("kube-system", fmt.Sprintf("%s-auth-reader", serviceName))
1343+
return err
1344+
}, timeout, interval).ShouldNot(HaveOccurred())
13311345
Expect(err).ShouldNot(HaveOccurred(), "error getting expected extension-apiserver-authentication-reader RoleBinding")
13321346

13331347
// Should eventually GC the CSV

test/e2e/installplan_e2e_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,12 @@ var _ = Describe("Install Plan", func() {
222222

223223
// Fetch installplan again to check for unnecessary control loops
224224
fetchedInstallPlan, err = fetchInstallPlan(GinkgoT(), crc, fetchedInstallPlan.GetName(), func(fip *operatorsv1alpha1.InstallPlan) bool {
225-
compareResources(GinkgoT(), fetchedInstallPlan, fip)
225+
// Don't compare object meta as labels can be applied by the operator controller.
226+
compareResources(GinkgoT(), fetchedInstallPlan.Spec, fip.Spec)
227+
compareResources(GinkgoT(), fetchedInstallPlan.Status, fip.Status)
226228
return true
227229
})
228230
require.NoError(GinkgoT(), err)
229-
230231
require.Equal(GinkgoT(), len(expectedStepSources), len(fetchedInstallPlan.Status.Plan), "Number of resolved steps matches the number of expected steps")
231232

232233
// Ensure resolved step resources originate from the correct catalog sources

0 commit comments

Comments
 (0)