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.16.0.11:8080/eureka/v2") So(conf.Eureka.ServiceUrls, ShouldContain, "http://172.16.0.22:8080/eureka/v2") }) So(conf.Eureka.UseDNSForServiceUrls, ShouldEqual, false) }) }
func TestConnectionCreation(t *testing.T) { Convey("Pull applications", t, func() { cfg, err := fargo.ReadConfig("./config_sample/local.gcfg") So(err, ShouldBeNil) e := fargo.NewConnFromConfig(cfg) apps, err := e.GetApps() So(err, ShouldBeNil) So(len(apps["EUREKA"].Instances), ShouldEqual, 2) }) }