Skip to content

Commit

Permalink
Reduce e2e test failure rate
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
awgreene committed Dec 21, 2020
1 parent e2b51e2 commit 0e94fad
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
34 changes: 24 additions & 10 deletions test/e2e/csv_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1306,28 +1306,42 @@ var _ = Describe("ClusterServiceVersion", func() {
Expect(err).ShouldNot(HaveOccurred(), "error getting expected APIService")

// Should create Service
_, err = c.GetService(testNamespace, serviceName)
Expect(err).ShouldNot(HaveOccurred(), "error getting expected Service")
Eventually(func() error {
_, err := c.GetService(testNamespace, serviceName)
return err
}, timeout, interval).ShouldNot(HaveOccurred())

// Should create certificate Secret
secretName = fmt.Sprintf("%s-cert", serviceName)
_, err = c.GetSecret(testNamespace, secretName)
Expect(err).ShouldNot(HaveOccurred(), "error getting expected Secret")
Eventually(func() error {
_, err = c.GetSecret(testNamespace, secretName)
return err
}, timeout, interval).ShouldNot(HaveOccurred())

// Should create a Role for the Secret
_, err = c.GetRole(testNamespace, secretName)
Expect(err).ShouldNot(HaveOccurred(), "error getting expected Secret Role")
Eventually(func() error {
_, err = c.GetRole(testNamespace, secretName)
return err
}, timeout, interval).ShouldNot(HaveOccurred())

// Should create a RoleBinding for the Secret
_, err = c.GetRoleBinding(testNamespace, secretName)
Expect(err).ShouldNot(HaveOccurred(), "error getting exptected Secret RoleBinding")
Eventually(func() error {
_, err = c.GetRoleBinding(testNamespace, secretName)
return err
}, timeout, interval).ShouldNot(HaveOccurred())

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

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

// Should eventually GC the CSV
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/installplan_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,12 @@ var _ = Describe("Install Plan", func() {

// Fetch installplan again to check for unnecessary control loops
fetchedInstallPlan, err = fetchInstallPlan(GinkgoT(), crc, fetchedInstallPlan.GetName(), func(fip *operatorsv1alpha1.InstallPlan) bool {
compareResources(GinkgoT(), fetchedInstallPlan, fip)
// Don't compare object meta as labels can be applied by the operator controller.
compareResources(GinkgoT(), fetchedInstallPlan.Spec, fip.Spec)
compareResources(GinkgoT(), fetchedInstallPlan.Status, fip.Status)
return true
})
require.NoError(GinkgoT(), err)

require.Equal(GinkgoT(), len(expectedStepSources), len(fetchedInstallPlan.Status.Plan), "Number of resolved steps matches the number of expected steps")

// Ensure resolved step resources originate from the correct catalog sources
Expand Down

0 comments on commit 0e94fad

Please sign in to comment.