return `log_guid: "my_logs" metrics_reporting_interval: "500ms" statsd_endpoint: "localhost:8125" statsd_client_flush_interval: "10ms" router_groups: - name: router-group-1 reservable_ports: ` + ports + ` type: tcp - name: router-group-2 reservable_ports: 1024-10000,42000 type: udp` } It("populates the router groups", func() { config := testConfig("12000") err := cfg.Initialize([]byte(config), true) Expect(err).NotTo(HaveOccurred()) expectedGroups = models.RouterGroups{ { Name: "router-group-1", ReservablePorts: "12000", Type: "tcp", }, { Name: "router-group-2", ReservablePorts: "1024-10000,42000", Type: "udp", }, } Expect(cfg.RouterGroups).To(Equal(expectedGroups)) })
) 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() { err := cfg.Initialize([]byte(test_config)) Expect(err).To(HaveOccurred()) }) }) Context("MaxConcurrentETCDRequests errors", func() { BeforeEach(func() { test_config = `uaa_verification_key: "public_key" log_guid: "some-guid" max_concurrent_etcd_requests: '-1'` }) It("errors if max concurrent requests is negative", func() { err := cfg.Initialize([]byte(test_config)) Expect(err).To(HaveOccurred()) })