Add routes priorities in integration tests

Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
Emile Vauge 2016-06-06 22:33:29 +02:00
parent f4cb4bb1b8
commit cc4fb64b34
No known key found for this signature in database
GPG key ID: D808B4C167352E59
6 changed files with 25 additions and 16 deletions

View file

@ -41,12 +41,3 @@ marathon:
MARATHON_ZK: zk://127.0.0.1:2181/marathon MARATHON_ZK: zk://127.0.0.1:2181/marathon
MARATHON_HOSTNAME: 127.0.0.1 MARATHON_HOSTNAME: 127.0.0.1
command: --event_subscriber http_callback command: --event_subscriber http_callback
traefik:
image: containous/traefik
command: -c /dev/null --web --logLevel=DEBUG --marathon --marathon.domain marathon.localhost --marathon.endpoint http://172.17.0.1:8080 --marathon.watch
ports:
- "8000:80"
- "8081:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock

View file

@ -26,6 +26,7 @@
"labels": { "labels": {
"traefik.weight": "1", "traefik.weight": "1",
"traefik.protocol": "http", "traefik.protocol": "http",
"traefik.frontend.rule" : "Host:test.marathon.localhost" "traefik.frontend.rule" : "Host:test.marathon.localhost",
"traefik.frontend.priority" : "10"
} }
} }

View file

@ -100,11 +100,13 @@ func (s *ConsulSuite) TestNominalConfiguration(c *check.C) {
frontend1 := map[string]string{ frontend1 := map[string]string{
"traefik/frontends/frontend1/backend": "backend2", "traefik/frontends/frontend1/backend": "backend2",
"traefik/frontends/frontend1/entrypoints": "http", "traefik/frontends/frontend1/entrypoints": "http",
"traefik/frontends/frontend1/priority": "1",
"traefik/frontends/frontend1/routes/test_1/rule": "Host:test.localhost", "traefik/frontends/frontend1/routes/test_1/rule": "Host:test.localhost",
} }
frontend2 := map[string]string{ frontend2 := map[string]string{
"traefik/frontends/frontend2/backend": "backend1", "traefik/frontends/frontend2/backend": "backend1",
"traefik/frontends/frontend2/entrypoints": "http", "traefik/frontends/frontend2/entrypoints": "http",
"traefik/frontends/frontend2/priority": "10",
"traefik/frontends/frontend2/routes/test_2/rule": "Path:/test", "traefik/frontends/frontend2/routes/test_2/rule": "Path:/test",
} }
for key, value := range backend1 { for key, value := range backend1 {

View file

@ -1,12 +1,11 @@
package main package main
import ( import (
"github.com/go-check/check"
"net/http" "net/http"
"os/exec" "os/exec"
"time" "time"
"github.com/go-check/check"
checker "github.com/vdemeester/shakers" checker "github.com/vdemeester/shakers"
"errors" "errors"
@ -104,11 +103,13 @@ func (s *EtcdSuite) TestNominalConfiguration(c *check.C) {
frontend1 := map[string]string{ frontend1 := map[string]string{
"/traefik/frontends/frontend1/backend": "backend2", "/traefik/frontends/frontend1/backend": "backend2",
"/traefik/frontends/frontend1/entrypoints": "http", "/traefik/frontends/frontend1/entrypoints": "http",
"/traefik/frontends/frontend1/priority": "1",
"/traefik/frontends/frontend1/routes/test_1/rule": "Host:test.localhost", "/traefik/frontends/frontend1/routes/test_1/rule": "Host:test.localhost",
} }
frontend2 := map[string]string{ frontend2 := map[string]string{
"/traefik/frontends/frontend2/backend": "backend1", "/traefik/frontends/frontend2/backend": "backend1",
"/traefik/frontends/frontend2/entrypoints": "http", "/traefik/frontends/frontend2/entrypoints": "http",
"/traefik/frontends/frontend2/priority": "10",
"/traefik/frontends/frontend2/routes/test_2/rule": "Path:/test", "/traefik/frontends/frontend2/routes/test_2/rule": "Path:/test",
} }
for key, value := range backend1 { for key, value := range backend1 {

View file

@ -15,6 +15,19 @@ type MarathonSuite struct{ BaseSuite }
func (s *MarathonSuite) SetUpSuite(c *check.C) { func (s *MarathonSuite) SetUpSuite(c *check.C) {
s.createComposeProject(c, "marathon") s.createComposeProject(c, "marathon")
s.composeProject.Start(c)
// wait for marathon
// err := utils.TryRequest("http://127.0.0.1:8080/ping", 60*time.Second, func(res *http.Response) error {
// body, err := ioutil.ReadAll(res.Body)
// if err != nil {
// return err
// }
// if !strings.Contains(string(body), "ping") {
// return errors.New("Incorrect marathon config")
// }
// return nil
// })
// c.Assert(err, checker.IsNil)
} }
func (s *MarathonSuite) TestSimpleConfiguration(c *check.C) { func (s *MarathonSuite) TestSimpleConfiguration(c *check.C) {

View file

@ -6,7 +6,7 @@ zk:
ZK_ID: " 1" ZK_ID: " 1"
master: master:
image: mesosphere/mesos-master:0.23.0-1.0.ubuntu1404 image: mesosphere/mesos-master:0.28.1-2.0.20.ubuntu1404
net: host net: host
environment: environment:
MESOS_ZK: zk://127.0.0.1:2181/mesos MESOS_ZK: zk://127.0.0.1:2181/mesos
@ -17,7 +17,7 @@ master:
MESOS_WORK_DIR: /var/lib/mesos MESOS_WORK_DIR: /var/lib/mesos
slave: slave:
image: mesosphere/mesos-slave:0.23.0-1.0.ubuntu1404 image: mesosphere/mesos-slave:0.28.1-2.0.20.ubuntu1404
net: host net: host
pid: host pid: host
privileged: true privileged: true
@ -31,12 +31,13 @@ slave:
- /usr/bin/docker:/usr/bin/docker:ro - /usr/bin/docker:/usr/bin/docker:ro
- /usr/lib/x86_64-linux-gnu/libapparmor.so.1:/usr/lib/x86_64-linux-gnu/libapparmor.so.1:ro - /usr/lib/x86_64-linux-gnu/libapparmor.so.1:/usr/lib/x86_64-linux-gnu/libapparmor.so.1:ro
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- /lib/x86_64-linux-gnu/libsystemd-journal.so.0:/lib/x86_64-linux-gnu/libsystemd-journal.so.0
marathon: marathon:
image: mesosphere/marathon:v0.9.2 image: mesosphere/marathon:v1.1.1
net: host net: host
environment: environment:
MARATHON_MASTER: zk://127.0.0.1:2181/mesos MARATHON_MASTER: zk://127.0.0.1:2181/mesos
MARATHON_ZK: zk://127.0.0.1:2181/marathon MARATHON_ZK: zk://127.0.0.1:2181/marathon
MARATHON_HOSTNAME: 127.0.0.1 MARATHON_HOSTNAME: 127.0.0.1
command: --event_subscriber http_callback command: --event_subscriber http_callback