Skip to content

Modify dynamic_resource_e2e_test to ginkgo #1424

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

Merged

Conversation

harishsurf
Copy link
Contributor

Description of the change:
This change adds more structure to the tests by leveraging ginkgo's container/It blocks. The changes also cleans up some of the functions in util_test.go. I have posted some questions in the Files changed section for which I need some inputs. Thanks!

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

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 3, 2020
}
}
//Expect(expectedSteps).To(BeZero(), "Resource steps do not match expected: %#v", expectedSteps)
require.Lenf(GinkgoT(), expectedSteps, 0, "Resource steps do not match expected: %#v", expectedSteps)
Copy link
Contributor Author

@harishsurf harishsurf Apr 3, 2020

Choose a reason for hiding this comment

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

Forgot to change: This line needs to be replaced with the commented line above

@ecordell
Copy link
Member

ecordell commented Apr 3, 2020

This is on the right track @harishsurf, but we need to work on the test nodes a bit more before merging. This is what it looks like currently:

 Dynamic Resource
  Create namespace and CatalogSource 
    Generate a Subscription
      Resolve prometheus API
        Wait for the expected InstallPlan's execution to either fail or succeed

Some of this is subjective, but in my opinion the nodes we define have two goals:

  • Be as readable as possible to a wide audience
  • Define contexts that we can (eventually) re-use between tests
[Describe] Subscriptions create required objects from Catalogs
  [Context] Given a Namespace with an OwnNamespace OperatorGroup
      [Context] when a CatalogSource is created with a bundle that contains prometheus objects
         [It] should install the operator successfully
             [By] creating a subscription to the CatalogSource
         [It] should have created the expected prometheus objects

in the future we may re-use the catalog context by adding more sub-contexts or it blocks - the pattern of creating a catalog source with some content, creating a subscription, and verifying the installed objects is one of the most common patterns we have in the e2e tests.

@harishsurf harishsurf force-pushed the e2e-part1 branch 2 times, most recently from be8d5b1 to ab7a649 Compare April 3, 2020 20:49
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.

Great work. Some nits.


deleteOpts = &metav1.DeleteOptions{}
// Delete Namespace
err := c.KubernetesInterface().CoreV1().Namespaces().Delete(ns.GetName(), deleteOpts)
Copy link
Member

Choose a reason for hiding this comment

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

IIRC, there are efforts to clean the namespace before deleting it. I wonder if you want to add them here before deleting the ns. I understand the current work would delete all resources that are in the ns, but may cause deletion to hang if some resources decide to stick around.

On the worst case, I wonder if adding delediate deletion/gracePeriod=0 would help.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Bowenislandsong , what resources should be cleaned up before deleting a namespace? I was under the impression that cleaner.NotifyTestComplete(true) which internally calls cleanupOLM deletes OLM CR's.

Copy link
Member

Choose a reason for hiding this comment

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

ahh. I see. Then this is good. Thanks for the explanation!

Expect(err).NotTo(HaveOccurred())

// Wait for the CatalogSource to be ready
catsrc, err = fetchCatalogSource(crc, catsrc.GetName(), catsrc.GetNamespace(), catalogSourceRegistryPodSynced)
Copy link
Member

Choose a reason for hiding this comment

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

You can change the fetchCatalogSource function name if you feel need to explain what it does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fetchCatalogSourceOnReady or fetchCatalogSourceWhenAvailable would be a better name?

Copy link
Member

Choose a reason for hiding this comment

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

fetchCatalogSourceOnStatus ? Since you define the status of it to wait on.


AfterEach(func() {

deleteOpts = &metav1.DeleteOptions{}
Copy link
Member

Choose a reason for hiding this comment

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

either make this global or declare it every time you use it.

Copy link
Member

Choose a reason for hiding this comment

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

Ginkgo randomize executions. This deleteOpts may miss its ordering.

@harishsurf harishsurf changed the title [WIP] Modify dynamic_resource_e2e_test to ginkgo Modify dynamic_resource_e2e_test to ginkgo Apr 6, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 6, 2020
@harishsurf
Copy link
Contributor Author

/retest

@harishsurf harishsurf force-pushed the e2e-part1 branch 3 times, most recently from 484f7cf to 8006cb0 Compare April 12, 2020 19:36
@harishsurf
Copy link
Contributor Author

/retest

@harishsurf harishsurf force-pushed the e2e-part1 branch 2 times, most recently from 91cfe93 to a646d19 Compare April 13, 2020 21:43
Copy link
Member

@ecordell ecordell left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 13, 2020
@ecordell ecordell mentioned this pull request Apr 14, 2020
@ecordell
Copy link
Member

/retest

@openshift-ci-robot openshift-ci-robot removed the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Apr 27, 2020
@openshift-ci-robot
Copy link
Collaborator

@harishsurf: No Bugzilla bug is referenced in the title of this pull request.
To reference a bug, add 'Bug XXX:' to the title of this pull request and request another bug refresh with /bugzilla refresh.

In response to this:

Modify dynamic_resource_e2e_test to ginkgo

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.

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Apr 27, 2020
@harishsurf harishsurf force-pushed the e2e-part1 branch 2 times, most recently from c023c02 to 75ad6a1 Compare April 27, 2020 22:04
@harishsurf
Copy link
Contributor Author

/retest

@harishsurf
Copy link
Contributor Author

/retest

@harishsurf
Copy link
Contributor Author

/test e2e-aws-olm

@harishsurf harishsurf force-pushed the e2e-part1 branch 2 times, most recently from 71bf25e to 70a4818 Compare May 7, 2020 16:41
@harishsurf
Copy link
Contributor Author

/test e2e-aws-olm

@harishsurf
Copy link
Contributor Author

/retest

@harishsurf
Copy link
Contributor Author

/test e2e-aws-olm

@harishsurf
Copy link
Contributor Author

/test e2e-aws-console-olm

Copy link
Member

@awgreene awgreene left a comment

Choose a reason for hiding this comment

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

/approve

A few non-blocking nits.

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: awgreene, 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

@awgreene
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 13, 2020
@shawn-hurley shawn-hurley added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label May 13, 2020
@shawn-hurley
Copy link
Member

Overriding valid bug because this is fixing tests

@openshift-merge-robot openshift-merge-robot merged commit 34d6563 into operator-framework:master May 13, 2020
@harishsurf harishsurf deleted the e2e-part1 branch May 19, 2020 14:37
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. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants