Skip to content

Upgrade tests - properly clean up resources - #12395

Merged
knative-prow-robot merged 2 commits into
knative:mainfrom
mgencur:upgrade_cleanup
Jan 21, 2022
Merged

knative-prow-robot merged 2 commits into
knative:mainfrom
mgencur:upgrade_cleanup

Conversation

@mgencur

@mgencur mgencur commented Dec 6, 2021 •

Copy link
Copy Markdown
Contributor

Fixes #12400

Proposed Changes

  • Tear down services (and related resources) at the end of post-upgrade/post-downgrade phase within Golang so that nothing is left running.

Release Note


* clean the services within Golang test, either in post-upgrade or
post-downgrade test if it is executed
* re-use code from updateService function in servicePostDowngrade test
@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 6, 2021
@google-cla google-cla Bot added the cla: yes Indicates the PR's author has signed the CLA. label Dec 6, 2021
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/test-and-release It flags unit/e2e/conformance/perf test issues for product features labels Dec 6, 2021
@codecov

codecov Bot commented Dec 6, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #12395 (1453c19) into main (d436895) will increase coverage by 0.02%.
The diff coverage is n/a.

❗ Current head 1453c19 differs from pull request most recent head 78adaf9. Consider uploading reports for the commit 78adaf9 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12395      +/-   ##
==========================================
+ Coverage   87.43%   87.45%   +0.02%     
==========================================
  Files         195      195              
  Lines        9655     9655              
==========================================
+ Hits         8442     8444       +2     
+ Misses        930      928       -2     
  Partials      283      283              
Impacted Files Coverage Δ
pkg/autoscaler/statserver/server.go 79.61% <0.00%> (+1.94%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d436895...78adaf9. Read the comment docs.

@mgencur
mgencur force-pushed the upgrade_cleanup branch 2 times, most recently from 1453c19 to 78adaf9 Compare December 6, 2021 14:03
@mgencur mgencur changed the title [WIP] Upgrade tests - tear down services within test Upgrade tests - preperly clean up resources Dec 6, 2021
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 6, 2021
@mgencur

mgencur commented Dec 6, 2021

Copy link
Copy Markdown
Contributor Author

/retest

@skonto

skonto commented Dec 8, 2021

Copy link
Copy Markdown
Contributor

Should we verify that nothing is left somehow?

@mgencur

mgencur commented Dec 8, 2021

Copy link
Copy Markdown
Contributor Author

Should we verify that nothing is left somehow?

You mean verify that after running the tests nothing is left in the test namespace? I manually checked this when I implemented these changes (in previous runs of CI). If you're talking about permanent check, I'm not sure it's necessary to pollute the scripts with that. We don't do that in other test suites either, AFAIK.

@skonto

skonto commented Dec 8, 2021

Copy link
Copy Markdown
Contributor

Thanks for the clarification @mgencur. Yeah just wanted to verify somehow the outcome of this patch. Could you also update the title (s/preperly/properly)?

@mgencur mgencur changed the title Upgrade tests - preperly clean up resources Upgrade tests - properly clean up resources Dec 8, 2021
@mgencur

mgencur commented Dec 8, 2021

Copy link
Copy Markdown
Contributor Author

@skonto Updated.

func CreateNewServicePostDowngradeTest() pkgupgrade.Operation {
return pkgupgrade.NewOperation("CreateNewServicePostDowngradeTest", func(c pkgupgrade.Context) {
createNewService(postDowngradeServiceName, c.T)
createNewService("pizzaplanet-post-downgrade-service", c.T)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why not use the const?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because it is used only in a single place. The const also doesn't make it clearer what this means because the name of the const was nearly the same as the string.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

On the one hand placing the const side by side with the others is nice (you see all constants in one place) but on the other hand when you're looking at this test you need to also look in the other place to find out what the string is. But I don't have a strong opinion on this.

func CreateNewServicePostUpgradeTest() pkgupgrade.Operation {
return pkgupgrade.NewOperation("CreateNewServicePostUpgradeTest", func(c pkgupgrade.Context) {
createNewService(postUpgradeServiceName, c.T)
createNewService("pizzaplanet-post-upgrade-service", c.T)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same question, why not use the const?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because it is used only in a single place.

@skonto skonto Dec 9, 2021 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it is fine to remove the constant. Since it is used in one place and its value suffix documents its usage there is no reason to make it a global constant (although not bad for Golang either). The name of the service seems more of a detail to me. What matters in this context is the operation CreateNewServicePostUpgradeTest, unless I miss something here.

@skonto

skonto commented Dec 10, 2021

Copy link
Copy Markdown
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 10, 2021
@skonto

skonto commented Dec 10, 2021 •

Copy link
Copy Markdown
Contributor

/cc @dprotaso for approval and last minute check.

@dprotaso

Copy link
Copy Markdown
Member

/lgtm
/approve

@knative-prow-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, mgencur

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

The pull request process is described here

Details 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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 21, 2022
@knative-prow-robot
knative-prow-robot merged commit ff54500 into knative:main Jan 21, 2022
mgencur added a commit to mgencur/serving-1 that referenced this pull request Feb 7, 2022
* Ensure service cleanup in upgrade tests

* clean the services within Golang test, either in post-upgrade or
post-downgrade test if it is executed
* re-use code from updateService function in servicePostDowngrade test

* Fix service names in ScaleToZero post upgrade test
openshift-merge-robot pushed a commit to openshift/knative-serving that referenced this pull request Feb 8, 2022
…#12395) (#1046)

* Upgrade tests - properly clean up resources  (knative#12395)

* Ensure service cleanup in upgrade tests

* clean the services within Golang test, either in post-upgrade or
post-downgrade test if it is executed
* re-use code from updateService function in servicePostDowngrade test

* Fix service names in ScaleToZero post upgrade test

* Call create_namespaces with arg SYSTEM_NAMESPACES (#1025)

* This is required after merging
https://github.com/openshift-knative/serverless-operator/commit/c76313f15a3a612a1a38b812dcfa8f688fdf00c6#diff-051375546db9782[…]3dd8634ca5b2c8968bb8
which separates system and test namespaces, so it is required to choose
system ns
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. area/test-and-release It flags unit/e2e/conformance/perf test issues for product features cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Services started by upgrade tests not properly cleaned up

5 participants