github.com/nats-io/nats-server/v2@v2.11.0-preview.2/scripts/runTestsOnTravis.sh (about) 1 #!/bin/sh 2 3 set -e 4 5 if [ "$1" = "compile" ]; then 6 # First check that NATS builds. 7 go build; 8 9 # Now run the linters. 10 go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.1; 11 golangci-lint run; 12 if [ "$TRAVIS_TAG" != "" ]; then 13 go test -race -v -run=TestVersionMatchesTag ./server -count=1 -vet=off 14 fi 15 16 elif [ "$1" = "build_only" ]; then 17 go build; 18 19 elif [ "$1" = "no_race_tests" ]; then 20 21 # Run tests without the `-race` flag. By convention, those tests start 22 # with `TestNoRace`. 23 24 go test -v -p=1 -run=TestNoRace ./... -count=1 -vet=off -timeout=30m -failfast 25 26 elif [ "$1" = "store_tests" ]; then 27 28 # Run store tests. By convention, all file store tests start with `TestFileStore`, 29 # and memory store tests start with `TestMemStore`. 30 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 34 35 elif [ "$1" = "js_tests" ]; then 36 37 # Run JetStream non-clustered tests. By convention, all JS tests start 38 # with `TestJetStream`. We exclude the clustered and super-clustered 39 # tests by using the appropriate tags. 40 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 42 43 elif [ "$1" = "js_cluster_tests_1" ]; then 44 45 # Run JetStream clustered tests. By convention, all JS cluster tests 46 # start with `TestJetStreamCluster`. Will run the first batch of tests, 47 # excluding others with use of proper tags. 48 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 50 51 elif [ "$1" = "js_cluster_tests_2" ]; then 52 53 # Run JetStream clustered tests. By convention, all JS cluster tests 54 # start with `TestJetStreamCluster`. Will run the second batch of tests, 55 # excluding others with use of proper tags. 56 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 58 59 elif [ "$1" = "js_cluster_tests_3" ]; then 60 61 # Run JetStream clustered tests. By convention, all JS cluster tests 62 # start with `TestJetStreamCluster`. Will run the third batch of tests, 63 # excluding others with use of proper tags. 64 # 65 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 67 68 elif [ "$1" = "js_cluster_tests_4" ]; then 69 70 # Run JetStream clustered tests. By convention, all JS cluster tests 71 # start with `TestJetStreamCluster`. Will run the third batch of tests, 72 # excluding others with use of proper tags. 73 # 74 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 76 77 elif [ "$1" = "js_super_cluster_tests" ]; then 78 79 # Run JetStream super clustered tests. By convention, all JS super cluster 80 # tests start with `TestJetStreamSuperCluster`. 81 82 go test -race -v -run=TestJetStreamSuperCluster ./server -count=1 -vet=off -timeout=30m -failfast 83 84 elif [ "$1" = "js_chaos_tests" ]; then 85 86 # Run JetStream chaos tests. By convention, all JS cluster chaos tests 87 # start with `TestJetStreamChaos`. 88 89 go test -race -v -p=1 -run=TestJetStreamChaos ./server -tags=js_chaos_tests -count=1 -vet=off -timeout=30m -failfast 90 91 elif [ "$1" = "mqtt_tests" ]; then 92 93 # Run MQTT tests. By convention, all MQTT tests start with `TestMQTT`. 94 95 go test -race -v -run=TestMQTT ./server -count=1 -vet=off -timeout=30m -failfast 96 97 elif [ "$1" = "msgtrace_tests" ]; then 98 99 # Run Message Tracing tests. By convention, all message tracing tests start with `TestMsgTrace`. 100 101 go test -race -v -run=TestMsgTrace ./server -count=1 -vet=off -timeout=30m -failfast 102 103 elif [ "$1" = "srv_pkg_non_js_tests" ]; then 104 105 # Run all non JetStream tests in the server package. We exclude the 106 # store tests by using the `skip_store_tests` build tag, the JS tests 107 # by using `skip_js_tests`, MQTT tests by using `skip_mqtt_tests` and 108 # message tracing tests by using `skip_msgtrace_tests`. 109 110 go test -race -v -p=1 ./server/... -tags=skip_store_tests,skip_js_tests,skip_mqtt_tests,skip_msgtrace_tests -count=1 -vet=off -timeout=30m -failfast 111 112 elif [ "$1" = "non_srv_pkg_tests" ]; then 113 114 # Run all tests of all non server package. 115 116 go test -race -v -p=1 $(go list ./... | grep -v "/server") -count=1 -vet=off -timeout=30m -failfast 117 118 fi