Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve catalog source e2e #2738

Merged

Conversation

perdasilva
Copy link
Collaborator

Signed-off-by: Per Goncalves da Silva [email protected]

Description of the change:
This PR wraps Update calls in an Eventually block (together with the preceding Get call) to make it more resilient to conflicts.

Motivation for the change:
There was a downstream CI failure: [link]

 Starting CatalogSource e2e tests
/go/src/github.com/openshift/operator-framework-olm/staging/operator-lifecycle-manager/test/e2e/catalog_e2e_test.go:45
  when A catalogSource is created with incorrect polling interval
  /go/src/github.com/openshift/operator-framework-olm/staging/operator-lifecycle-manager/test/e2e/catalog_e2e_test.go:1149
    when the catalogsource is updated with a valid polling interval
    /go/src/github.com/openshift/operator-framework-olm/staging/operator-lifecycle-manager/test/e2e/catalog_e2e_test.go:1202
      the catalogsource spec shows the updated polling interval, and the error message in the status is cleared [BeforeEach]
      /go/src/github.com/openshift/operator-framework-olm/staging/operator-lifecycle-manager/test/e2e/catalog_e2e_test.go:1210
      Unexpected error:
              
          <*errors.StatusError | 0xc000eb6a00>: {
              ErrStatus: {
                  TypeMeta: {Kind: "", APIVersion: ""},
                  ListMeta: {
                      SelfLink: "",
                      ResourceVersion: "",
                      Continue: "",
                      RemainingItemCount: nil,
                  },
                  Status: "Failure",
                  Message: "Operation cannot be fulfilled on catalogsources.operators.coreos.com \"catalog-fmksj\": the object has been modified; please apply your changes to the latest version and try again",
                  Reason: "Conflict",
                  Details: {
                      Name: "catalog-fmksj",
                      Group: "operators.coreos.com",
                      Kind: "catalogsources",
                      UID: "",
                      Causes: nil,
                      RetryAfterSeconds: 0,
                  },
                  Code: 409,
              },
          }
          Operation cannot be fulfilled on catalogsources.operators.coreos.com "catalog-fmksj": the object has been modified; please apply your changes to the latest version and try again
      occurred
      /go/src/github.com/openshift/operator-framework-olm/staging/operator-lifecycle-manager/test/e2e/catalog_e2e_test.go:1208
      Full Stack Trace
      github.com/operator-framework/operator-lifecycle-manager/test/e2e.glob..func3.13.4.1()
      	/go/src/github.com/openshift/operator-framework-olm/staging/operator-lifecycle-manager/test/e2e/catalog_e2e_test.go:1208 +0x394
      github.com/operator-framework/operator-lifecycle-manager/test/e2e.TestEndToEnd(0x0)
      	/go/src/github.com/openshift/operator-framework-olm/staging/operator-lifecycle-manager/test/e2e/e2e_test.go:74 +0x3ce
      testing.tRunner(0xc000182b60, 0x3075768)
      	/usr/lib/golang/src/testing/testing.go:1259 +0x230
      created by testing.(*T).Run
      	/usr/lib/golang/src/testing/testing.go:1306 +0x727 

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /doc
  • Commit messages sensible and descriptive
  • Tests marked as [FLAKE] are truly flaky
  • Tests that remove the [FLAKE] tag are no longer flaky

@openshift-ci openshift-ci bot requested review from dinhxuanvu and njhale April 13, 2022 15:37
@openshift-ci
Copy link

openshift-ci bot commented Apr 13, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: perdasilva

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 13, 2022
return err
}

source.Annotations["testKey"] = "newValue"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: nil check source.Annotations?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. source.Annotations = make(map[string]string)

return err
}

source.Annotations["testKey"] = genName("newValue")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: nil check source.Annotations?

return err
}
catsrc.Spec.UpdateStrategy.RegistryPoll.RawInterval = correctInterval
_, err = crc.OperatorsV1alpha1().CatalogSources(catsrc.GetNamespace()).Update(context.TODO(), catsrc, metav1.UpdateOptions{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supernit as this was an issue before this PR: context.Background()

Comment on lines 941 to 942
if source == nil {
return errors.New("could not get catalog source")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I had in mind was source.Annotations = make(map[string]string) but I won't hold up this PR as it fixes a real deflating style of e2e flake.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. I'm an idiot. I've fixed it ^^ thanks dude!

Signed-off-by: Per Goncalves da Silva <[email protected]>
@timflannagan
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 13, 2022
@openshift-merge-robot openshift-merge-robot merged commit 8abe078 into operator-framework:master Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants