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

Replace assertions in Catalog-e2e to use Gomega's Matcher library #1502

Merged

Conversation

harishsurf
Copy link
Contributor

Description of the change:
This PR replaces testify/require assertions with Gomega's assertions. This PR will be followed up with another PR that uses ginkgo's Container blocks to ensure BDD style structuring

Motivation for the change:

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 /docs
  • Commit messages sensible and descriptive

@harishsurf harishsurf changed the title Replace assertions to use Gomega's Matcher library Replace assertions in Catalog-e2e to use Gomega's Matcher library May 7, 2020
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 14, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 21, 2020
test/e2e/catalog_e2e_test.go Outdated Show resolved Hide resolved
test/e2e/catalog_e2e_test.go Outdated Show resolved Hide resolved
test/e2e/catalog_e2e_test.go Outdated Show resolved Hide resolved
test/e2e/e2e_test.go Outdated Show resolved Hide resolved
test/e2e/catalog_e2e_test.go Outdated Show resolved Hide resolved
test/e2e/catalog_e2e_test.go Outdated Show resolved Hide resolved
@harishsurf harishsurf force-pushed the catalog-e2e branch 2 times, most recently from 8d5c0b2 to dd6bc94 Compare June 4, 2020 20:08
@harishsurf
Copy link
Contributor Author

/retest

Copy link
Member

@Bowenislandsong Bowenislandsong left a comment

Choose a reason for hiding this comment

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

small nit, not a necessary change. /lgtm

test/e2e/catalog_e2e_test.go Outdated Show resolved Hide resolved
@harishsurf
Copy link
Contributor Author

/retest

test/e2e/catalog_e2e_test.go Outdated Show resolved Hide resolved
test/e2e/catalog_e2e_test.go Outdated Show resolved Hide resolved
test/e2e/catalog_e2e_test.go Outdated Show resolved Hide resolved
@harishsurf
Copy link
Contributor Author

/test e2e-aws-olm

@harishsurf
Copy link
Contributor Author

/retest

Copy link
Contributor

@benluddy benluddy left a comment

Choose a reason for hiding this comment

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

/approve


// Ensure the timing
catalogConnState := fetchedUpdatedCatalog.Status.GRPCConnectionState
subUpdatedTime := subscription.Status.LastUpdated
timeLapse := subUpdatedTime.Sub(catalogConnState.LastConnectTime.Time).Seconds()
require.True(GinkgoT(), timeLapse < 60)
Expect(timeLapse).Should(BeNumerically("<", 60))
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking nit: There's a built-in Gomega matcher for time.Time: https://pkg.go.dev/github.com/onsi/gomega?tab=doc#BeTemporally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But, I don't see if it could be used here since we are asserting that the var timeLapse has a value < 60. BeTemporarily expects 60 to be of type time.Time{}

Copy link
Member

Choose a reason for hiding this comment

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

I think Ben is suggesting something like Expect(catalogConnState.LastConnectTime.Time).Should(BeTemporally("<", subUpdatedTime.Add(60 * time.Second) @harishsurf

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed it to:
Expect(subUpdatedTime.Time).Should(BeTemporally("<", catalogConnState.LastConnectTime.Add(60*time.Second)))

if err != nil {
return err
}
Eventually(waitForScaleup, 5*time.Minute, 1*time.Second).Should(BeTrue())
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't 5 minutes and 1 second the defaults?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default timeout is 1min

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: benluddy, harishsurf

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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 21, 2020
@harishsurf
Copy link
Contributor Author

/retest

2 similar comments
@harishsurf
Copy link
Contributor Author

/retest

@harishsurf
Copy link
Contributor Author

/retest

@exdx exdx self-assigned this Aug 31, 2020
@openshift-ci-robot
Copy link
Collaborator

@harishsurf: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-upgrade dcf9d6d link /test e2e-upgrade

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@harishsurf
Copy link
Contributor Author

/test e2e-upgrade

@of-deploy-bot
Copy link

This PR failed 1 out of 1 times with 4 individual failed tests and 4 skipped tests. A test is considered flaky if failed on multiple commits.

totaltestcount: 1
failedtestcount: 1
flaketestcount: 4
skippedtestcount: 4
flaketests:

  • classname: End-to-end
    name: 'Subscription creation using existing CSV'
    counts: 3
    details:
    • count: 3
      error: |4-

      /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/subscription_e2e_test.go:90
      
      	Error Trace:	subscription_e2e_test.go:97
      	            				runner.go:113
      	            				runner.go:64
      	            				it_node.go:26
      	            				spec.go:215
      	            				spec.go:138
      	            				spec_runner.go:200
      	            				spec_runner.go:170
      	            				spec_runner.go:66
      	            				suite.go:62
      	            				ginkgo_dsl.go:226
      	            				ginkgo_dsl.go:214
      	            				e2e_test.go:54
      	Error:      	Received unexpected error:
      	            	E2E bug detected: configmaps "mock-ocs" already exists
      
      /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/vendor/github.com/stretchr/testify/require/require.go:1005
      
    meandurationsec: 0.03929166666666666
  • classname: End-to-end
    name: 'Install Plan with CRD schema change Test existing version is present
    in new CRD (deprecated field)
    '
    counts: 1
    details:
    • count: 1
      error: "\n\n/home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/vendor/github.com/onsi/ginkgo/extensions/table/table_entry.go:43\n\n\tError
      Trace:\tinstallplan_e2e_test.go:769\n\t \t\t\t\tvalue.go:460\n\t
      \ \t\t\t\tvalue.go:321\n\t \t\t\t\ttable_entry.go:37\n\t
      \ \t\t\t\trunner.go:113\n\t \t\t\t\trunner.go:64\n\t
      \ \t\t\t\tit_node.go:26\n\t \t\t\t\tspec.go:215\n\t
      \ \t\t\t\tspec.go:138\n\t \t\t\t\tspec_runner.go:200\n\t
      \ \t\t\t\tspec_runner.go:170\n\t \t\t\t\tspec_runner.go:66\n\t
      \ \t\t\t\tsuite.go:62\n\t \t\t\t\tginkgo_dsl.go:226\n\t
      \ \t\t\t\tginkgo_dsl.go:214\n\t \t\t\t\te2e_test.go:54\n\tError:
      \ \tNot equal: \n\t \texpected: "Complete"\n\t \tactual
      \ : "Failed"\n\t \t\n\t \tDiff:\n\t \t---
      Expected\n\t \t+++ Actual\n\t \t@@ -1,2 +1,2 @@\n\t
      \ \t-(v1alpha1.InstallPlanPhase) (len=8) "Complete"\n\t \t+(v1alpha1.InstallPlanPhase)
      (len=6) "Failed"\n\t \t \n\n/home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/vendor/github.com/stretchr/testify/require/require.go:162"
      meandurationsec: 22.057747
  • classname: End-to-end
    name: 'Operator when a subscription to a package exists should automatically
    adopt components
    '
    counts: 1
    details:
    • count: 1
      error: |4-

      /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_test.go:209
      Timed out after 60.000s.
      Expected
          <v1alpha1.SubscriptionState>: UpgradePending
      to be equivalent to
          <string>: AtLatestKnown
      /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_test.go:259
      
    meandurationsec: 60.324765
  • classname: End-to-end
    name: 'Installing bundles with new object types when a bundle with a pdb, priorityclass,
    and VPA object is installed should create the additional bundle objects
    '
    counts: 1
    details:
    • count: 1
      error: |4-

      /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/bundle_e2e_test.go:124
      Timed out after 60.000s.
      expected no error getting pdb object associated with CSV
      Expected success, but got an error:
          <*errors.StatusError | 0xc000b95b80>: {
              ErrStatus: {
                  TypeMeta: {Kind: "", APIVersion: ""},
                  ListMeta: {
                      SelfLink: "",
                      ResourceVersion: "",
                      Continue: "",
                      RemainingItemCount: nil,
                  },
                  Status: "Failure",
                  Message: "poddisruptionbudgets.policy \"busybox-pdb\" not found",
                  Reason: "NotFound",
                  Details: {
                      Name: "busybox-pdb",
                      Group: "policy",
                      Kind: "poddisruptionbudgets",
                      UID: "",
                      Causes: nil,
                      RetryAfterSeconds: 0,
                  },
                  Code: 404,
              },
          }
          poddisruptionbudgets.policy "busybox-pdb" not found
      /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/bundle_e2e_test.go:144
      
    meandurationsec: 77.473194
    skippedtests:
  • classname: End-to-end
    name: 'Subscriptions create required objects from Catalogs Given a Namespace
    when a CatalogSource is created with a bundle that contains prometheus objects
    creating a subscription using the CatalogSource should install the operator
    successfully
    '
    counts: 1
    details: []
    meandurationsec: 15.100081
  • classname: End-to-end
    name: 'Subscription updates existing install plan'
    counts: 1
    details: []
    meandurationsec: 0.705988
  • classname: End-to-end
    name: 'Catalog represents a store of bundles which OLM can use to install Operators
    image update
    '
    counts: 1
    details: []
    meandurationsec: 0.295481
  • classname: End-to-end
    name: 'Subscriptions create required objects from Catalogs Given a Namespace
    when a CatalogSource is created with a bundle that contains prometheus objects
    creating a subscription using the CatalogSource should have created the expected
    prometheus objects
    '
    counts: 1
    details: []
    meandurationsec: 15.286522

@exdx
Copy link
Member

exdx commented Oct 28, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 28, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 8e5ad4d into operator-framework:master Oct 28, 2020
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.

8 participants