本文整理匯總了Golang中github.com/cloudfoundry-incubator/runtime-schema/bbs/fake_bbs.FakeReceptorBBS.UpdateDesiredLRPStub方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeReceptorBBS.UpdateDesiredLRPStub方法的具體用法?Golang FakeReceptorBBS.UpdateDesiredLRPStub怎麽用?Golang FakeReceptorBBS.UpdateDesiredLRPStub使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry-incubator/runtime-schema/bbs/fake_bbs.FakeReceptorBBS
的用法示例。
在下文中一共展示了FakeReceptorBBS.UpdateDesiredLRPStub方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
JustBeforeEach(func() {
handler.Update(responseRecorder, req)
})
It("retries up to one time", func() {
Eventually(fakeLegacyBBS.UpdateDesiredLRPCallCount).Should(Equal(2))
Consistently(fakeLegacyBBS.UpdateDesiredLRPCallCount).Should(Equal(2))
})
Context("when the second attempt succeeds", func() {
BeforeEach(func() {
fakeLegacyBBS.UpdateDesiredLRPStub = func(logger lager.Logger, processGuid string, update oldmodels.DesiredLRPUpdate) error {
if fakeLegacyBBS.UpdateDesiredLRPCallCount() == 1 {
return bbserrors.ErrStoreComparisonFailed
} else if fakeLegacyBBS.UpdateDesiredLRPCallCount() == 2 {
return nil
} else {
return errors.New("We shouldn't call this function more than twice")
}
}
})
It("returns a 204 No Content", func() {
Eventually(fakeLegacyBBS.UpdateDesiredLRPCallCount).Should(Equal(2))
Expect(responseRecorder.Code).To(Equal(http.StatusNoContent))
Consistently(fakeLegacyBBS.UpdateDesiredLRPCallCount).Should(Equal(2))
})
})
Context("when the second attempt fails", func() {
It("returns a 500 Internal Server Error", func() {