本文整理匯總了Golang中github.com/cloudfoundry-incubator/bbs.ServiceClient.Cells方法的典型用法代碼示例。如果您正苦於以下問題:Golang ServiceClient.Cells方法的具體用法?Golang ServiceClient.Cells怎麽用?Golang ServiceClient.Cells使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry-incubator/bbs.ServiceClient
的用法示例。
在下文中一共展示了ServiceClient.Cells方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
ghttp.RespondWithJSONEncoded(http.StatusOK, &struct{}{})),
)
})
It("destroys any existing containers", func() {
Eventually(deleteChan).Should(Receive())
Eventually(deleteChan).Should(Receive())
})
})
Describe("maintaining presence", func() {
var cellPresence *models.CellPresence
JustBeforeEach(func() {
Eventually(fetchCells(logger, serviceClient)).Should(HaveLen(1))
cells, err := serviceClient.Cells(logger)
Expect(err).NotTo(HaveOccurred())
cellPresence = cells[cellID]
})
It("should maintain presence", func() {
Expect(cellPresence.CellID).To(Equal(cellID))
expectedRootFSProviders := map[string][]string{
"docker": []string{},
"preloaded": []string{"the-rootfs"},
}
Expect(cellPresence.RootFSProviders).To(Equal(expectedRootFSProviders))
})
It("should have no session health checks", func() {
sessions, _, err := consulRunner.NewClient().Session().List(nil)
示例2: fetchCells
func fetchCells(logger lager.Logger, serviceClient bbs.ServiceClient) func() (models.CellSet, error) {
return func() (models.CellSet, error) {
return serviceClient.Cells(logger)
}
}
示例3:
Expect(err).To(HaveOccurred())
modelErr := models.ConvertError(err)
Expect(modelErr.Type).To(Equal(models.Error_ResourceNotFound))
})
})
})
Describe("Cells", func() {
const cell1 = "cell-id-1"
const cell2 = "cell-id-2"
Context("when there is a single cell", func() {
var maintainers ifrit.Process
BeforeEach(func() {
Expect(serviceClient.Cells(logger)).To(HaveLen(0))
maintainers = ifrit.Invoke(grouper.NewParallel(os.Interrupt, grouper.Members{
{cell1, serviceClient.NewCellPresenceRunner(logger, newCellPresence(cell1), locket.LockTTL)},
{cell2, serviceClient.NewCellPresenceRunner(logger, newCellPresence(cell2), locket.LockTTL)},
}))
})
AfterEach(func() {
ginkgomon.Interrupt(maintainers)
})
It("returns only one cell", func() {
Eventually(func() (models.CellSet, error) { return serviceClient.Cells(logger) }).Should(HaveLen(2))
Expect(serviceClient.Cells(logger)).To(HaveKey(cell1))
Expect(serviceClient.Cells(logger)).To(HaveKey(cell2))
})