-
Notifications
You must be signed in to change notification settings - Fork 86
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
refactor: better resource cleanup handling #419
Conversation
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
pkg/test/case.go
Outdated
@@ -355,7 +344,7 @@ func (t *Case) Run(test *testing.T, tc *report.Testcase) { | |||
tc.Assertions += len(testStep.Asserts) | |||
tc.Assertions += len(testStep.Errors) | |||
|
|||
if errs := runStep(test, t, testStep, ns); len(errs) > 0 { | |||
if errs := testStep.Run(test, ns.Name, t.SkipDelete); len(errs) > 0 { |
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.
Could it make sense to add a new SkipDelete
field to the Step
struct, to avoid passing this around as a func param?
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.
Not sure it would make things better, currently this is not overridable in a Step
, this makes sense to me that it is the responsibility of the caller to pass the flag.
I don't have a strong opinion though, if you prefer the field based approach I will use that.
WDYT ?
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.
I don't have a strong opinion on this. So far the func has few params. What I don't like is funcs with a lot of params - especially of the same type. :-)
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.
Switched to a struct field.
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
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
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.
integration tests need updating for completion
./bin/golangci-lint --timeout 5m run --build-tags integration
pkg/test/step_integration_test.go:443:28: not enough arguments in call to step.Run
have (string)
want (*"testing".T, string) (typecheck)
errs := step.Run(namespace)
^
pkg/test/step_integration_test.go:461:33: not enough arguments in call to step.Run
have (string)
want (*"testing".T, string) (typecheck)
errors := step.Run("irrelevant")
^
pkg/test/step_integration_test.go:479:33: not enough arguments in call to step.Run
have (string)
want (*"testing".T, string) (typecheck)
errors := step.Run("irrelevant")
for awareness... I commonly run the following as a starting point of review:
|
I will fix this tomorrow. How about running this in a gh workflow ? |
yeah... when I noticed the passing CI... I had the same thought. I will look into that. |
well... now I remember some issues we had in the past but haven't been resolved. For some reason CircleCI wouldn't run PRs from non-committers. So the full CI isn't run (just the DCO). I worked with circle to help resolve that but didn't get it resolved. We were looking to move to Github Actions in part to solve that... but it also reduces the number of CI dependencies. Probably need to refocus on that. |
that's what #337 was intended to solve. |
Signed-off-by: Ken Sipe <kensipe@gmail.com>
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.
thanks @eddycharly . I pushed the integration test refactors. I'll merge after good CI runs. Thanks for the contribution!
What this PR does / why we need it:
This PR improves resource cleanup handling.