Expect(cfg.LogGuid).To(Equal("my_logs")) Expect(cfg.MetronConfig.Address).To(Equal("1.2.3.4")) Expect(cfg.MetronConfig.Port).To(Equal("4567")) Expect(cfg.DebugAddress).To(Equal("1.2.3.4:1234")) Expect(cfg.StatsdClientFlushInterval).To(Equal(10 * time.Millisecond)) Expect(cfg.OAuth.TokenEndpoint).To(BeEmpty()) Expect(cfg.OAuth.Port).To(Equal(0)) }) }) }) }) }) Describe("Initialize", func() { var ( cfg *config.Config ) BeforeEach(func() { cfg = &config.Config{} }) Context("when router groups are seeded in the configuration file", func() { var expectedGroups models.RouterGroups testConfig := func(ports string) string { return `log_guid: "my_logs" metrics_reporting_interval: "500ms" statsd_endpoint: "localhost:8125" statsd_client_flush_interval: "10ms" router_groups:
}) }) Context("when the file does not exists", func() { It("returns an error", func() { cfg_file := "notexist" _, err := config.NewConfigFromFile(cfg_file) Expect(err).To(HaveOccurred()) }) }) }) Describe("Initialize", func() { var ( cfg *config.Config ) BeforeEach(func() { cfg = &config.Config{} }) Context("when there are errors in the yml file", func() { var test_config string Context("UAA errors", func() { BeforeEach(func() { test_config = ` uaa:` }) It("errors if no UaaPublicKey is found", func() {