本文整理汇总了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))
})