This repository was archived by the owner on Nov 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 131
memcached/test/e2e: use pointer to ctx, not struct #31
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Golang is pass-by-value, so passing the value of ctx meant that any finalizer functions added in memcachedScaleTest were not being run. This commit changes that by using a pointer instead.
fanminshi
reviewed
Aug 31, 2018
@@ -51,7 +51,7 @@ func TestMemcached(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func memcachedScaleTest(t *testing.T, f *framework.Framework, ctx framework.TestCtx) error { | |||
func memcachedScaleTest(t *testing.T, f *framework.Framework, ctx *framework.TestCtx) error { |
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.
if the ctx
here ctx := framework.NewTestCtx(t)
is a pointer. The user is mostly likely to pass it to other place as a pointer which can force the intended behavior.
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 made the change in the sdk with this PR: operator-framework/operator-sdk#451
After that PR is merged, I will update this repo with the new changes
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.
sounds good!
The latest operator-sdk master includes a fix for the pointer issue
Fixed |
lgtm |
@hasbro17 PTAL |
LGTM |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Golang is pass-by-value, so passing the value of ctx meant that
any finalizer functions added in memcachedScaleTest were not being
run. This commit changes that by using a pointer instead.
This also adds a finalizer function for the example-memcached CR, which is why we need to pass a pointer instead of the value.