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.
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.
Would be awesome if it's possible to create a test case showing this working as expected. You can see how we do the tests currently: https://github.com/zalando/go-keyring/blob/master/.github/workflows/go.yml
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.
Ok, I figured out how to reproduce using the test cases but I dont know how to write the test cases for it because it's a bit tricky.
basically, a test case has to get an existing secret from the keyring. The issue with the existing
TestGet
case is that it initially sets the secret which it already has an open/unlocked session, and then it gets the secret, which is totally fine.But in the case of KeepassXC, where it has the option to lock items, when the session gets closed and another session opens to only retrieve the secret, it requires a prompt from the user to confirm.
I enabled gnome-keyring-daemon locally and ran the test case but it seems to work because it looks like the gnome-keyring-daemon does not have an option to prompt when a secret is retrieved.
If you have KeepassXC enabled as a secret service. Make sure to enable the prompt option, then try this test case:
This test case has to be run twice. First to set the secret if it's not already set, and then if it's already set, get the secret. I dont like this since it requires to run go test twice.
Any idea how to test this? 😅
here is also a video
go-keyring-test-case.mp4