2015-09-27 13:59:51 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"os/exec"
|
|
|
|
"time"
|
|
|
|
|
2017-05-17 13:22:44 +00:00
|
|
|
"github.com/containous/traefik/integration/try"
|
2016-04-02 10:40:21 +00:00
|
|
|
"github.com/go-check/check"
|
2015-09-27 13:59:51 +00:00
|
|
|
checker "github.com/vdemeester/shakers"
|
|
|
|
)
|
|
|
|
|
2016-03-27 14:27:56 +00:00
|
|
|
// Marathon test suites (using libcompose)
|
|
|
|
type MarathonSuite struct{ BaseSuite }
|
|
|
|
|
|
|
|
func (s *MarathonSuite) SetUpSuite(c *check.C) {
|
|
|
|
s.createComposeProject(c, "marathon")
|
2016-06-06 20:33:29 +00:00
|
|
|
s.composeProject.Start(c)
|
2017-05-17 13:22:44 +00:00
|
|
|
|
|
|
|
// FIXME Doesn't work...
|
|
|
|
//// "github.com/gambol99/go-marathon"
|
|
|
|
//config := marathon.NewDefaultConfig()
|
|
|
|
//
|
|
|
|
//marathonClient, err := marathon.NewClient(config)
|
|
|
|
//if err != nil {
|
|
|
|
// c.Fatalf("Error creating Marathon client. %v", err)
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//// Wait for Marathon to elect itself leader
|
|
|
|
//err = try.Do(30*time.Second, func() error {
|
|
|
|
// leader, err := marathonClient.Leader()
|
|
|
|
//
|
|
|
|
// if err != nil || len(leader) == 0 {
|
|
|
|
// return fmt.Errorf("Leader not found. %v", err)
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// return nil
|
|
|
|
//})
|
|
|
|
//
|
|
|
|
//c.Assert(err, checker.IsNil)
|
2016-03-27 14:27:56 +00:00
|
|
|
}
|
|
|
|
|
2015-09-27 13:59:51 +00:00
|
|
|
func (s *MarathonSuite) TestSimpleConfiguration(c *check.C) {
|
2016-01-13 21:46:44 +00:00
|
|
|
cmd := exec.Command(traefikBinary, "--configFile=fixtures/marathon/simple.toml")
|
2015-09-27 13:59:51 +00:00
|
|
|
err := cmd.Start()
|
|
|
|
c.Assert(err, checker.IsNil)
|
2015-11-03 22:06:31 +00:00
|
|
|
defer cmd.Process.Kill()
|
2015-09-27 13:59:51 +00:00
|
|
|
|
|
|
|
// TODO validate : run on 80
|
2016-03-15 17:57:56 +00:00
|
|
|
// Expected a 404 as we did not configure anything
|
2017-05-17 13:22:44 +00:00
|
|
|
err = try.GetRequest("http://127.0.0.1:8000/", 500*time.Millisecond, try.StatusCodeIs(http.StatusNotFound))
|
|
|
|
|
2016-03-15 17:57:56 +00:00
|
|
|
c.Assert(err, checker.IsNil)
|
2015-09-27 13:59:51 +00:00
|
|
|
}
|