Skip to content

Commit

Permalink
Merge pull request #33 from ryansb/feature/dockerTesting
Browse files Browse the repository at this point in the history
Use docker for testing
  • Loading branch information
ryansb committed Dec 12, 2015
2 parents f9cc07e + 2321b58 commit 2006552
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 179 deletions.
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,28 @@ included [vagrant](http://vagrantup.com) specs.
We're on semver and tag releases accordingly. The releases are signed and can
be verified with `git tag --verify vA.B.C`.

## Using Vagrant
## Using Docker

The Vagrantfile in this repo will set up a two-server eureka cluster using the
OpsCode bento boxes. By default, the VMs are named node1.localdomain and
node2.localdomain. They'll be provisioned and eureka will start automatically.
Fargo is tested against two eureka versions, v1.1.147 and v1.3.1. To support
testing, we provide Docker containers that supply Eureka locally. Here's how to
get started.

1. Clone Fargo
1. If you don't have it, [install Docker](https://docs.docker.com/).
1. Change into the `docker` directory of this repository.

```
# Build the image, change "1.3.1" to 1.1.147 for the older version
VERSION=1.3.1
docker build -f Dockerfile-v$VERSION -t hudloss/eureka:$VERSION .
# Run two copies of the image (the containers will communicate with each other)
docker run -d --name eureka1 hudloss/eureka:$VERSION
docker run -d --name eureka2 hudloss/eureka:$VERSION
```

Now you're all set, and you should have Eureka servers available at
172.17.0.2:8080 and 172.17.0.3:8080. Run Fargo's tests with `go test ./...`
from the root of the repository. Happy Hacking!

# Contributors

Expand Down
36 changes: 0 additions & 36 deletions Vagrantfile

This file was deleted.

5 changes: 5 additions & 0 deletions docker/Dockerfile-v1.1.147
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM netflixoss/eureka:1.1.147
MAINTAINER Fargo dev team https://github.com/hudl/fargo

ADD eureka-client-test.properties /tomcat/webapps/eureka/WEB-INF/classes/eureka-client-test.properties
ADD eureka-server-test.properties /tomcat/webapps/eureka/WEB-INF/classes/eureka-server-test.properties
5 changes: 5 additions & 0 deletions docker/Dockerfile-v1.3.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM netflixoss/eureka:1.3.1
MAINTAINER Fargo dev team https://github.com/hudl/fargo

ADD eureka-client-test.properties /tomcat/webapps/eureka/WEB-INF/classes/eureka-client-test.properties
ADD eureka-server-test.properties /tomcat/webapps/eureka/WEB-INF/classes/eureka-server-test.properties
2 changes: 2 additions & 0 deletions docker/eureka-client-test.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eureka.serviceUrl.default=http://172.17.0.2:8080/eureka/v2/,http://172.17.0.3:8080/eureka/v2/
eureka.vipAddress=eureka
3 changes: 3 additions & 0 deletions docker/eureka-server-test.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eureka.enableSelfPreservation=false
eureka.numberRegistrySyncRetries=0
eureka.waitTimeInMsWhenSyncEmpty=0
31 changes: 0 additions & 31 deletions provision_eureka.sh

This file was deleted.

4 changes: 2 additions & 2 deletions tests/config_sample/local.gcfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Eureka]
ServiceUrls = http://172.16.0.11:8080/eureka/v2
ServiceUrls = http://172.16.0.22:8080/eureka/v2
ServiceUrls = http://172.17.0.2:8080/eureka/v2
ServiceUrls = http://172.17.0.3:8080/eureka/v2
ConnectTimeoutSeconds = 2
4 changes: 2 additions & 2 deletions tests/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func TestConfigs(t *testing.T) {
So(conf.Eureka.InTheCloud, ShouldEqual, false)
So(conf.Eureka.ConnectTimeoutSeconds, ShouldEqual, 2)
Convey("Both test servers should be in the service URL list", func() {
So(conf.Eureka.ServiceUrls, ShouldContain, "http://172.16.0.11:8080/eureka/v2")
So(conf.Eureka.ServiceUrls, ShouldContain, "http://172.16.0.22:8080/eureka/v2")
So(conf.Eureka.ServiceUrls, ShouldContain, "http://172.17.0.2:8080/eureka/v2")
So(conf.Eureka.ServiceUrls, ShouldContain, "http://172.17.0.3:8080/eureka/v2")
})
So(conf.Eureka.UseDNSForServiceUrls, ShouldEqual, false)
})
Expand Down
24 changes: 0 additions & 24 deletions tests/eureka_properties/eureka-client-prod.properties

This file was deleted.

25 changes: 0 additions & 25 deletions tests/eureka_properties/eureka-client-test.properties

This file was deleted.

27 changes: 0 additions & 27 deletions tests/eureka_properties/eureka-client.properties

This file was deleted.

3 changes: 0 additions & 3 deletions tests/eureka_properties/eureka-server-prod.properties

This file was deleted.

3 changes: 0 additions & 3 deletions tests/eureka_properties/eureka-server-test.properties

This file was deleted.

8 changes: 0 additions & 8 deletions tests/eureka_properties/eureka-server.properties

This file was deleted.

6 changes: 0 additions & 6 deletions tests/eureka_properties/log4j.properties

This file was deleted.

10 changes: 2 additions & 8 deletions tests/net_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,8 @@ func TestGetApps(t *testing.T) {
Convey("Pull single application", t, func() {
a, _ := e.GetApp("EUREKA")
So(len(a.Instances), ShouldEqual, 2)
for idx, ins := range a.Instances {
if ins.HostName == "node1.localdomain" {
So(a.Instances[idx].IPAddr, ShouldEqual, "172.16.0.11")
So(a.Instances[idx].HostName, ShouldEqual, "node1.localdomain")
} else {
So(a.Instances[idx].IPAddr, ShouldEqual, "172.16.0.22")
So(a.Instances[idx].HostName, ShouldEqual, "node2.localdomain")
}
for _, ins := range a.Instances {
So(ins.IPAddr, ShouldBeIn, []string{"172.17.0.2", "172.17.0.3"})
}
})
}
Expand Down

0 comments on commit 2006552

Please sign in to comment.