get.pme.sh/pnats@v0.0.0-20240304004023-26bb5a137ed0/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" = "js_tests" ]; then
    27  
    28      # Run JetStream non-clustered tests. By convention, all JS tests start
    29      # with `TestJetStream`. We exclude the clustered and super-clustered
    30      # tests by using the appropriate tags.
    31  
    32      go test -race -v -run=TestJetStream ./server -tags=skip_js_cluster_tests,skip_js_cluster_tests_2,skip_js_cluster_tests_3,skip_js_super_cluster_tests -count=1 -vet=off -timeout=30m -failfast
    33  
    34  elif [ "$1" = "js_cluster_tests_1" ]; then
    35  
    36      # Run JetStream clustered tests. By convention, all JS cluster tests
    37      # start with `TestJetStreamCluster`. Will run the first batch of tests,
    38      # excluding others with use of proper tags.
    39  
    40      go test -race -v -run=TestJetStreamCluster ./server -tags=skip_js_cluster_tests_2,skip_js_cluster_tests_3 -count=1 -vet=off -timeout=30m -failfast
    41  
    42  elif [ "$1" = "js_cluster_tests_2" ]; then
    43  
    44      # Run JetStream clustered tests. By convention, all JS cluster tests
    45      # start with `TestJetStreamCluster`. Will run the second batch of tests,
    46      # excluding others with use of proper tags.
    47  
    48      go test -race -v -run=TestJetStreamCluster ./server -tags=skip_js_cluster_tests,skip_js_cluster_tests_3 -count=1 -vet=off -timeout=30m -failfast
    49  
    50  elif [ "$1" = "js_cluster_tests_3" ]; then
    51  
    52      # Run JetStream clustered tests. By convention, all JS cluster tests
    53      # start with `TestJetStreamCluster`. Will run the third batch of tests,
    54      # excluding others with use of proper tags.
    55      #
    56  
    57      go test -race -v -run=TestJetStreamCluster ./server -tags=skip_js_cluster_tests,skip_js_cluster_tests_2 -count=1 -vet=off -timeout=30m -failfast
    58  
    59  elif [ "$1" = "js_super_cluster_tests" ]; then
    60  
    61      # Run JetStream super clustered tests. By convention, all JS super cluster
    62      # tests start with `TestJetStreamSuperCluster`.
    63  
    64      go test -race -v -run=TestJetStreamSuperCluster ./server -count=1 -vet=off -timeout=30m -failfast
    65  
    66  elif [ "$1" = "js_chaos_tests" ]; then
    67  
    68      # Run JetStream chaos tests. By convention, all JS cluster chaos tests
    69      # start with `TestJetStreamChaos`.
    70  
    71      go test -race -v -p=1 -run=TestJetStreamChaos ./server -tags=js_chaos_tests -count=1 -vet=off -timeout=30m -failfast
    72  
    73  elif [ "$1" = "mqtt_tests" ]; then
    74  
    75      # Run MQTT tests. By convention, all MQTT tests start with `TestMQTT`.
    76  
    77      go test -race -v -run=TestMQTT ./server -count=1 -vet=off -timeout=30m -failfast
    78  
    79  elif [ "$1" = "srv_pkg_non_js_tests" ]; then
    80  
    81      # Run all non JetStream tests in the server package. We exclude the
    82      # JS tests by using the `skip_js_tests` build tag and MQTT tests by
    83      # using the `skip_mqtt_tests`
    84  
    85      go test -race -v -p=1 ./server/... -tags=skip_js_tests,skip_mqtt_tests -count=1 -vet=off -timeout=30m -failfast
    86  
    87  elif [ "$1" = "non_srv_pkg_tests" ]; then
    88  
    89      # Run all tests of all non server package.
    90  
    91      go test -race -v -p=1 $(go list ./... | grep -v "/server") -count=1 -vet=off -timeout=30m -failfast
    92  
    93  fi