Skip to content

test: make test does not unset SOPS_AGE_SSH_PRIVATE_KEY_FILE #1990

@acuteaangle

Description

@acuteaangle

When running make test, I noticed that it was automatically unsetting SOPS_AGE_KEY_FILE and SOPS_AGE_KEY_COMMAND; however, many of the tests were failing, as it was attempting to access my SOPS_AGE_SSH_PRIVATE_KEY_FILE, which it does not have permission to access.
Manually unsetting SOPS_AGE_SSH_PRIVATE_KEY_FILE resolves the issue.

Output
[...] unset SOPS_AGE_KEY_FILE; unset SOPS_AGE_KEY_CMD; LANG=en_US.UTF-8 GOPROXY=https://proxy.golang.org go test -race -coverprofile=profile.out -covermode=atomic ./... ok	github.com/getsops/sops/v3	1.041s	coverage: 58.0% of statements ok	github.com/getsops/sops/v3/aes	1.092s	coverage: 78.2% of statements --- FAIL: TestMasterKey_loadIdentities (0.01s) --- FAIL: TestMasterKey_loadIdentities/SOPS_AGE_KEY (0.00s) keysource_test.go:373:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:373	Error:	"failed to open file: open /etc/ssh/ssh_host_ed25519_key: permission denied" should have 0 item(s), but has 1	Test:	TestMasterKey_loadIdentities/SOPS_AGE_KEY keysource_test.go:375:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:375	Error:	"[/tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesSOPS_AGE_KEY3814133051/001/.ssh/id_ed25519 /tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesSOPS_AGE_KEY3814133051/001/.ssh/id_rsa SOPS_AGE_KEY_FILE SOPS_AGE_KEY_CMD]" should have 5 item(s), but has 4	Test:	TestMasterKey_loadIdentities/SOPS_AGE_KEY --- FAIL: TestMasterKey_loadIdentities/SOPS_AGE_KEY_multiple (0.00s) keysource_test.go:387:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:387	Error:	"failed to open file: open /etc/ssh/ssh_host_ed25519_key: permission denied" should have 0 item(s), but has 1	Test:	TestMasterKey_loadIdentities/SOPS_AGE_KEY_multiple keysource_test.go:389:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:389	Error:	"[/tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesSOPS_AGE_KEY_multiple2612334874/001/.ssh/id_ed25519 /tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesSOPS_AGE_KEY_multiple2612334874/001/.ssh/id_rsa SOPS_AGE_KEY_FILE SOPS_AGE_KEY_CMD]" should have 5 item(s), but has 4	Test:	TestMasterKey_loadIdentities/SOPS_AGE_KEY_multiple --- FAIL: TestMasterKey_loadIdentities/SOPS_AGE_KEY_FILE (0.00s) keysource_test.go:404:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:404	Error:	"failed to open file: open /etc/ssh/ssh_host_ed25519_key: permission denied" should have 0 item(s), but has 1	Test:	TestMasterKey_loadIdentities/SOPS_AGE_KEY_FILE keysource_test.go:406:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:406	Error:	"[/tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesSOPS_AGE_KEY_FILE192858121/001/.ssh/id_ed25519 /tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesSOPS_AGE_KEY_FILE192858121/001/.ssh/id_rsa SOPS_AGE_KEY SOPS_AGE_KEY_CMD]" should have 5 item(s), but has 4	Test:	TestMasterKey_loadIdentities/SOPS_AGE_KEY_FILE --- FAIL: TestMasterKey_loadIdentities/sops/age/keys.txt (0.00s) keysource_test.go:423:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:423	Error:	"failed to open file: open /etc/ssh/ssh_host_ed25519_key: permission denied" should have 0 item(s), but has 1	Test:	TestMasterKey_loadIdentities/sops/age/keys.txt keysource_test.go:425:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:425	Error:	"[/tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiessopsagekeys.txt1223013159/001/.ssh/id_ed25519 /tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiessopsagekeys.txt1223013159/001/.ssh/id_rsa SOPS_AGE_KEY SOPS_AGE_KEY_FILE SOPS_AGE_KEY_CMD]" should have 6 item(s), but has 5	Test:	TestMasterKey_loadIdentities/sops/age/keys.txt --- FAIL: TestMasterKey_loadIdentities/no_identity (0.00s) keysource_test.go:453:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:453	Error:	"failed to open file: open /etc/ssh/ssh_host_ed25519_key: permission denied" should have 0 item(s), but has 1	Test:	TestMasterKey_loadIdentities/no_identity keysource_test.go:455:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:455	Error:	"[/tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesno_identity4226963057/001/.ssh/id_ed25519 /tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesno_identity4226963057/001/.ssh/id_rsa SOPS_AGE_KEY SOPS_AGE_KEY_FILE SOPS_AGE_KEY_CMD /tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesno_identity4226963057/001/sops/age/keys.txt]" should have 7 item(s), but has 6	Test:	TestMasterKey_loadIdentities/no_identity --- FAIL: TestMasterKey_loadIdentities/multiple_identities (0.00s) keysource_test.go:476:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:476	Error:	"failed to open file: open /etc/ssh/ssh_host_ed25519_key: permission denied" should have 0 item(s), but has 1	Test:	TestMasterKey_loadIdentities/multiple_identities keysource_test.go:478:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:478	Error:	"[/tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesmultiple_identities4293030132/001/.ssh/id_ed25519 /tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesmultiple_identities4293030132/001/.ssh/id_rsa SOPS_AGE_KEY SOPS_AGE_KEY_CMD]" should have 5 item(s), but has 4	Test:	TestMasterKey_loadIdentities/multiple_identities --- FAIL: TestMasterKey_loadIdentities/parsing_error (0.00s) keysource_test.go:490:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:490	Error:	"failed to open file: open /etc/ssh/ssh_host_ed25519_key: permission denied; failed to parse 'SOPS_AGE_KEY' age identities: unknown identity type" should have 1 item(s), but has 2	Test:	TestMasterKey_loadIdentities/parsing_error keysource_test.go:492:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:492	Error:	Error "failed to open file: open /etc/ssh/ssh_host_ed25519_key: permission denied" does not contain "failed to parse 'SOPS_AGE_KEY' age identities"	Test:	TestMasterKey_loadIdentities/parsing_error keysource_test.go:494:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:494	Error:	"[/tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesparsing_error1104065304/001/.ssh/id_ed25519 /tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesparsing_error1104065304/001/.ssh/id_rsa SOPS_AGE_KEY_FILE SOPS_AGE_KEY_CMD]" should have 5 item(s), but has 4	Test:	TestMasterKey_loadIdentities/parsing_error --- FAIL: TestMasterKey_loadIdentities/SOPS_AGE_KEY_CMD (0.00s) keysource_test.go:506:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:506	Error:	"failed to open file: open /etc/ssh/ssh_host_ed25519_key: permission denied" should have 0 item(s), but has 1	Test:	TestMasterKey_loadIdentities/SOPS_AGE_KEY_CMD keysource_test.go:508:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:508	Error:	"[/tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesSOPS_AGE_KEY_CMD1814545984/001/.ssh/id_ed25519 /tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiesSOPS_AGE_KEY_CMD1814545984/001/.ssh/id_rsa SOPS_AGE_KEY SOPS_AGE_KEY_FILE]" should have 5 item(s), but has 4	Test:	TestMasterKey_loadIdentities/SOPS_AGE_KEY_CMD --- FAIL: TestMasterKey_loadIdentities/cmd_error (0.00s) keysource_test.go:520:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:520	Error:	"failed to open file: open /etc/ssh/ssh_host_ed25519_key: permission denied; failed to execute command meow from SOPS_AGE_KEY_CMD: exec: "meow": executable file not found in $PATH" should have 1 item(s), but has 2	Test:	TestMasterKey_loadIdentities/cmd_error keysource_test.go:522:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:522	Error:	Error "failed to open file: open /etc/ssh/ssh_host_ed25519_key: permission denied" does not contain "failed to execute command meow"	Test:	TestMasterKey_loadIdentities/cmd_error keysource_test.go:524:	Error Trace:	/home/home/workspace/sops/age/keysource_test.go:524	Error:	"[/tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiescmd_error3881768305/001/.ssh/id_ed25519 /tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiescmd_error3881768305/001/.ssh/id_rsa SOPS_AGE_KEY SOPS_AGE_KEY_FILE /tmp/nix-shell-333741-0/TestMasterKey_loadIdentitiescmd_error3881768305/001/sops/age/keys.txt]" should have 6 item(s), but has 5	Test:	TestMasterKey_loadIdentities/cmd_error [...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions