本文整理匯總了Golang中github.com/cloudfoundry-incubator/bbs.ServiceClient.CellById方法的典型用法代碼示例。如果您正苦於以下問題:Golang ServiceClient.CellById方法的具體用法?Golang ServiceClient.CellById怎麽用?Golang ServiceClient.CellById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry-incubator/bbs.ServiceClient
的用法示例。
在下文中一共展示了ServiceClient.CellById方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
var _ = Describe("ServiceClient", func() {
var serviceClient bbs.ServiceClient
BeforeEach(func() {
serviceClient = bbs.NewServiceClient(consulSession, clock.NewClock())
})
Describe("CellById", func() {
const cellID = "cell-id"
Context("when the cell exists", func() {
It("returns the correct CellPresence", func() {
cellPresence := newCellPresence(cellID)
consulHelper.RegisterCell(cellPresence)
presence, err := serviceClient.CellById(logger, cellID)
Expect(err).NotTo(HaveOccurred())
Expect(presence).To(BeEquivalentTo(cellPresence))
})
})
Context("when the cell does not exist", func() {
It("returns ErrStoreResourceNotFound", func() {
_, err := serviceClient.CellById(logger, cellID)
Expect(err).To(HaveOccurred())
modelErr := models.ConvertError(err)
Expect(modelErr.Type).To(Equal(models.Error_ResourceNotFound))
})
})
})