"C": repC, } repA.StateReturns(BuildCellState("the-zone", 100, 200, 100, false, linuxOnlyRootFSProviders, nil), nil) repB.StateReturns(BuildCellState("the-zone", 10, 10, 100, false, linuxOnlyRootFSProviders, nil), nil) repC.StateReturns(BuildCellState("other-zone", 100, 10, 100, false, linuxOnlyRootFSProviders, nil), nil) metricEmitter = new(fakes.FakeAuctionMetricEmitterDelegate) }) AfterEach(func() { workPool.Stop() }) It("fetches state by calling each client", func() { zones := auctionrunner.FetchStateAndBuildZones(logger, workPool, clients, metricEmitter) Expect(zones).To(HaveLen(2)) cells := map[string]*auctionrunner.Cell{} for _, cell := range zones["the-zone"] { cells[cell.Guid] = cell } Expect(cells).To(HaveLen(2)) Expect(cells).To(HaveKey("A")) Expect(cells).To(HaveKey("B")) Expect(repA.StateCallCount()).To(Equal(1)) Expect(repB.StateCallCount()).To(Equal(1)) otherZone := zones["other-zone"] Expect(otherZone).To(HaveLen(1))
"A": repA, "B": repB, "C": repC, } repA.StateReturns(BuildCellState("the-zone", 100, 200, 100, false, linuxOnlyRootFSProviders, nil), nil) repB.StateReturns(BuildCellState("the-zone", 10, 10, 100, false, linuxOnlyRootFSProviders, nil), nil) repC.StateReturns(BuildCellState("other-zone", 100, 10, 100, false, linuxOnlyRootFSProviders, nil), nil) }) AfterEach(func() { workPool.Stop() }) It("fetches state by calling each client", func() { zones := auctionrunner.FetchStateAndBuildZones(logger, workPool, clients) Expect(zones).To(HaveLen(2)) cells := map[string]*auctionrunner.Cell{} for _, cell := range zones["the-zone"] { cells[cell.Guid] = cell } Expect(cells).To(HaveLen(2)) Expect(cells).To(HaveKey("A")) Expect(cells).To(HaveKey("B")) Expect(repA.StateCallCount()).To(Equal(1)) Expect(repB.StateCallCount()).To(Equal(1)) otherZone := zones["other-zone"] Expect(otherZone).To(HaveLen(1))