Enhance integration tests

* refactor: remove unused code.
* refactor: factorize Traefik cmd start.
* refactor(whitelist): minor change.
* refactor(accesslog): better use of checker.
* refactor(errorpages): factorize containers IP variables.
* refactor(integration): refactor cmdTraefikWithConfigFile.
This commit is contained in:
Ludovic Fernandez 2017-07-10 14:58:31 +02:00 committed by GitHub
parent bbb133d94c
commit 2e84b1e556
20 changed files with 109 additions and 231 deletions

View file

@ -3,7 +3,6 @@ package integration
import (
"fmt"
"net/http"
"os/exec"
"time"
"github.com/containous/traefik/integration/try"
@ -81,11 +80,11 @@ func (s *ConstraintSuite) deregisterService(name string, address string) error {
}
func (s *ConstraintSuite) TestMatchConstraintGlobal(c *check.C) {
cmd := exec.Command(traefikBinary,
cmd, _ := s.cmdTraefik(
withConfigFile("fixtures/consul_catalog/simple.toml"),
"--consulCatalog",
"--consulCatalog.endpoint="+s.consulIP+":8500",
"--consulCatalog.domain=consul.localhost",
"--configFile=fixtures/consul_catalog/simple.toml",
"--constraints=tag==api")
err := cmd.Start()
c.Assert(err, checker.IsNil)
@ -106,11 +105,11 @@ func (s *ConstraintSuite) TestMatchConstraintGlobal(c *check.C) {
}
func (s *ConstraintSuite) TestDoesNotMatchConstraintGlobal(c *check.C) {
cmd := exec.Command(traefikBinary,
cmd, _ := s.cmdTraefik(
withConfigFile("fixtures/consul_catalog/simple.toml"),
"--consulCatalog",
"--consulCatalog.endpoint="+s.consulIP+":8500",
"--consulCatalog.domain=consul.localhost",
"--configFile=fixtures/consul_catalog/simple.toml",
"--constraints=tag==api")
err := cmd.Start()
c.Assert(err, checker.IsNil)
@ -131,11 +130,11 @@ func (s *ConstraintSuite) TestDoesNotMatchConstraintGlobal(c *check.C) {
}
func (s *ConstraintSuite) TestMatchConstraintProvider(c *check.C) {
cmd := exec.Command(traefikBinary,
cmd, _ := s.cmdTraefik(
withConfigFile("fixtures/consul_catalog/simple.toml"),
"--consulCatalog",
"--consulCatalog.endpoint="+s.consulIP+":8500",
"--consulCatalog.domain=consul.localhost",
"--configFile=fixtures/consul_catalog/simple.toml",
"--consulCatalog.constraints=tag==api")
err := cmd.Start()
c.Assert(err, checker.IsNil)
@ -156,11 +155,11 @@ func (s *ConstraintSuite) TestMatchConstraintProvider(c *check.C) {
}
func (s *ConstraintSuite) TestDoesNotMatchConstraintProvider(c *check.C) {
cmd := exec.Command(traefikBinary,
cmd, _ := s.cmdTraefik(
withConfigFile("fixtures/consul_catalog/simple.toml"),
"--consulCatalog",
"--consulCatalog.endpoint="+s.consulIP+":8500",
"--consulCatalog.domain=consul.localhost",
"--configFile=fixtures/consul_catalog/simple.toml",
"--consulCatalog.constraints=tag==api")
err := cmd.Start()
c.Assert(err, checker.IsNil)
@ -181,11 +180,11 @@ func (s *ConstraintSuite) TestDoesNotMatchConstraintProvider(c *check.C) {
}
func (s *ConstraintSuite) TestMatchMultipleConstraint(c *check.C) {
cmd := exec.Command(traefikBinary,
cmd, _ := s.cmdTraefik(
withConfigFile("fixtures/consul_catalog/simple.toml"),
"--consulCatalog",
"--consulCatalog.endpoint="+s.consulIP+":8500",
"--consulCatalog.domain=consul.localhost",
"--configFile=fixtures/consul_catalog/simple.toml",
"--consulCatalog.constraints=tag==api",
"--constraints=tag!=us-*")
err := cmd.Start()
@ -207,11 +206,11 @@ func (s *ConstraintSuite) TestMatchMultipleConstraint(c *check.C) {
}
func (s *ConstraintSuite) TestDoesNotMatchMultipleConstraint(c *check.C) {
cmd := exec.Command(traefikBinary,
cmd, _ := s.cmdTraefik(
withConfigFile("fixtures/consul_catalog/simple.toml"),
"--consulCatalog",
"--consulCatalog.endpoint="+s.consulIP+":8500",
"--consulCatalog.domain=consul.localhost",
"--configFile=fixtures/consul_catalog/simple.toml",
"--consulCatalog.constraints=tag==api",
"--constraints=tag!=us-*")
err := cmd.Start()