-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add skip-cleanup-on-errors option to test local
command
#2512
Add skip-cleanup-on-errors option to test local
command
#2512
Conversation
3f532bc
to
76bc2c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your collab 👍. Following some requirements.
- Few changes were requested. Please, could you check?
- Fix lint issues:
Also, the code is not passing in the lint. ( to test/check locally run make lint
)
See the errors faced and how to solve them:
cmd/operator-sdk/test/local.go:86: line is 146 characters (lll)
testCmd.Flags().BoolVar(&tlConfig.cleanupOnErrors, "cleanup-on-errors", true, "Clean up created esources even after the test encountered errors")
It is regards the size of the line.
Devs should not need to give the scroll to check the code implementation
Just broken in 2 lines ( put the msg on bottom )
pkg/test/framework.go:77:20: struct of size 96 bytes could be of size 88 bytes (maligned)
type frameworkOpts struct {
It is regarded the memory allocation optimization. Keep all bools declared at the end.
More info: https://medium.com/@sebassegros/golang-dealing-with-maligned-structs-9b77bacf4b97
- Update the docs by running the command
gen-cli-doc
41a39b0
to
21e15a1
Compare
@camilamacedo86 thanks for the suggestions and the thorough review! Just addressed the review with another commit. |
1 similar comment
@camilamacedo86 thanks for the suggestions and the thorough review! Just addressed the review with another commit. |
test local
commandtest local
command
Hi @JAORMX, Really tks for the prompt reply. See here that is still missing the fix the issues pointed out by the lint. You can check/test it locally by running |
@camilamacedo86 I ran make lint but got no output :/ |
Hi @JAORMX, I am getting the same output that you can check in the CI for it. To know more about see: https://github.com/golang/lint. We need to have the code fixed, passing in the CI for we are able to approve and merge OK? Feel free to ping me in the slack if you need help. |
21e15a1
to
6bd8388
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm with some comments I added that would rephrase some of the user facing messages.
c6a6ae4
to
cc45d19
Compare
changed "artefact" for artifact as suggested, and addressed the merge conflict in the changelog. |
cc45d19
to
99c719c
Compare
/lgtm |
99c719c
to
58180b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JAORMX why not add a cleanup function that tails logs at the end of your test so it runs before any cleanup function?
@estroz cause we can't ensure the order of the cleanup functions AFAIK. This just makes it a lot easier and it hooks natively with what the ci-operator does in OpenShift CI which is basically that... grabbing all containers and pulling the logs into the artifacts directory. That way, no extra code needs to be written per project, and we can just use this flag. |
@JAORMX cleanup functions are executed in LIFO order. Nothing documents this behavior though 👎. Can you elaborate on what you mean by "hooks natively with what the ci-operator does"? Is this hook specific to ci-operator/OpenShift CI or generally used in prow? This is a nice-to-have feature, but OpenShift-specific features shouldn't be added upstream for the sake of OpenShift alone. |
I'm honestly not sure if this is a general prow feature or not. And this is an optional flag that is not in use by default. I proposed it here because I thought it would be a more general case. Else I would keep the changes in our own repos. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JAORMX I think this is useful in general as well, just wanted to clarify why this was being proposed. Thanks for contributing!
Mind if I document this in a separate PR? |
Hi @JAORMX Regards,
Following the suggestion.
|
This flags (which is `false` by default) tells the framework whether to clean up (or not) if the test encountered errors. With the current behavior, the framework will always clean up the resources it created. This is fine in most cases, however, in CI, whenever there's an error, we might not get the logs of the workloads and operator after the cleanup. So this option enables those resources to linger until the logs have been acquired. Co-Authored-By: Camila Macedo <[email protected]>
58180b6
to
0656468
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Description of the change:
This flag (which is
false
by default) tells the framework whether toskip the clean up (or do it) if the test encountered errors.
Motivation for the change:
With the current behavior, the framework will always clean up the
resources it created. This is fine in most cases, however, in CI,
whenever there's an error, we might not get the logs of the workloads
and operator after the cleanup. So this option enables those resources
to linger until the logs have been acquired.