Esempio n. 1
0
						}
						return result
					}, 100*time.Millisecond, drainTimeout).Should(Equal(http.StatusServiceUnavailable))
				}()

			})
		})

		Context("when the load balancer delay is less than the start repsonse delay ", func() {
			BeforeEach(func() {
				var err error
				logcounter := schema.NewLogCounter()

				errChan := make(chan error, 2)
				config.LoadBalancerHealthyThreshold = 2 * time.Second
				config.StartResponseDelayInterval = 4 * time.Second
				config.Port = 9348
				rtr, err = router.NewRouter(logger, config, p, mbusClient, registry, varz, &healthCheck, logcounter, errChan)
				Expect(err).ToNot(HaveOccurred())

				signals := make(chan os.Signal)
				readyChan := make(chan struct{})
				go func() {
					rtr.Run(signals, readyChan)
				}()
			})

			It("does not immediately make the health check endpoint available", func() {
				Consistently(func() int {
					return healthCheckWithEndpointReceives()
				}, time.Second).Should(Equal(http.StatusServiceUnavailable))