Ejemplo n.º 1
0
						Eventually(table.SwapCallCount).Should(Equal(1))
						Expect(bbsClient.ActualLRPGroupsCallCount()).To(Equal(2))
					})
				})

				Context("when fetching desireds fails", func() {
					var returnError int32

					BeforeEach(func() {
						returnError = 1

						bbsClient.DesiredLRPSchedulingInfosStub = func(filter models.DesiredLRPFilter) ([]*models.DesiredLRPSchedulingInfo, error) {
							if atomic.LoadInt32(&returnError) == 1 {
								return nil, errors.New("bam")
							}

							return []*models.DesiredLRPSchedulingInfo{}, nil
						}
					})

					It("should not call sync until the error resolves", func() {
						Eventually(bbsClient.DesiredLRPSchedulingInfosCallCount).Should(Equal(1))
						Consistently(table.SwapCallCount).Should(Equal(0))

						atomic.StoreInt32(&returnError, 0)
						syncEvents.Sync <- struct{}{}

						Eventually(table.SwapCallCount).Should(Equal(1))
						Expect(bbsClient.DesiredLRPSchedulingInfosCallCount()).To(Equal(2))
					})