fixup tests

This commit is contained in:
Ethan Buchman 2017-11-27 19:52:06 +00:00
parent c7f54fb56c
commit fb612e5a7b
6 changed files with 29 additions and 14 deletions

View File

@ -36,12 +36,18 @@ dist:
@ bash scripts/publish.sh
# test.sh requires that we run the installed cmds, must not be out of date
test: install
test:
@ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
@ echo "==> Running unit tests"
@ echo "==> Running go test"
@ go test $(PACKAGES)
@ echo "==> Running integration tests (./tests)"
@ bash tests/test.sh
test_race:
@ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
@ echo "==> Running go test --race"
@go test -v -race $(PACKAGES)
test_integrations:
@ bash test.sh
fmt:
@ go fmt ./...

View File

@ -16,7 +16,7 @@ checkout:
test:
override:
- cd $REPO && make get_vendor_deps && make metalinter_test && bash ./test.sh
- cd $REPO && make get_vendor_deps && make metalinter_test && make test_integrations
post:
- cd "$REPO" && bash <(curl -s https://codecov.io/bash) -f coverage.txt
- cd "$REPO" && mv coverage.txt "${CIRCLE_ARTIFACTS}"

View File

@ -96,10 +96,10 @@ var RootCmd = &cobra.Command{
},
}
func Execute() {
func Execute() error {
addGlobalFlags()
addCommands()
RootCmd.Execute()
return RootCmd.Execute()
}
func addGlobalFlags() {

View File

@ -1,5 +1,14 @@
package main
import (
"fmt"
"os"
)
func main() {
Execute()
err := Execute()
if err != nil {
fmt.Print(err)
os.Exit(1)
}
}

10
test.sh
View File

@ -5,11 +5,11 @@ echo "" > coverage.txt
echo "==> Running unit tests"
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 >> coverage.txt
rm profile.out
fi
go test -race -coverprofile=profile.out -covermode=atomic "$d"
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done
echo "==> Running integration tests (./tests)"

View File

@ -48,7 +48,7 @@ func startClient(abciType string) abcicli.Client {
}
func setOption(client abcicli.Client, key, value string) {
_, err := client.SetOptionSync(key, value)
_, err := client.SetOptionSync(types.RequestSetOption{key, value})
if err != nil {
panicf("setting %v=%v: \nerr: %v", key, value, err)
}