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

Go version: run build checks & tests #317

Merged
merged 6 commits into from
Nov 13, 2020
Merged

Go version: run build checks & tests #317

merged 6 commits into from
Nov 13, 2020

Conversation

MaxHorstmann
Copy link
Contributor

@MaxHorstmann MaxHorstmann commented Nov 11, 2020

Analogous to the existing circleci build checks for the Bash version, this adds a GitHub Actions workflow to run build checks & unit/integration tests for the Go version (#310).

@MaxHorstmann MaxHorstmann changed the title Add GH Actions workflow to run build checks Go version: add GH Actions workflow to run build checks Nov 11, 2020
@MaxHorstmann MaxHorstmann self-assigned this Nov 11, 2020
@MaxHorstmann MaxHorstmann changed the title Go version: add GH Actions workflow to run build checks Go version: run build checks & tests Nov 12, 2020
@MaxHorstmann
Copy link
Contributor Author

@tlimoncelli mind taking a look? I added unit & integration tests per your comment. Sample run: https://github.com/StackExchange/blackbox/runs/1392341389?check_suite_focus=true

Unit tests pass, but some of them appear to get skipped:

Run go test ./...
go: downloading github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
go: downloading github.com/sergi/go-diff v1.1.0
?   	github.com/StackExchange/blackbox/v2/cmd/blackbox	[no test files]
ok  	github.com/StackExchange/blackbox/v2/integrationTest	0.038s
?   	github.com/StackExchange/blackbox/v2/models	[no test files]
?   	github.com/StackExchange/blackbox/v2/pkg/bblog	[no test files]
ok  	github.com/StackExchange/blackbox/v2/pkg/bbutil	0.019s
ok  	github.com/StackExchange/blackbox/v2/pkg/box	0.016s
?   	github.com/StackExchange/blackbox/v2/pkg/commitlater	[no test files]
?   	github.com/StackExchange/blackbox/v2/pkg/crypters	[no test files]
?   	github.com/StackExchange/blackbox/v2/pkg/crypters/gnupg	[no test files]
ok  	github.com/StackExchange/blackbox/v2/pkg/makesafe	0.003s
?   	github.com/StackExchange/blackbox/v2/pkg/vcs	[no test files]
?   	github.com/StackExchange/blackbox/v2/pkg/vcs/git	[no test files]
?   	github.com/StackExchange/blackbox/v2/pkg/vcs/none	[no test files]

Integration tests are failing:

Run go test -long --nocleanup
========== Compiling
VCS root is: ""
team is: ""
configdir will be: ".blackbox"
--- FAIL: TestInit (0.48s)
    integration_test.go:77: got=0644 want=0640: .blackbox/blackbox-admins.txt
VCS root is: ""
team is: ""
configdir will be: ".blackbox"
VCS root is: ""
team is: ""
configdir will be: ".blackbox"
VCS root is: ""
team is: ""
configdir will be: ".blackbox"
========== SHREDDING: "shredme.txt"
VCS root is: ""
team is: ""
configdir will be: ".blackbox"
ABOUT TO CALL TestingInitRepo
vcs = GIT
Initialized empty Git repository in /tmp/bbhome-BasicAlice/repo/.git/
RETURNED from TestingInitRepo: <nil>
/tmp/bbhome-BasicAlice/repo <nil>
VCS root is: "."
team is: ""
configdir will be: ".blackbox"
NEXT STEP: You need to manually check these in:
     git commit -m'INITIALIZE BLACKBOX' -m'    * set gitattr=UNIX .blackbox/blackbox-admins.txt .blackbox/blackbox-files.txt' -m'    * gitignore pubring.gpg~ pubring.kbx~ secring.gpg' -m'    * NEW: .blackbox/blackbox-admins.txt .blackbox/blackbox-files.txt' .blackbox/.gitattributes .gitignore .blackbox/blackbox-admins.txt .blackbox/blackbox-files.txt
gpg-agent[3521]: directory '/tmp/bbhome-BasicAlice/.gnupg-alice/private-keys-v1.d' created
WARNING: gpg-agent didn't output what we expected. Assumed dead.
gpg-agent[3522]: gpg-agent (GnuPG) 2.2.4========== Do we have --quick-generate-key?
 started
gpg: keybox '/tmp/bbhome-BasicAlice/.gnupg-alice/pubring.kbx' created
gpg: /tmp/bbhome-BasicAlice/.gnupg-alice/trustdb.gpg: trustdb created
gpg: key 778A6CAC60BEB706 marked as ultimately trusted
gpg: directory '/tmp/bbhome-BasicAlice/.gnupg-alice/openpgp-revocs.d' created
gpg: revocation certificate stored as '/tmp/bbhome-BasicAlice/.gnupg-alice/openpgp-revocs.d/E221ECC6099733A5B0F814DF778A6CAC60BEB706.rev'
========== Done
DISCOVERED: NEW GPG
Generating "alice@example.com" using --qgk
gpg: key BEA869CEF9D25695 marked as ultimately trusted
gpg: revocation certificate stored as '/tmp/bbhome-BasicAlice/.gnupg-alice/openpgp-revocs.d/6B39A3C208FD7FE4B2782969BEA869CEF9D25695.rev'
gpg: keybox '/tmp/bbhome-BasicAlice/repo/.blackbox/pubring.kbx' created
gpg: /tmp/bbhome-BasicAlice/repo/.blackbox/trustdb.gpg: trustdb created
gpg: key BEA869CEF9D25695: public key "alice@example.com" imported
gpg: Total number processed: 1
gpg:               imported: 1
NEXT STEP: You need to manually check these in:
     git commit -m'NEW ADMIN: alice@example.com' .blackbox/blackbox-admins.txt .blackbox/pubring.kbx .blackbox/trustdb.gpg
========== SHREDDING: "foo.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: foo.txt' -m'    * gitignore foo.txt' -m'    * blackbox-files.txt add: foo.txt' .gitignore .blackbox/blackbox-files.txt foo.txt.gpg
========== DECRYPTING "foo.txt"
========== ENCRYPTING "foo.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: foo.txt' foo.txt.gpg
========== blackbox administrators are:
alice@example.com
========== (the above people will be able to access the file)
========== SHREDDING: "foo.txt"
========== DECRYPTING "foo.txt"
========== ENCRYPTING "foo.txt"
========== SHREDDING: "foo.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'REENCRYPT: foo.txt' foo.txt.gpg
========== ENCRYPTING "foo.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: foo.txt' foo.txt.gpg
ABOUT TO CALL TestingInitRepo
vcs = GIT
Initialized empty Git repository in /tmp/bbhome-Mallory/repo/.git/
RETURNED from TestingInitRepo: <nil>
/tmp/bbhome-Mallory/repo <nil>
VCS root is: "."
team is: ""
configdir will be: ".blackbox"
NEXT STEP: You need to manually check these in:
     git commit -m'INITIALIZE BLACKBOX' -m'    * set gitattr=UNIX .blackbox/blackbox-admins.txt .blackbox/blackbox-files.txt' -m'    * gitignore pubring.gpg~ pubring.kbx~ secring.gpg' -m'    * NEW: .blackbox/blackbox-admins.txt .blackbox/blackbox-files.txt' .blackbox/.gitattributes .gitignore .blackbox/blackbox-admins.txt .blackbox/blackbox-files.txt
gpg-agent[3649]: directory '/tmp/bbhome-Mallory/.gnupg-mallory/private-keys-v1.d' created
WARNING: gpg-agent didn't output what we expected. Assumed dead.
========== Do we have --quick-generate-key?
gpg-agent[3650]: gpg-agent (GnuPG) 2.2.4 started
gpg: keybox '/tmp/bbhome-Mallory/.gnupg-mallory/pubring.kbx' created
gpg: /tmp/bbhome-Mallory/.gnupg-mallory/trustdb.gpg: trustdb created
gpg: key A1562F1EE2829AC3 marked as ultimately trusted
gpg: directory '/tmp/bbhome-Mallory/.gnupg-mallory/openpgp-revocs.d' created
gpg: revocation certificate stored as '/tmp/bbhome-Mallory/.gnupg-mallory/openpgp-revocs.d/5650AB4CFCB5929DAFFFF7D0A1562F1EE2829AC3.rev'
========== Done
DISCOVERED: NEW GPG
Generating "mallory@example.com" using --qgk
gpg: key BEDC0B8A926F8656 marked as ultimately trusted
gpg: revocation certificate stored as '/tmp/bbhome-Mallory/.gnupg-mallory/openpgp-revocs.d/148BE52181473964247AAE12BEDC0B8A926F8656.rev'
gpg: keybox '/tmp/bbhome-Mallory/repo/.blackbox/pubring.kbx' created
gpg: /tmp/bbhome-Mallory/repo/.blackbox/trustdb.gpg: trustdb created
gpg: key BEDC0B8A926F8656: public key "mallory@example.com" imported
gpg: Total number processed: 1
gpg:               imported: 1
NEXT STEP: You need to manually check these in:
     git commit -m'NEW ADMIN: mallory@example.com' .blackbox/blackbox-admins.txt .blackbox/pubring.kbx .blackbox/trustdb.gpg
========== SHREDDING: "!important!.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: !important!.txt' -m'    * gitignore !important!.txt' -m'    * blackbox-files.txt add: !important!.txt' .gitignore .blackbox/blackbox-files.txt !important!.txt.gpg
========== DECRYPTING "!important!.txt"
========== ENCRYPTING "!important!.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: !important!.txt' !important!.txt.gpg
========== SHREDDING: "!important!.txt"
========== SHREDDING: "#andpounds.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: #andpounds.txt' -m'    * gitignore #andpounds.txt' -m'    * blackbox-files.txt add: #andpounds.txt' .gitignore .blackbox/blackbox-files.txt #andpounds.txt.gpg
========== DECRYPTING "#andpounds.txt"
========== ENCRYPTING "#andpounds.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: #andpounds.txt' #andpounds.txt.gpg
========== SHREDDING: "#andpounds.txt"
========== SHREDDING: "stars*bars?.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: stars*bars?.txt' -m'    * gitignore stars*bars?.txt' -m'    * blackbox-files.txt add: stars*bars?.txt' .gitignore .blackbox/blackbox-files.txt stars*bars?.txt.gpg
========== DECRYPTING "stars*bars?.txt"
========== ENCRYPTING "stars*bars?.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: stars*bars?.txt' stars*bars?.txt.gpg
========== SHREDDING: "stars*bars?.txt"
========== SHREDDING: "space space.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: "space space.txt"' -m'    * gitignore "space space.txt"' -m'    * blackbox-files.txt add: "space space.txt"' .gitignore .blackbox/blackbox-files.txt "space space.txt.gpg"
========== DECRYPTING "space space.txt"
========== ENCRYPTING "space space.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: "space space.txt"' "space space.txt.gpg"
========== SHREDDING: "space space.txt"
========== SHREDDING: "tab\ttab.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: "tabXtab.txt"(redacted)' -m'    * gitignore "tabXtab.txt"(redacted)' -m'    * blackbox-files.txt add: "tabXtab.txt"(redacted)' .gitignore .blackbox/blackbox-files.txt "tabXtab.txt.gpg"(redacted)
========== DECRYPTING "tab\ttab.txt"
========== ENCRYPTING "tab\ttab.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: "tabXtab.txt"(redacted)' "tabXtab.txt.gpg"(redacted)
========== SHREDDING: "tab\ttab.txt"
========== SHREDDING: "ret\rret.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: "retXret.txt"(redacted)' -m'    * gitignore "retXret.txt"(redacted)' -m'    * blackbox-files.txt add: "retXret.txt"(redacted)' .gitignore .blackbox/blackbox-files.txt "retXret.txt.gpg"(redacted)
========== DECRYPTING "ret\rret.txt"
========== ENCRYPTING "ret\rret.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: "retXret.txt"(redacted)' "retXret.txt.gpg"(redacted)
========== SHREDDING: "ret\rret.txt"
========== SHREDDING: "smile😁eyes"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: smile😁eyes' -m'    * gitignore smile😁eyes' -m'    * blackbox-files.txt add: smile😁eyes' .gitignore .blackbox/blackbox-files.txt smile😁eyes.gpg
========== DECRYPTING "smile😁eyes"
========== ENCRYPTING "smile😁eyes"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: smile😁eyes' smile😁eyes.gpg
========== SHREDDING: "smile😁eyes"
========== SHREDDING: "¡que!"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: ¡que!' -m'    * gitignore ¡que!' -m'    * blackbox-files.txt add: ¡que!' .gitignore .blackbox/blackbox-files.txt ¡que!.gpg
========== DECRYPTING "¡que!"
========== ENCRYPTING "¡que!"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: ¡que!' ¡que!.gpg
========== SHREDDING: "¡que!"
========== SHREDDING: "thé"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: thé' -m'    * gitignore thé' -m'    * blackbox-files.txt add: thé' .gitignore .blackbox/blackbox-files.txt thé.gpg
========== DECRYPTING "thé"
========== ENCRYPTING "thé"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: thé' thé.gpg
========== SHREDDING: "thé"
========== SHREDDING: "pound£"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: pound£' -m'    * gitignore pound£' -m'    * blackbox-files.txt add: pound£' .gitignore .blackbox/blackbox-files.txt pound£.gpg
========== DECRYPTING "pound£"
========== ENCRYPTING "pound£"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: pound£' pound£.gpg
========== SHREDDING: "pound£"
========== SHREDDING: "*.go"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: *.go' -m'    * gitignore *.go' -m'    * blackbox-files.txt add: *.go' .gitignore .blackbox/blackbox-files.txt *.go.gpg
========== DECRYPTING "*.go"
========== ENCRYPTING "*.go"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: *.go' *.go.gpg
========== SHREDDING: "*.go"
========== SHREDDING: "rm -f erase ; echo done"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: "rm -f erase ; echo done"' -m'    * gitignore "rm -f erase ; echo done"' -m'    * blackbox-files.txt add: "rm -f erase ; echo done"' .gitignore .blackbox/blackbox-files.txt "rm -f erase ; echo done.gpg"
========== DECRYPTING "rm -f erase ; echo done"
========== ENCRYPTING "rm -f erase ; echo done"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: "rm -f erase ; echo done"' "rm -f erase ; echo done.gpg"
========== SHREDDING: "rm -f erase ; echo done"
========== SHREDDING: "smile☺"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: smile☺' -m'    * gitignore smile☺' -m'    * blackbox-files.txt add: smile☺' .gitignore .blackbox/blackbox-files.txt smile☺.gpg
========== DECRYPTING "smile☺"
========== ENCRYPTING "smile☺"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: smile☺' smile☺.gpg
========== SHREDDING: "smile☺"
========== SHREDDING: "dub𝓦"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: dub𝓦' -m'    * gitignore dub𝓦' -m'    * blackbox-files.txt add: dub𝓦' .gitignore .blackbox/blackbox-files.txt dub𝓦.gpg
========== DECRYPTING "dub𝓦"
========== ENCRYPTING "dub𝓦"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: dub𝓦' dub𝓦.gpg
========== SHREDDING: "dub𝓦"
========== SHREDDING: "my/path/to/relsecrets.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'BLACKBOX ADD FILE: my/path/to/relsecrets.txt' -m'    * gitignore my/path/to/relsecrets.txt' -m'    * blackbox-files.txt add: my/path/to/relsecrets.txt' .gitignore .blackbox/blackbox-files.txt my/path/to/relsecrets.txt.gpg
========== DECRYPTING "my/path/to/relsecrets.txt"
========== ENCRYPTING "my/path/to/relsecrets.txt"
NEXT STEP: You need to manually check these in:
     git commit -m'ENCRYPTED: my/path/to/relsecrets.txt' my/path/to/relsecrets.txt.gpg
========== SHREDDING: "my/path/to/relsecrets.txt"
FAIL
exit status 1
FAIL	github.com/StackExchange/blackbox/v2/integrationTest	6.451s
Error: Process completed with exit code 1.

@tlimoncelli
Copy link
Contributor

I think that failed test would work if we run umask 0027 before the test, or if GHA supports setting the umask to 0027 some other way.

Their default is probably 0022, because I can reproduce the issue thusly:

tlimwork4:~/git/blackbox/integrationTest$ umask 0022 ; rm -rf /tmp/bbhome-* && go test -long -nocleanup | head -10
========== Compiling
VCS root is: ""
team is: ""
configdir will be: ".blackbox"
--- FAIL: TestInit (0.42s)
    integration_test.go:77: got=0644 want=0640: .blackbox/blackbox-admins.txt
VCS root is: ""
team is: ""
configdir will be: ".blackbox"
VCS root is: ""

In my dev environment I use umask 0027 because I'm paranoid:

tlimwork4:~/git/blackbox/integrationTest$ umask 0027 ; rm -rf /tmp/bbhome-* && go test -long -nocleanup | head -10
========== Compiling
VCS root is: ""
team is: ""
configdir will be: ".blackbox"
VCS root is: ""
team is: ""
configdir will be: ".blackbox"
VCS root is: ""
team is: ""
configdir will be: ".blackbox"

@MaxHorstmann
Copy link
Contributor Author

@MaxHorstmann MaxHorstmann marked this pull request as ready for review November 13, 2020 13:46
@MaxHorstmann MaxHorstmann merged commit 2c0c8ce into master Nov 13, 2020
@MaxHorstmann MaxHorstmann deleted the builds branch November 13, 2020 15:01
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.

None yet

2 participants