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:
parent
bbb133d94c
commit
2e84b1e556
20 changed files with 109 additions and 231 deletions
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
@ -96,7 +95,7 @@ func (s *ConsulSuite) TestSimpleConfiguration(c *check.C) {
|
|||
file := s.adaptFile(c, "fixtures/consul/simple.toml", struct{ ConsulHost string }{consulHost})
|
||||
defer os.Remove(file)
|
||||
|
||||
cmd := exec.Command(traefikBinary, "--configFile="+file)
|
||||
cmd, _ := s.cmdTraefik(withConfigFile(file))
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
defer cmd.Process.Kill()
|
||||
|
@ -112,7 +111,7 @@ func (s *ConsulSuite) TestNominalConfiguration(c *check.C) {
|
|||
file := s.adaptFile(c, "fixtures/consul/simple.toml", struct{ ConsulHost string }{consulHost})
|
||||
defer os.Remove(file)
|
||||
|
||||
cmd := exec.Command(traefikBinary, "--configFile="+file)
|
||||
cmd, _ := s.cmdTraefik(withConfigFile(file))
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
defer cmd.Process.Kill()
|
||||
|
@ -211,7 +210,10 @@ func (s *ConsulSuite) TestGlobalConfiguration(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// start traefik
|
||||
cmd := exec.Command(traefikBinary, "--configFile=fixtures/simple_web.toml", "--consul", "--consul.endpoint="+consulHost+":8500")
|
||||
cmd, _ := s.cmdTraefik(
|
||||
withConfigFile("fixtures/simple_web.toml"),
|
||||
"--consul",
|
||||
"--consul.endpoint="+consulHost+":8500")
|
||||
|
||||
err = cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -295,8 +297,10 @@ func (s *ConsulSuite) skipTestGlobalConfigurationWithClientTLS(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// start traefik
|
||||
cmd := exec.Command(traefikBinary, "--configFile=fixtures/simple_web.toml",
|
||||
"--consul", "--consul.endpoint="+consulHost+":8585",
|
||||
cmd, _ := s.cmdTraefik(
|
||||
withConfigFile("fixtures/simple_web.toml"),
|
||||
"--consul",
|
||||
"--consul.endpoint="+consulHost+":8585",
|
||||
"--consul.tls.ca=resources/tls/ca.cert",
|
||||
"--consul.tls.cert=resources/tls/consul.cert",
|
||||
"--consul.tls.key=resources/tls/consul.key",
|
||||
|
@ -315,9 +319,9 @@ func (s *ConsulSuite) TestCommandStoreConfig(c *check.C) {
|
|||
s.setupConsul(c)
|
||||
consulHost := s.composeProject.Container(c, "consul").NetworkSettings.IPAddress
|
||||
|
||||
cmd := exec.Command(traefikBinary,
|
||||
cmd, _ := s.cmdTraefik(
|
||||
"storeconfig",
|
||||
"--configFile=fixtures/simple_web.toml",
|
||||
withConfigFile("fixtures/simple_web.toml"),
|
||||
"--consul.endpoint="+consulHost+":8500")
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue