11#! /bin/sh
22
3- set -e
3+ set -ex
44
55if [ " $1 " = " compile" ]; then
66 # First check that NATS builds.
7- go build;
7+ go build -v ;
88
99 # Now run the linters.
1010 go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.4;
1111 golangci-lint run;
1212 if [ " $TRAVIS_TAG " != " " ]; then
13- go test -race - v -run=TestVersionMatchesTag ./server -ldflags=" -X=github.com/nats-io/nats-server/v2/server.serverVersion=$TRAVIS_TAG " -count=1 -vet=off
13+ go test -v -run=TestVersionMatchesTag ./server -ldflags=" -X=github.com/nats-io/nats-server/v2/server.serverVersion=$TRAVIS_TAG " -count=1 -vet=off
1414 fi
1515
1616elif [ " $1 " = " build_only" ]; then
17- go build;
17+ go build -v ;
1818
1919elif [ " $1 " = " no_race_tests" ]; then
2020
@@ -28,33 +28,31 @@ elif [ "$1" = "store_tests" ]; then
2828 # Run store tests. By convention, all file store tests start with `TestFileStore`,
2929 # and memory store tests start with `TestMemStore`.
3030
31- go test -race -v -run=TestMemStore ./server -count=1 -vet=off -timeout=30m -failfast
32- go test -race -v -run=TestFileStore ./server -count=1 -vet=off -timeout=30m -failfast
33- go test -race -v -run=TestStore ./server -count=1 -vet=off -timeout=30m -failfast
31+ go test $RACE -v -p=1 -run=Test\( Store\| FileStore\| MemStore\) ./server -count=1 -vet=off -timeout=30m -failfast
3432
3533elif [ " $1 " = " js_tests" ]; then
3634
3735 # Run JetStream non-clustered tests. By convention, all JS tests start
3836 # with `TestJetStream`. We exclude the clustered and super-clustered
3937 # tests by using the appropriate tags.
4038
41- go test -race -v -run=TestJetStream ./server -tags=skip_js_cluster_tests,skip_js_cluster_tests_2,skip_js_cluster_tests_3,skip_js_cluster_tests_4,skip_js_super_cluster_tests -count=1 -vet=off -timeout=30m -failfast
39+ go test $RACE -v -p=1 -run=TestJetStream ./server -tags=skip_js_cluster_tests,skip_js_cluster_tests_2,skip_js_cluster_tests_3,skip_js_cluster_tests_4,skip_js_super_cluster_tests -count=1 -vet=off -timeout=30m -failfast
4240
4341elif [ " $1 " = " js_cluster_tests_1" ]; then
4442
4543 # Run JetStream clustered tests. By convention, all JS cluster tests
4644 # start with `TestJetStreamCluster`. Will run the first batch of tests,
4745 # excluding others with use of proper tags.
4846
49- go test -race -v -run=TestJetStreamCluster ./server -tags=skip_js_cluster_tests_2,skip_js_cluster_tests_3,skip_js_cluster_tests_4 -count=1 -vet=off -timeout=30m -failfast
47+ go test $RACE -v -p=1 -run=TestJetStreamCluster ./server -tags=skip_js_cluster_tests_2,skip_js_cluster_tests_3,skip_js_cluster_tests_4 -count=1 -vet=off -timeout=30m -failfast
5048
5149elif [ " $1 " = " js_cluster_tests_2" ]; then
5250
5351 # Run JetStream clustered tests. By convention, all JS cluster tests
5452 # start with `TestJetStreamCluster`. Will run the second batch of tests,
5553 # excluding others with use of proper tags.
5654
57- go test -race -v -run=TestJetStreamCluster ./server -tags=skip_js_cluster_tests,skip_js_cluster_tests_3,skip_js_cluster_tests_4 -count=1 -vet=off -timeout=30m -failfast
55+ go test $RACE -v -p=1 -run=TestJetStreamCluster ./server -tags=skip_js_cluster_tests,skip_js_cluster_tests_3,skip_js_cluster_tests_4 -count=1 -vet=off -timeout=30m -failfast
5856
5957elif [ " $1 " = " js_cluster_tests_3" ]; then
6058
@@ -63,7 +61,7 @@ elif [ "$1" = "js_cluster_tests_3" ]; then
6361 # excluding others with use of proper tags.
6462 #
6563
66- go test -race -v -run=TestJetStreamCluster ./server -tags=skip_js_cluster_tests,skip_js_cluster_tests_2,skip_js_cluster_tests_4 -count=1 -vet=off -timeout=30m -failfast
64+ go test $RACE -v -p=1 -run=TestJetStreamCluster ./server -tags=skip_js_cluster_tests,skip_js_cluster_tests_2,skip_js_cluster_tests_4 -count=1 -vet=off -timeout=30m -failfast
6765
6866elif [ " $1 " = " js_cluster_tests_4" ]; then
6967
@@ -72,26 +70,26 @@ elif [ "$1" = "js_cluster_tests_4" ]; then
7270 # excluding others with use of proper tags.
7371 #
7472
75- go test -race -v -run=TestJetStreamCluster ./server -tags=skip_js_cluster_tests,skip_js_cluster_tests_2,skip_js_cluster_tests_3 -count=1 -vet=off -timeout=30m -failfast
73+ go test $RACE -v -p=1 -run=TestJetStreamCluster ./server -tags=skip_js_cluster_tests,skip_js_cluster_tests_2,skip_js_cluster_tests_3 -count=1 -vet=off -timeout=30m -failfast
7674
7775elif [ " $1 " = " js_super_cluster_tests" ]; then
7876
7977 # Run JetStream super clustered tests. By convention, all JS super cluster
8078 # tests start with `TestJetStreamSuperCluster`.
8179
82- go test -race -v -run=TestJetStreamSuperCluster ./server -count=1 -vet=off -timeout=30m -failfast
80+ go test $RACE -v -p=1 -run=TestJetStreamSuperCluster ./server -count=1 -vet=off -timeout=30m -failfast
8381
8482elif [ " $1 " = " mqtt_tests" ]; then
8583
8684 # Run MQTT tests. By convention, all MQTT tests start with `TestMQTT`.
8785
88- go test -race -v -run=TestMQTT ./server -count=1 -vet=off -timeout=30m -failfast
86+ go test $RACE -v -p=1 -run=TestMQTT ./server -count=1 -vet=off -timeout=30m -failfast
8987
9088elif [ " $1 " = " msgtrace_tests" ]; then
9189
9290 # Run Message Tracing tests. By convention, all message tracing tests start with `TestMsgTrace`.
9391
94- go test -race -v -run=TestMsgTrace ./server -count=1 -vet=off -timeout=30m -failfast
92+ go test $RACE -v -p=1 -run=TestMsgTrace ./server -count=1 -vet=off -timeout=30m -failfast
9593
9694elif [ " $1 " = " srv_pkg_non_js_tests" ]; then
9795
@@ -101,12 +99,12 @@ elif [ "$1" = "srv_pkg_non_js_tests" ]; then
10199 # message tracing tests by using `skip_msgtrace_tests`.
102100
103101 # Also including the ldflag with the version since this includes the `TestVersionMatchesTag`.
104- go test -race -v -p=1 ./server/... -ldflags=" -X=github.com/nats-io/nats-server/v2/server.serverVersion=$TRAVIS_TAG " -tags=skip_store_tests,skip_js_tests,skip_mqtt_tests,skip_msgtrace_tests -count=1 -vet=off -timeout=30m -failfast
102+ go test $RACE -v -p=1 ./server/... -ldflags=" -X=github.com/nats-io/nats-server/v2/server.serverVersion=$TRAVIS_TAG " -tags=skip_store_tests,skip_js_tests,skip_mqtt_tests,skip_msgtrace_tests,skip_no_race_tests -count=1 -vet=off -timeout=30m -failfast
105103
106104elif [ " $1 " = " non_srv_pkg_tests" ]; then
107105
108106 # Run all tests of all non server package.
109107
110- go test -race -v -p=1 $( go list ./... | grep -v " /server" ) -count=1 -vet=off -timeout=30m -failfast
108+ go test $RACE -v -p=1 $( go list ./... | grep -v " /server" ) -count=1 -vet=off -timeout=30m -failfast
111109
112110fi
0 commit comments