test(integration-test): First test for eureka
This commit is contained in:
parent
2af6cc4d1b
commit
d2dcec40e1
4 changed files with 46 additions and 0 deletions
34
integration/eureka_test.go
Normal file
34
integration/eureka_test.go
Normal file
|
@ -0,0 +1,34 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os/exec"
|
||||
"time"
|
||||
|
||||
"github.com/go-check/check"
|
||||
|
||||
checker "github.com/vdemeester/shakers"
|
||||
)
|
||||
|
||||
// Eureka test suites (using libcompose)
|
||||
type EurekaSuite struct{ BaseSuite }
|
||||
|
||||
func (s *EurekaSuite) SetUpSuite(c *check.C) {
|
||||
s.createComposeProject(c, "eureka")
|
||||
s.composeProject.Start(c)
|
||||
}
|
||||
|
||||
func (s *EurekaSuite) TestSimpleConfiguration(c *check.C) {
|
||||
cmd := exec.Command(traefikBinary, "--configFile=fixtures/eureka/simple.toml")
|
||||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
defer cmd.Process.Kill()
|
||||
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
// TODO validate : run on 80
|
||||
resp, err := http.Get("http://127.0.0.1:8000/")
|
||||
|
||||
// Expected a 404 as we did not configure anything
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(resp.StatusCode, checker.Equals, 404)
|
||||
}
|
7
integration/fixtures/eureka/simple.toml
Normal file
7
integration/fixtures/eureka/simple.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
defaultEntryPoints = ["http"]
|
||||
[entryPoints]
|
||||
[entryPoints.http]
|
||||
address = ":8000"
|
||||
[eureka]
|
||||
endpoint = "http://127.0.0.1:8761/eureka"
|
||||
delay = "1m"
|
|
@ -33,6 +33,7 @@ func init() {
|
|||
check.Suite(&MarathonSuite{})
|
||||
check.Suite(&ConstraintSuite{})
|
||||
check.Suite(&MesosSuite{})
|
||||
check.Suite(&EurekaSuite{})
|
||||
}
|
||||
|
||||
var traefikBinary = "../dist/traefik"
|
||||
|
|
4
integration/resources/compose/eureka.yml
Normal file
4
integration/resources/compose/eureka.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
eureka:
|
||||
image: netflixoss/eureka:1.3.1
|
||||
ports:
|
||||
- "8761:8080"
|
Loading…
Reference in a new issue