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

Add unit tests for command output #140

Merged
merged 5 commits into from
Mar 16, 2018
Merged

Add unit tests for command output #140

merged 5 commits into from
Mar 16, 2018

Conversation

edaniszewski
Copy link
Contributor

related to #72
fixes #122

This PR adds in unit tests for checking the output of the CLI commands.

Copy link
Contributor

@timfallmk timfallmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions, but otherwise awesomesaucen.

@@ -31,7 +31,7 @@ jobs:
name: "Installing Vendored Dependencies"
command: |
go get -v github.com/golang/dep/cmd/dep
go install github.com/golang/dep/cmd/dep
CGO_ENABLED=0 go install github.com/golang/dep/cmd/dep
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this a specific flag you needed for building dep?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yuup. from: https://circleci.com/gh/vapor-ware/synse-cli/345?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link

../../../../../usr/local/go/src/net/lookup_unix.go:107:23:warning: undeclared name: cgoLookupPort (interfacer)
../../../../../usr/local/go/src/net/lookup_unix.go:95:24:warning: undeclared name: cgoLookupIP (interfacer)
../../../../../usr/local/go/src/net/lookup_unix.go:80:24:warning: undeclared name: cgoLookupHost (interfacer)
../../../../../usr/local/go/src/net/lookup_unix.go:190:23:warning: undeclared name: cgoLookupPTR (interfacer)
../../../../../usr/local/go/src/net/lookup_unix.go:123:24:warning: undeclared name: cgoLookupCNAME (interfacer)

after doing some searching, that brought me to: alecthomas/gometalinter#149 (comment)

but I looked at the golang:latest which is being used in CI - it should have gcc installed, so I tried adding this flag and voilà, it worked!

for d in $(go list ./... | grep -v vendor); do
go test -race -coverprofile=profile.out -covermode=atomic ${d}
if [ -f profile.out ]; then
cat profile.out | awk '{if(NR>1)print}' >> coverage.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might already be the case, but lets see if the coverage report can be in a format and placed in the right place for Circle to parse and display.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good thinking. I was gonna look into how to do coverage reporting for Go at some point so we could also get a coverage badge on the repo or something.

@edaniszewski edaniszewski merged commit 1d3c893 into master Mar 16, 2018
@edaniszewski edaniszewski deleted the tests branch March 16, 2018 13:51
@timfallmk timfallmk restored the tests branch March 20, 2018 18:40
@timfallmk timfallmk deleted the tests branch March 20, 2018 18:40
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.

add test helpers / tests for command output
2 participants