Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
clean way of skipping expensive and integration tests. fix #1155
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieterbe committed Nov 28, 2018
1 parent 9bc5f2c commit c6c6ec2
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
default:
$(MAKE) all
test:
CGO_ENABLED=1 go test -race $(shell go list ./... | grep -v stacktest)
CGO_ENABLED=1 go test -race -short ./...
test-all:
CGO_ENABLED=1 go test -race ./...
check:
$(MAKE) test
bin:
Expand Down
3 changes: 2 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Thanks for your interest in contributing to metrictank!

* `make bin`: for building all binaries.
* `make docker`: for building docker image (after building binaries)
* `make test`: unit tests
* `make test`: unit tests minus expensive integration tests
* `make test-all`: unit tests including expensive integration tests
* `make qa`: run all QA (code quality) tests, same as CirceCI qa checks except CI also runs stack tests.

see the [Makefile](../Makefile) for more targets
Expand Down
9 changes: 9 additions & 0 deletions idx/cassandra/cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ func TestFind(t *testing.T) {
}

func BenchmarkIndexing(b *testing.B) {
if testing.Short() {
b.Skip("skipping benchmark in short mode")
}
cluster.Manager.SetPartitions([]int32{1})
keyspace = "metrictank"
hosts = "localhost:9042"
Expand Down Expand Up @@ -467,6 +470,9 @@ func insertDefs(ix idx.MetricIndex, i int) {
}

func BenchmarkLoad(b *testing.B) {
if testing.Short() {
b.Skip("skipping benchmark in short mode")
}
cluster.Manager.SetPartitions([]int32{1})
keyspace = "metrictank"
hosts = "localhost:9042"
Expand Down Expand Up @@ -500,6 +506,9 @@ func BenchmarkLoad(b *testing.B) {
}

func BenchmarkIndexingWithUpdates(b *testing.B) {
if testing.Short() {
b.Skip("skipping benchmark in short mode")
}
cluster.Manager.SetPartitions([]int32{1})
keyspace = "metrictank"
hosts = "localhost:9042"
Expand Down
6 changes: 6 additions & 0 deletions stacktest/tests/chaos_cluster/chaos_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package chaos_cluster

import (
"context"
"flag"
"fmt"
"os"
"os/exec"
Expand Down Expand Up @@ -33,6 +34,11 @@ func init() {
log.SetLevel(log.InfoLevel)
}
func TestMain(m *testing.M) {
flag.Parse()
if testing.Short() {
fmt.Println("skipping test in short mode")
return
}
ctx, cancelFunc := context.WithCancel(context.Background())

fmt.Println("stopping docker-chaos stack should it be running...")
Expand Down
7 changes: 7 additions & 0 deletions stacktest/tests/end2end_carbon/end2end_carbon_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package end2end_carbon

import (
"flag"
"fmt"
"os"
"os/exec"
"syscall"
Expand Down Expand Up @@ -31,6 +33,11 @@ func init() {
log.SetLevel(log.InfoLevel)
}
func TestMain(m *testing.M) {
flag.Parse()
if testing.Short() {
fmt.Println("skipping test in short mode")
return
}
log.Println("launching docker-dev stack...")
version := exec.Command("docker-compose", "version")
output, err := version.CombinedOutput()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package end2end_carbon_bigtable

import (
"flag"
"fmt"
"os"
"os/exec"
"syscall"
Expand Down Expand Up @@ -31,6 +33,11 @@ func init() {
log.SetLevel(log.InfoLevel)
}
func TestMain(m *testing.M) {
flag.Parse()
if testing.Short() {
fmt.Println("skipping test in short mode")
return
}
log.Println("launching docker-dev-bigtable stack...")
version := exec.Command("docker-compose", "version")
output, err := version.CombinedOutput()
Expand Down

0 comments on commit c6c6ec2

Please sign in to comment.