Beispiel #1
0
		switch actualLRP.CellID {
		case cellAID:
			evacuatingRepAddr = cellARepAddr
			evacutaingRepRunner = cellARepRunner
		case cellBID:
			evacuatingRepAddr = cellBRepAddr
			evacutaingRepRunner = cellBRepRunner
		default:
			panic("what? who?")
		}

		By("posting the evacuation endpoint")
		resp, err := http.Post(fmt.Sprintf("http://%s/evacuate", evacuatingRepAddr), "text/html", nil)
		Expect(err).NotTo(HaveOccurred())
		resp.Body.Close()
		Expect(resp.StatusCode).To(Equal(http.StatusAccepted))

		By("staying routable so long as its rep is alive")
		Eventually(func() int {
			Expect(helpers.ResponseCodeFromHostPoller(componentMaker.Addresses.Router, helpers.DefaultHost)()).To(Equal(http.StatusOK))
			return evacutaingRepRunner.ExitCode()
		}).Should(Equal(0))

		By("running immediately after the rep exits and is eventually routable")
		Expect(helpers.LRPStatePoller(receptorClient, processGuid, nil)()).To(Equal(receptor.ActualLRPStateRunning))
		Eventually(helpers.ResponseCodeFromHostPoller(componentMaker.Addresses.Router, helpers.DefaultHost)).Should(Equal(http.StatusOK))
		Consistently(helpers.ResponseCodeFromHostPoller(componentMaker.Addresses.Router, helpers.DefaultHost)).Should(Equal(http.StatusOK))
	})
})
			runner = NewThroughputRamp(binPath, runnerArgs)
			process = ginkgomon.Invoke(runner)
		})

		AfterEach(func() {
			ginkgomon.Interrupt(process)
			testServer.Close()
			testS3Server.Close()
			close(bodyChan)
			err := os.Remove(comparisonFilePath)
			Expect(err).ToNot(HaveOccurred())
		})

		It("ramps up throughput over multiple tests", func() {
			Eventually(process.Wait(), "5s").Should(Receive())
			Expect(runner.ExitCode()).To(Equal(0))
			Expect(testServer.ReceivedRequests()).To(HaveLen(24))
		})

		Context("when cpu monitor server is configured", func() {
			var (
				cpumonitorServer *ghttp.Server
			)
			BeforeEach(func() {
				cpumonitorServer = ghttp.NewServer()

				header := make(http.Header)
				header.Add("Content-Type", "application/json")

				cpumonitorServer.AppendHandlers(
					ghttp.CombineHandlers(