fix: KV flaky tests.

This commit is contained in:
Ludovic Fernandez 2020-02-10 15:48:06 +01:00 committed by GitHub
parent ea2d65f8bb
commit 97109db82b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 22 deletions

View file

@ -63,12 +63,6 @@ func (s *ConsulSuite) TestSimpleConfiguration(c *check.C) {
file := s.adaptFile(c, "fixtures/consul/simple.toml", struct{ ConsulAddress string }{address}) file := s.adaptFile(c, "fixtures/consul/simple.toml", struct{ ConsulAddress string }{address})
defer os.Remove(file) defer os.Remove(file)
cmd, display := s.traefikCmd(withConfigFile(file))
defer display(c)
err := cmd.Start()
c.Assert(err, checker.IsNil)
defer cmd.Process.Kill()
data := map[string]string{ data := map[string]string{
"traefik/http/routers/Router0/entryPoints/0": "web", "traefik/http/routers/Router0/entryPoints/0": "web",
"traefik/http/routers/Router0/middlewares/0": "compressor", "traefik/http/routers/Router0/middlewares/0": "compressor",
@ -120,8 +114,16 @@ func (s *ConsulSuite) TestSimpleConfiguration(c *check.C) {
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
} }
cmd, display := s.traefikCmd(withConfigFile(file))
defer display(c)
err := cmd.Start()
c.Assert(err, checker.IsNil)
defer cmd.Process.Kill()
// wait for traefik // wait for traefik
err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", time.Second, try.BodyContains("@consul")) err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 2*time.Second,
try.BodyContains(`"striper@consul":`, `"compressor@consul":`, `"srvcA@consul":`, `"srvcB@consul":`),
)
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
resp, err := http.Get("http://127.0.0.1:8080/api/rawdata") resp, err := http.Get("http://127.0.0.1:8080/api/rawdata")

View file

@ -63,12 +63,6 @@ func (s *EtcdSuite) TestSimpleConfiguration(c *check.C) {
file := s.adaptFile(c, "fixtures/etcd/simple.toml", struct{ EtcdAddress string }{address}) file := s.adaptFile(c, "fixtures/etcd/simple.toml", struct{ EtcdAddress string }{address})
defer os.Remove(file) defer os.Remove(file)
cmd, display := s.traefikCmd(withConfigFile(file))
defer display(c)
err := cmd.Start()
c.Assert(err, checker.IsNil)
defer cmd.Process.Kill()
data := map[string]string{ data := map[string]string{
"traefik/http/routers/Router0/entryPoints/0": "web", "traefik/http/routers/Router0/entryPoints/0": "web",
"traefik/http/routers/Router0/middlewares/0": "compressor", "traefik/http/routers/Router0/middlewares/0": "compressor",
@ -120,8 +114,16 @@ func (s *EtcdSuite) TestSimpleConfiguration(c *check.C) {
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
} }
cmd, display := s.traefikCmd(withConfigFile(file))
defer display(c)
err := cmd.Start()
c.Assert(err, checker.IsNil)
defer cmd.Process.Kill()
// wait for traefik // wait for traefik
err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", time.Second, try.BodyContains("@etcd")) err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 2*time.Second,
try.BodyContains(`"striper@etcd":`, `"compressor@etcd":`, `"srvcA@etcd":`, `"srvcB@etcd":`),
)
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
resp, err := http.Get("http://127.0.0.1:8080/api/rawdata") resp, err := http.Get("http://127.0.0.1:8080/api/rawdata")

View file

@ -63,12 +63,6 @@ func (s *RedisSuite) TestSimpleConfiguration(c *check.C) {
file := s.adaptFile(c, "fixtures/redis/simple.toml", struct{ RedisAddress string }{address}) file := s.adaptFile(c, "fixtures/redis/simple.toml", struct{ RedisAddress string }{address})
defer os.Remove(file) defer os.Remove(file)
cmd, display := s.traefikCmd(withConfigFile(file))
defer display(c)
err := cmd.Start()
c.Assert(err, checker.IsNil)
defer cmd.Process.Kill()
data := map[string]string{ data := map[string]string{
"traefik/http/routers/Router0/entryPoints/0": "web", "traefik/http/routers/Router0/entryPoints/0": "web",
"traefik/http/routers/Router0/middlewares/0": "compressor", "traefik/http/routers/Router0/middlewares/0": "compressor",
@ -120,8 +114,16 @@ func (s *RedisSuite) TestSimpleConfiguration(c *check.C) {
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
} }
cmd, display := s.traefikCmd(withConfigFile(file))
defer display(c)
err := cmd.Start()
c.Assert(err, checker.IsNil)
defer cmd.Process.Kill()
// wait for traefik // wait for traefik
err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", time.Second, try.BodyContains("@redis")) err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 2*time.Second,
try.BodyContains(`"striper@redis":`, `"compressor@redis":`, `"srvcA@redis":`, `"srvcB@redis":`),
)
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
resp, err := http.Get("http://127.0.0.1:8080/api/rawdata") resp, err := http.Get("http://127.0.0.1:8080/api/rawdata")

View file

@ -121,7 +121,9 @@ func (s *ZookeeperSuite) TestSimpleConfiguration(c *check.C) {
defer cmd.Process.Kill() defer cmd.Process.Kill()
// wait for traefik // wait for traefik
err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", time.Second, try.BodyContains("@zookeeper")) err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 2*time.Second,
try.BodyContains(`"striper@zookeeper":`, `"compressor@zookeeper":`, `"srvcA@zookeeper":`, `"srvcB@zookeeper":`),
)
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
resp, err := http.Get("http://127.0.0.1:8080/api/rawdata") resp, err := http.Get("http://127.0.0.1:8080/api/rawdata")