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

test(e2e): delete all subs, installplans, catalogs, and csvs in test teardown #1635

Merged

Conversation

njhale
Copy link
Member

@njhale njhale commented Jul 13, 2020

Replace the existing test cleaner, which preserved test resources on
failure, with a tear down function that always deletes
non-essential Subscriptions, InstallPlans, CatalogSources, and
ClusterServiceVersions in the given test namespace.

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: njhale

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 Jul 13, 2020
@njhale njhale changed the title test(e2e): delete all subs, installplans, catalogs, in test teardown test(e2e): delete all subs, installplans, catalogs, and csvs in test teardown Jul 13, 2020
}

// func cleanupOLM(namespace string) {
Copy link
Member

Choose a reason for hiding this comment

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

probably just delete this?

)

// TearDown deletes all OLM resources in the corresponding namespace and at the cluster scope.
func TearDown(namespace string) {
Copy link
Member

@ecordell ecordell Jul 13, 2020

Choose a reason for hiding this comment

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

it would be useful if there were a way to control this (i.e. via an env var) so that locally I can quickly switch cleanup off to look at the cluster state.

And I think really what we want is a sort of "must-gather" per test. Doesn't need to block this PR but I'd be interested in something that say, read all of this content off the cluster and saved it to configmaps before deleting everything.

Copy link
Member Author

@njhale njhale Jul 13, 2020

Choose a reason for hiding this comment

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

@benluddy and I were just talking about this over Slack.

He recommended implementing a Reporter to do this. We were thinking that for an initial pass we could export all resources in the operators.coreos.com API group to a tar file hosted in cloud storage at the end of each failed spec, then the reporter could post a link to each export in the suite summary.

I could probably take a crack at a custom reporter for this PR, providing you agree it satisfies your feedback.

Copy link
Member

Choose a reason for hiding this comment

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

That sounds good, but it would be nice if we can make it work across github actions, openshift ci, and locally.

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds good, but it would be nice if we can make it work across github actions, openshift ci, and locally.

It may be good enough to accept a template string via environment variables to construct those URLs and set it appropriately in the corresponding config.

@njhale njhale force-pushed the fix-always-cleanup-e2e branch from e6a4d5c to a953647 Compare July 13, 2020 21:51
@@ -31,7 +31,7 @@ import (
var _ = Describe("Catalog", func() {
It("loading between restarts", func() {

defer cleaner.NotifyTestComplete(true)
defer TearDown(testNamespace)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these all turn into one AfterEach since you're touching them anyway? I see at least a couple of the defers appear partway through a spec, but if this cleanup behavior is supposed to be idempotent, that seems like an overcomplication.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can these all turn into one AfterEach since you're touching them anyway?

Yeah, can do.

but if this cleanup behavior is supposed to be idempotent, that seems like an overcomplication.

I agree, but I think we need to consider cleaning these up carefully though. Not all tests use testNamespace, but instead generate one or more namespaces on the fly, which is what I think some of these defer statements service. I n general, I think we should standardize on one of the two above patterns across all of our tests. Suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use the TestContext to provide namespaces to tests? We'd be able to make cleanup, randomization, etc. transparent to individual tests.

@njhale njhale force-pushed the fix-always-cleanup-e2e branch 3 times, most recently from e4d179f to 49ca1dc Compare July 13, 2020 23:49
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 14, 2020
…teardown

Replace the existing test cleaner, which preserved test resources on
failure, with a tear down function that always deletes
non-essential Subscriptions, InstallPlans, CatalogSources, and
ClusterServiceVersions in the given test namespace.
@njhale njhale force-pushed the fix-always-cleanup-e2e branch from 49ca1dc to e4a8133 Compare July 14, 2020 15:42
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 14, 2020
@ecordell
Copy link
Member

/lgtm

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

/retest

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

11 similar comments
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

18 similar comments
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@njhale
Copy link
Member Author

njhale commented Jul 16, 2020

/retest

@openshift-bot
Copy link
Contributor

/retest

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

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

5 similar comments
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@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 82ab614 into operator-framework:master Jul 16, 2020
@njhale njhale deleted the fix-always-cleanup-e2e branch July 23, 2021 02:44
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.

6 participants