Exemplo n.º 1
0
								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))
					})
				})
			})

			Context("when syncing ends", func() {
				BeforeEach(func() {
					bbsClient.ActualLRPGroupsStub = func(f models.ActualLRPFilter) ([]*models.ActualLRPGroup, error) {
						clock.IncrementBySeconds(1)

						return []*models.ActualLRPGroup{
							actualLRPGroup1,
							actualLRPGroup2,
						}, nil
					}
				})