diff --git a/integration/etcd_test.go b/integration/etcd_test.go new file mode 100644 index 000000000..377bbc437 --- /dev/null +++ b/integration/etcd_test.go @@ -0,0 +1,27 @@ +package main + +import ( + "net/http" + "os/exec" + "time" + + "fmt" + checker "github.com/vdemeester/shakers" + check "gopkg.in/check.v1" +) + +func (s *EtcdSuite) TestSimpleConfiguration(c *check.C) { + cmd := exec.Command(traefikBinary, "--configFile=fixtures/etcd/simple.toml") + err := cmd.Start() + c.Assert(err, checker.IsNil) + defer cmd.Process.Kill() + + time.Sleep(1000 * time.Millisecond) + // TODO validate : run on 80 + resp, err := http.Get("http://127.0.0.1:8000/") + + // Expected no response as we did not configure anything + c.Assert(resp, checker.IsNil) + c.Assert(err, checker.NotNil) + c.Assert(err.Error(), checker.Contains, fmt.Sprintf("getsockopt: connection refused")) +} diff --git a/integration/fixtures/etcd/simple.toml b/integration/fixtures/etcd/simple.toml new file mode 100644 index 000000000..26d15d83d --- /dev/null +++ b/integration/fixtures/etcd/simple.toml @@ -0,0 +1,10 @@ +defaultEntryPoints = ["http"] + +[entryPoints] + [entryPoints.http] + address = ":8000" + +logLevel = "DEBUG" + +[etcd] + endpoint = "127.0.0.1:4003,127.0.0.1:4002,127.0.0.1:4001" diff --git a/integration/integration_test.go b/integration/integration_test.go index b5ee8fbf6..f0c7580e1 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -29,6 +29,7 @@ func init() { check.Suite(&DockerSuite{}) check.Suite(&ConsulSuite{}) check.Suite(&ConsulCatalogSuite{}) + check.Suite(&EtcdSuite{}) check.Suite(&MarathonSuite{}) } @@ -50,6 +51,13 @@ func (s *ConsulSuite) SetUpSuite(c *check.C) { s.createComposeProject(c, "consul") } +// Etcd test suites (using libcompose) +type EtcdSuite struct{ BaseSuite } + +func (s *EtcdSuite) SetUpSuite(c *check.C) { + s.createComposeProject(c, "etcd") +} + // Marathon test suites (using libcompose) type MarathonSuite struct{ BaseSuite } diff --git a/integration/resources/compose/etcd.yml b/integration/resources/compose/etcd.yml new file mode 100644 index 000000000..622dca78b --- /dev/null +++ b/integration/resources/compose/etcd.yml @@ -0,0 +1,30 @@ +etcd1: + image: quay.io/coreos/etcd:v2.2.0 + net: "host" + command: > + --name etcd1 + --listen-peer-urls http://localhost:7001 + --listen-client-urls http://localhost:4001 + --initial-advertise-peer-urls http://localhost:7001 + --advertise-client-urls http://localhost:4001 + --initial-cluster etcd1=http://localhost:7001,etcd2=http://localhost:7002,etcd3=http://localhost:7003 +etcd2: + image: quay.io/coreos/etcd:v2.2.0 + net: "host" + command: > + --name etcd2 + --listen-peer-urls http://localhost:7002 + --listen-client-urls http://localhost:4002 + --initial-advertise-peer-urls http://localhost:7002 + --advertise-client-urls http://localhost:4002 + --initial-cluster etcd1=http://localhost:7001,etcd2=http://localhost:7002,etcd3=http://localhost:7003 +etcd3: + image: quay.io/coreos/etcd:v2.2.0 + net: "host" + command: > + --name etcd3 + --listen-peer-urls http://localhost:7003 + --listen-client-urls http://localhost:4003 + --initial-advertise-peer-urls http://localhost:7003 + --advertise-client-urls http://localhost:4003 + --initial-cluster etcd1=http://localhost:7001,etcd2=http://localhost:7002,etcd3=http://localhost:7003