Skip to content

Fix TestGnuPGHome_Validate#1370

Merged
felixfontein merged 1 commit intogetsops:mainfrom
stormentt:fix-gpg-wrong-permission-test
Dec 10, 2023
Merged

Fix TestGnuPGHome_Validate#1370
felixfontein merged 1 commit intogetsops:mainfrom
stormentt:fix-gpg-wrong-permission-test

Conversation

@stormentt
Copy link
Contributor

On my stock Ubuntu 22.04 machine with Go 1.21 one of the tests fails:

--- FAIL: TestGnuPGHome_Validate (0.00s)
    --- FAIL: TestGnuPGHome_Validate/wrong_permissions (0.00s)
        keysource_test.go:134: 
                Error Trace:    /home/xmo/pro/sops/pgp/keysource_test.go:134
                Error:          An error is expected but got nil.
                Test:           TestGnuPGHome_Validate/wrong_permissions

The test assumes that t.TempDir() returns a directory with mode 0755.

Taking a look at testing.go:1221 shows that this uses os.MkdirTemp(), which calls Mkdir(name, 0700), causing the test to fail.

To fix this I modified the test to explicitly set the mode on the tempdir to 0755.

Signed-off-by: Tanner Storment <tannerstorment@gmail.com>
@felixfontein felixfontein merged commit 0d58c35 into getsops:main Dec 10, 2023
@felixfontein
Copy link
Contributor

@stormentt thanks a lot for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments