-
Notifications
You must be signed in to change notification settings - Fork 176
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
Make code checking for secret --replace cleaner #1995
Conversation
Ephemeral COPR build failed. @containers/packit-build please check. |
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.
The commit could need some explanation would the actual logic change in the code is because it was really not obvious to me.
_, data, err := manager.LookupSecretData("mysecret") | ||
require.NoError(t, err) | ||
require.Equal(t, string(data), "mydata.diff") | ||
|
||
_, err = manager.Store("nonexistingsecret", []byte("mydata"), drivertype, storeOpts) | ||
require.NoError(t, err) | ||
|
||
storeOpts.Replace = false | ||
_, err = manager.Store("nonexistingsecret", []byte("newdata"), drivertype, storeOpts) | ||
require.Error(t, err) | ||
|
||
_, err = manager.Delete("nonexistingsecret") | ||
require.NoError(t, err) |
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.
Unless I am doing something wrong this test passes with and without your changes so it does not check what you think it does I guess
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.
These are good things to check, but I agree, I don't see a fix in my code.
This is fixing: $ echo hi | /bin/podman secret create --replace foobar - But I can not get it to fail in common. Basically if the first Delete |
What podman version are you using? Seems to work fine on podman main branch for me?
|
I went and looked and sadly (for me) i fixed this in previous common patches, and forgot. So this PR does not really fix the issue, but I think adds some decent tests and makes the code easier to understand in my opinion. I will change the commit message. |
Add some tests to make sure secrets do not regress. Signed-off-by: Daniel J Walsh <dwalsh@redhat.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, I don't think the code change matters much but at least we now have a different error for both cases so we can at least tell which call failed if a users ever reports a bug so that seems good.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Luap99, rhatdan 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 |
/lgtm |
8b4f2cf
into
containers:main
Add some tests to make sure secrets do not regress.