forked from hudl/fargo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_test.go
38 lines (34 loc) · 1.44 KB
/
config_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package fargo_test
// MIT Licensed (see README.md) - Copyright (c) 2013 Hudl <@Hudl>
import (
"github.com/hudl/fargo"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestConfigs(t *testing.T) {
Convey("Reading a blank config to test defaults.", t, func() {
conf, err := fargo.ReadConfig("./config_sample/blank.gcfg")
So(err, ShouldBeNil)
So(conf.Eureka.InTheCloud, ShouldEqual, false)
So(conf.Eureka.ConnectTimeoutSeconds, ShouldEqual, 10)
So(conf.Eureka.UseDNSForServiceUrls, ShouldEqual, false)
So(conf.Eureka.ServerDNSName, ShouldEqual, "")
So(len(conf.Eureka.ServiceUrls), ShouldEqual, 0)
So(conf.Eureka.ServerPort, ShouldEqual, 7001)
So(conf.Eureka.PollIntervalSeconds, ShouldEqual, 30)
So(conf.Eureka.EnableDelta, ShouldEqual, false)
So(conf.Eureka.PreferSameZone, ShouldEqual, false)
So(conf.Eureka.RegisterWithEureka, ShouldEqual, false)
})
Convey("Testing a config that connects to local eureka instances", t, func() {
conf, err := fargo.ReadConfig("./config_sample/local.gcfg")
So(err, ShouldBeNil)
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.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)
})
}