mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Changes to tests that run on Travis
- Remove code coverage from Travis and add it to a GitHub Action that will be run as a nightly. - Use tag builds to exclude some tests, such as the "norace" or JS tests. Since "go test" does not support "negative" regexs, there is no other way. Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
@@ -1,23 +1,26 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
# Run from directory above via ./scripts/cov.sh
|
||||
|
||||
# Do not set the -e flag because we don't a flapper to prevent the push to coverall.
|
||||
|
||||
export GO111MODULE="on"
|
||||
|
||||
go get github.com/mattn/goveralls
|
||||
go get github.com/wadey/gocovmerge
|
||||
go install github.com/wadey/gocovmerge@latest
|
||||
|
||||
rm -rf ./cov
|
||||
mkdir cov
|
||||
go test -v -failfast -covermode=atomic -coverprofile=./cov/conf.out -run='Test[^NoRace]' ./conf -timeout=20m
|
||||
go test -v -failfast -covermode=atomic -coverprofile=./cov/log.out -run='Test[^NoRace]' ./logger -timeout=20m
|
||||
go test -v -failfast -covermode=atomic -coverprofile=./cov/server.out -run='Test[^NoRace]' ./server -timeout=20m
|
||||
go test -v -failfast -covermode=atomic -coverprofile=./cov/test.out -coverpkg=./server -run='Test[^NoRace]' ./test -timeout=20m
|
||||
# Since it is difficult to get a full run without a flapper, do not use `-failfast`.
|
||||
# It is better to have one flapper or two and still get the report than have
|
||||
# to re-run the whole code coverage. One or two failed tests should not affect
|
||||
# so much the code coverage.
|
||||
go test -v -covermode=atomic -coverprofile=./cov/conf.out ./conf -timeout=20m -tags=skip_no_race_tests
|
||||
go test -v -covermode=atomic -coverprofile=./cov/log.out ./logger -timeout=20m -tags=skip_no_race_tests
|
||||
go test -v -covermode=atomic -coverprofile=./cov/server.out ./server -timeout=20m -tags=skip_no_race_tests
|
||||
go test -v -covermode=atomic -coverprofile=./cov/test.out -coverpkg=./server ./test -timeout=20m -tags=skip_no_race_tests
|
||||
gocovmerge ./cov/*.out > acc.out
|
||||
rm -rf ./cov
|
||||
|
||||
# Without argument, launch browser results. We are going to push to coveralls only
|
||||
# from Travis.yml and after success of the build (and result of pushing will not affect
|
||||
# build result).
|
||||
# If no argument passed, launch a browser to see the results.
|
||||
if [[ $1 == "" ]]; then
|
||||
go tool cover -html=acc.out
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user