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

clean way of skipping expensive and integration tests. fix #1155 #1156

Merged
merged 3 commits into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 excluding expensive integration tests (faster)
* `make test-all`: unit tests including expensive integration tests (slower)
* `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 " + b.Name() + " 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 " + b.Name() + " 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 " + b.Name() + " 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 chaos cluster 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 end2end carbon test (cassandra) 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 end2end carbon test (bigtable) in short mode")
return
}
log.Println("launching docker-dev-bigtable stack...")
version := exec.Command("docker-compose", "version")
output, err := version.CombinedOutput()
Expand Down