本文整理汇总了Golang中github.com/cloudfoundry-incubator/bbs.ServiceClient.NewCellPresenceRunner方法的典型用法代码示例。如果您正苦于以下问题:Golang ServiceClient.NewCellPresenceRunner方法的具体用法?Golang ServiceClient.NewCellPresenceRunner怎么用?Golang ServiceClient.NewCellPresenceRunner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/bbs.ServiceClient
的用法示例。
在下文中一共展示了ServiceClient.NewCellPresenceRunner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SpinUp
func (f *FakeCell) SpinUp(serviceClient bbs.ServiceClient) {
//make a test-friendly AuctionRepDelegate using the auction package's SimulationRepDelegate
f.SimulationRep = simulationrep.New(f.stack, "Z0", rep.Resources{
DiskMB: 100,
MemoryMB: 100,
Containers: 100,
})
//spin up an http auction server
logger := lager.NewLogger(f.cellID)
logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.INFO))
fakeLRPStopper := new(fake_lrp_stopper.FakeLRPStopper)
fakeExecutorClient := new(executorfakes.FakeClient)
fakeEvacuatable := new(fake_evacuation_context.FakeEvacuatable)
handlers := rephandlers.New(f.SimulationRep, fakeLRPStopper, fakeExecutorClient, fakeEvacuatable, logger)
router, err := rata.NewRouter(rep.Routes, handlers)
Expect(err).NotTo(HaveOccurred())
f.server = httptest.NewServer(router)
presence := models.NewCellPresence(
f.cellID,
f.server.URL,
"az1",
models.NewCellCapacity(512, 1024, 124),
[]string{},
[]string{})
f.heartbeater = ifrit.Invoke(serviceClient.NewCellPresenceRunner(logger, &presence, time.Second))
}
示例2:
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))
})
})
})