diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9860dc4b4..a16e0ee26 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -138,11 +138,13 @@ More: https://labix.org/gocheck #### Method 2: `go` -- Tests can be run from the cloned directory, by `$ go test ./...` which should return `ok` similar to: +Unit tests can be run from the cloned directory by `$ go test ./...` which should return `ok` similar to: ``` ok _/home/user/go/src/github/containous/traefik 0.004s ``` +Integration tests must be run from the `integration/` directory and require the `-integration` switch to be passed like this: `$ cd integration && go test -integration ./...`. + ## Documentation The [documentation site](http://docs.traefik.io/) is built with [mkdocs](http://mkdocs.org/) diff --git a/integration/integration_test.go b/integration/integration_test.go index fe91ef9ea..3fe1f0bda 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -3,6 +3,7 @@ package integration import ( "bytes" + "flag" "fmt" "io/ioutil" "net" @@ -18,11 +19,19 @@ import ( checker "github.com/vdemeester/shakers" ) +var integration = flag.Bool("integration", false, "run integration tests") + func Test(t *testing.T) { check.TestingT(t) } func init() { + flag.Parse() + if !*integration { + log.Info("Integration tests disabled.") + return + } + check.Suite(&AccessLogSuite{}) check.Suite(&AcmeSuite{}) check.Suite(&ConstraintSuite{}) diff --git a/script/test-integration b/script/test-integration index 42f5aca8f..8245c821f 100755 --- a/script/test-integration +++ b/script/test-integration @@ -13,4 +13,4 @@ fi cd integration echo "Testing against…" docker version -CGO_ENABLED=0 go test $TESTFLAGS +CGO_ENABLED=0 go test -integration $TESTFLAGS