Skip to content
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

Errors with make test #774

Open
ursuad opened this issue Nov 25, 2020 · 2 comments
Open

Errors with make test #774

ursuad opened this issue Nov 25, 2020 · 2 comments

Comments

@ursuad
Copy link

ursuad commented Nov 25, 2020

Hi, when I run make test some of the tests are failing because of an issue with the PGP key, and if I comment that out I get a different error, for another test.
Any idea why this is happening?

The Go version I use is go version go1.15.5 darwin/amd64

$ make test
GO15VENDOREXPERIMENT=1 GO111MODULE=on GOPROXY=https://proxy.golang.org go mod tidy
GO15VENDOREXPERIMENT=1 GO111MODULE=on GOPROXY=https://proxy.golang.org go mod vendor
gpg --import pgp/sops_functional_tests_key.asc 2>&1 1>/dev/null || exit 0
gpg: key 3D16CEE4A27381B4: "SOPS Functional Tests Key 1 (https://github.com/mozilla/sops/) <[email protected]>" not changed
gpg: key 3D16CEE4A27381B4: secret key imported
gpg: key D8720D957C3D3074: "SOPS Functional Tests Key 2 (https://github.com/mozilla/sops/) <[email protected]>" not changed
gpg: key D8720D957C3D3074: secret key imported
gpg: key 3D16CEE4A27381B4: "SOPS Functional Tests Key 1 (https://github.com/mozilla/sops/) <[email protected]>" not changed
gpg: key D8720D957C3D3074: "SOPS Functional Tests Key 2 (https://github.com/mozilla/sops/) <[email protected]>" not changed
gpg: key 19F9B5DAEA91FF86: "SOPS Functional Tests Key 3 (https://github.com/mozilla/sops/) <[email protected]>" not changed
gpg: Total number processed: 5
gpg:              unchanged: 5
gpg:       secret keys read: 2
gpg:  secret keys unchanged: 2
./test.sh
ok      go.mozilla.org/sops/v3  0.372s  coverage: 51.7% of statements
ok      go.mozilla.org/sops/v3/aes      0.390s  coverage: 76.9% of statements
?       go.mozilla.org/sops/v3/audit    [no test files]
ok      go.mozilla.org/sops/v3/azkv     0.171s  coverage: 25.5% of statements
?       go.mozilla.org/sops/v3/cmd/sops [no test files]
?       go.mozilla.org/sops/v3/cmd/sops/codes   [no test files]
?       go.mozilla.org/sops/v3/cmd/sops/common  [no test files]
ok      go.mozilla.org/sops/v3/cmd/sops/formats 0.186s  coverage: 100.0% of statements
?       go.mozilla.org/sops/v3/cmd/sops/subcommand/exec [no test files]
?       go.mozilla.org/sops/v3/cmd/sops/subcommand/groups       [no test files]
?       go.mozilla.org/sops/v3/cmd/sops/subcommand/keyservice   [no test files]
?       go.mozilla.org/sops/v3/cmd/sops/subcommand/publish      [no test files]
?       go.mozilla.org/sops/v3/cmd/sops/subcommand/updatekeys   [no test files]
ok      go.mozilla.org/sops/v3/config   0.433s  coverage: 77.8% of statements
ok      go.mozilla.org/sops/v3/decrypt  0.316s  coverage: 0.0% of statements [no tests to run]
ok      go.mozilla.org/sops/v3/gcpkms   0.225s  coverage: 25.4% of statements
ok      go.mozilla.org/sops/v3/hcvault  6.153s  coverage: 59.4% of statements
?       go.mozilla.org/sops/v3/keys     [no test files]
ok      go.mozilla.org/sops/v3/keyservice       0.230s  coverage: 5.0% of statements
ok      go.mozilla.org/sops/v3/kms      0.241s  coverage: 57.0% of statements
?       go.mozilla.org/sops/v3/kms/mocks        [no test files]
?       go.mozilla.org/sops/v3/logging  [no test files]
[PGP]    time="2020-11-24T17:01:04Z" level=warning msg="Deprecation Warning: GPG key fetching from a keyserver witihin sops will be removed in a future version of sops. See https://github.com/mozilla/sops/issues/727 for more information."
--- FAIL: TestRetrievePGPKey (0.32s)
    keysource_test.go:49: 
                Error Trace:    keysource_test.go:49
                Error:          Received unexpected error:
                                could not read entities: openpgp: invalid data: entity without any identities
                Test:           TestRetrievePGPKey
FAIL
coverage: 51.1% of statements
FAIL    go.mozilla.org/sops/v3/pgp      32.192s
FAIL
make: *** [test] Error 1

When I configure to skip that test (with t.Skip), I get a different error in another test:

$ make test
GO15VENDOREXPERIMENT=1 GO111MODULE=on GOPROXY=https://proxy.golang.org go mod tidy
GO15VENDOREXPERIMENT=1 GO111MODULE=on GOPROXY=https://proxy.golang.org go mod vendor
gpg --import pgp/sops_functional_tests_key.asc 2>&1 1>/dev/null || exit 0
gpg: key 3D16CEE4A27381B4: "SOPS Functional Tests Key 1 (https://github.com/mozilla/sops/) <[email protected]>" not changed
gpg: key 3D16CEE4A27381B4: secret key imported
gpg: key D8720D957C3D3074: "SOPS Functional Tests Key 2 (https://github.com/mozilla/sops/) <[email protected]>" not changed
gpg: key D8720D957C3D3074: secret key imported
gpg: key 3D16CEE4A27381B4: "SOPS Functional Tests Key 1 (https://github.com/mozilla/sops/) <[email protected]>" not changed
gpg: key D8720D957C3D3074: "SOPS Functional Tests Key 2 (https://github.com/mozilla/sops/) <[email protected]>" not changed
gpg: key 19F9B5DAEA91FF86: "SOPS Functional Tests Key 3 (https://github.com/mozilla/sops/) <[email protected]>" not changed
gpg: Total number processed: 5
gpg:              unchanged: 5
gpg:       secret keys read: 2
gpg:  secret keys unchanged: 2
./test.sh
ok  	go.mozilla.org/sops/v3	0.481s	coverage: 51.7% of statements
ok  	go.mozilla.org/sops/v3/aes	0.459s	coverage: 76.9% of statements
?   	go.mozilla.org/sops/v3/audit	[no test files]
ok  	go.mozilla.org/sops/v3/azkv	0.219s	coverage: 25.5% of statements
?   	go.mozilla.org/sops/v3/cmd/sops	[no test files]
?   	go.mozilla.org/sops/v3/cmd/sops/codes	[no test files]
?   	go.mozilla.org/sops/v3/cmd/sops/common	[no test files]
ok  	go.mozilla.org/sops/v3/cmd/sops/formats	0.230s	coverage: 100.0% of statements
?   	go.mozilla.org/sops/v3/cmd/sops/subcommand/exec	[no test files]
?   	go.mozilla.org/sops/v3/cmd/sops/subcommand/groups	[no test files]
?   	go.mozilla.org/sops/v3/cmd/sops/subcommand/keyservice	[no test files]
?   	go.mozilla.org/sops/v3/cmd/sops/subcommand/publish	[no test files]
?   	go.mozilla.org/sops/v3/cmd/sops/subcommand/updatekeys	[no test files]
ok  	go.mozilla.org/sops/v3/config	0.348s	coverage: 77.8% of statements
ok  	go.mozilla.org/sops/v3/decrypt	0.337s	coverage: 0.0% of statements [no tests to run]
ok  	go.mozilla.org/sops/v3/gcpkms	0.243s	coverage: 25.4% of statements
ok  	go.mozilla.org/sops/v3/hcvault	8.183s	coverage: 59.4% of statements
?   	go.mozilla.org/sops/v3/keys	[no test files]
ok  	go.mozilla.org/sops/v3/keyservice	0.278s	coverage: 5.0% of statements
ok  	go.mozilla.org/sops/v3/kms	0.278s	coverage: 57.0% of statements
?   	go.mozilla.org/sops/v3/kms/mocks	[no test files]
?   	go.mozilla.org/sops/v3/logging	[no test files]
ok  	go.mozilla.org/sops/v3/pgp	32.935s	coverage: 46.0% of statements
?   	go.mozilla.org/sops/v3/publish	[no test files]
ok  	go.mozilla.org/sops/v3/shamir	0.222s	coverage: 96.2% of statements
ok  	go.mozilla.org/sops/v3/stores	0.366s	coverage: 38.7% of statements
ok  	go.mozilla.org/sops/v3/stores/dotenv	0.282s	coverage: 31.4% of statements
# go.mozilla.org/sops/v3/stores/ini
stores/ini/store.go:292: conversion from int64 to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
FAIL	go.mozilla.org/sops/v3/stores/ini [build failed]
FAIL
make: *** [test] Error 2
@felixfontein
Copy link
Contributor

I'm also getting that test failure:

# go.mozilla.org/sops/v3/stores/ini
stores/ini/store.go:292:21: conversion from int64 to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)

The lines in question:

	case reflect.Int:
		if field.Int() != 0 {
			result[prefix] = string(field.Int())
		}

I would guess that this is wrong (https://golangdocs.com/converting-integer-to-string-in-golang), since I would assume that in this case, the integer should be converted into a string. On the other hand, it is impossible to verify that, since the function encodeMetadataItem containing this code is not used anywhere. I think I'll create a PR to simply remove it :-)

felixfontein added a commit to felixfontein/sops that referenced this issue Dec 29, 2020
felixfontein added a commit to felixfontein/sops that referenced this issue Dec 30, 2020
felixfontein added a commit to felixfontein/sops that referenced this issue Dec 30, 2020
felixfontein added a commit to felixfontein/sops that referenced this issue Jan 6, 2021
felixfontein added a commit to felixfontein/sops that referenced this issue Jan 6, 2021
@mitar
Copy link
Contributor

mitar commented Dec 18, 2021

This is fixed in develop branch.

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

No branches or pull requests

3 participants