當前位置: 首頁>>代碼示例>>Golang>>正文


Golang ServiceClient.Cells方法代碼示例

本文整理匯總了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)
開發者ID:emc-xchallenge,項目名稱:rep,代碼行數:31,代碼來源:main_test.go

示例2: fetchCells

func fetchCells(logger lager.Logger, serviceClient bbs.ServiceClient) func() (models.CellSet, error) {
	return func() (models.CellSet, error) {
		return serviceClient.Cells(logger)
	}
}
開發者ID:emc-xchallenge,項目名稱:rep,代碼行數:5,代碼來源:main_test.go

示例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))
			})
開發者ID:emc-xchallenge,項目名稱:bbs,代碼行數:31,代碼來源:service_client_test.go


注:本文中的github.com/cloudfoundry-incubator/bbs.ServiceClient.Cells方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。