本文整理汇总了Golang中code/cloudfoundry/org/bbs/db/dbfakes.FakeDesiredLRPDB.DesireLRPCallCount方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeDesiredLRPDB.DesireLRPCallCount方法的具体用法?Golang FakeDesiredLRPDB.DesireLRPCallCount怎么用?Golang FakeDesiredLRPDB.DesireLRPCallCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类code/cloudfoundry/org/bbs/db/dbfakes.FakeDesiredLRPDB
的用法示例。
在下文中一共展示了FakeDesiredLRPDB.DesireLRPCallCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
createdActualLRPGroups = []*models.ActualLRPGroup{}
for i := 0; i < 5; i++ {
createdActualLRPGroups = append(createdActualLRPGroups, &models.ActualLRPGroup{Instance: model_helpers.NewValidActualLRP("some-guid", int32(i))})
}
fakeDesiredLRPDB.DesireLRPReturns(nil)
fakeActualLRPDB.CreateUnclaimedActualLRPStub = func(_ lager.Logger, key *models.ActualLRPKey) (*models.ActualLRPGroup, error) {
if int(key.Index) > len(createdActualLRPGroups)-1 {
return nil, errors.New("boom")
}
return createdActualLRPGroups[int(key.Index)], nil
}
fakeDesiredLRPDB.DesiredLRPByProcessGuidReturns(desiredLRP, nil)
})
It("creates desired lrp", func() {
Expect(fakeDesiredLRPDB.DesireLRPCallCount()).To(Equal(1))
_, actualDesiredLRP := fakeDesiredLRPDB.DesireLRPArgsForCall(0)
Expect(actualDesiredLRP).To(Equal(desiredLRP))
Expect(responseRecorder.Code).To(Equal(http.StatusOK))
response := models.DesiredLRPLifecycleResponse{}
err := response.Unmarshal(responseRecorder.Body.Bytes())
Expect(err).NotTo(HaveOccurred())
Expect(response.Error).To(BeNil())
})
It("emits a create event to the hub", func() {
Eventually(desiredHub.EmitCallCount).Should(Equal(1))
event := desiredHub.EmitArgsForCall(0)
createEvent, ok := event.(*models.DesiredLRPCreatedEvent)