Do not run integration tests by default.

This commit is contained in:
Timo Reimann 2017-10-13 11:08:03 +02:00 committed by Traefiker
parent 4d1285d8e5
commit 914f3d1fa3
3 changed files with 13 additions and 2 deletions

View file

@ -138,11 +138,13 @@ More: https://labix.org/gocheck
#### Method 2: `go` #### 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 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 ## Documentation
The [documentation site](http://docs.traefik.io/) is built with [mkdocs](http://mkdocs.org/) The [documentation site](http://docs.traefik.io/) is built with [mkdocs](http://mkdocs.org/)

View file

@ -3,6 +3,7 @@ package integration
import ( import (
"bytes" "bytes"
"flag"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net" "net"
@ -18,11 +19,19 @@ import (
checker "github.com/vdemeester/shakers" checker "github.com/vdemeester/shakers"
) )
var integration = flag.Bool("integration", false, "run integration tests")
func Test(t *testing.T) { func Test(t *testing.T) {
check.TestingT(t) check.TestingT(t)
} }
func init() { func init() {
flag.Parse()
if !*integration {
log.Info("Integration tests disabled.")
return
}
check.Suite(&AccessLogSuite{}) check.Suite(&AccessLogSuite{})
check.Suite(&AcmeSuite{}) check.Suite(&AcmeSuite{})
check.Suite(&ConstraintSuite{}) check.Suite(&ConstraintSuite{})

View file

@ -13,4 +13,4 @@ fi
cd integration cd integration
echo "Testing against…" echo "Testing against…"
docker version docker version
CGO_ENABLED=0 go test $TESTFLAGS CGO_ENABLED=0 go test -integration $TESTFLAGS