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


Golang AppFixture.CrashedInstanceHeartbeatAtIndex方法代碼示例

本文整理匯總了Golang中github.com/cloudfoundry/hm9000/testhelpers/appfixture.AppFixture.CrashedInstanceHeartbeatAtIndex方法的典型用法代碼示例。如果您正苦於以下問題:Golang AppFixture.CrashedInstanceHeartbeatAtIndex方法的具體用法?Golang AppFixture.CrashedInstanceHeartbeatAtIndex怎麽用?Golang AppFixture.CrashedInstanceHeartbeatAtIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cloudfoundry/hm9000/testhelpers/appfixture.AppFixture的用法示例。


在下文中一共展示了AppFixture.CrashedInstanceHeartbeatAtIndex方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1:

					Ω(stopMessages()).Should(ContainElement(EqualPendingStopMessage(expectedMessageForEvacuatingInstance)))
				})
			})
		})
	})

	Describe("Handling crashed instances", func() {
		var heartbeat models.Heartbeat
		Context("When there are multiple crashed instances on the same index", func() {
			JustBeforeEach(func() {
				err := analyzer.Analyze()
				Ω(err).ShouldNot(HaveOccurred())
			})

			BeforeEach(func() {
				heartbeat = dea.HeartbeatWith(app.CrashedInstanceHeartbeatAtIndex(0), app.CrashedInstanceHeartbeatAtIndex(0))
				store.SyncHeartbeats(heartbeat)
			})

			Context("when the app is desired", func() {
				BeforeEach(func() {
					store.SyncDesiredState(
						app.DesiredState(1),
					)
				})

				It("should not try to stop crashed instances", func() {
					Ω(stopMessages()).Should(BeEmpty())
				})

				It("should try to start the instance immediately", func() {
開發者ID:nagyistge,項目名稱:hm9000,代碼行數:31,代碼來源:analyzer_test.go

示例2:

		dea               appfixture.DeaFixture
		a                 appfixture.AppFixture
		crashingHeartbeat models.Heartbeat
	)

	BeforeEach(func() {
		dea = appfixture.NewDeaFixture()
		a = dea.GetApp(0)
	})

	Describe("when all instances are crashed", func() {
		BeforeEach(func() {
			simulator.SetDesiredState(a.DesiredState(3))

			crashingHeartbeat = dea.HeartbeatWith(
				a.CrashedInstanceHeartbeatAtIndex(0),
				a.CrashedInstanceHeartbeatAtIndex(1),
				a.CrashedInstanceHeartbeatAtIndex(2),
			)

			simulator.SetCurrentHeartbeats(crashingHeartbeat)
			simulator.Tick(simulator.TicksToAttainFreshness)
		})

		It("should only try to start instance at index 0", func() {
			Ω(startStopListener.Starts).Should(HaveLen(1))
			Ω(startStopListener.Starts[0].AppVersion).Should(Equal(a.AppVersion))
			Ω(startStopListener.Starts[0].InstanceIndex).Should(Equal(0))
		})

		It("should never try to stop crashes", func() {
開發者ID:KeyOfSpectator,項目名稱:hm9000,代碼行數:31,代碼來源:crashes_test.go

示例3:

				})

				Context("when there is no running instance reporting at that index", func() {
					BeforeEach(func() {
						store.SyncHeartbeats(dea.HeartbeatWith(
							app.InstanceAtIndex(1).Heartbeat(),
							app.InstanceAtIndex(2).Heartbeat(),
						))
					})
					assertMessageWasSent()
				})

				Context("when there are crashed instances reporting at that index", func() {
					BeforeEach(func() {
						store.SyncHeartbeats(dea.HeartbeatWith(
							app.CrashedInstanceHeartbeatAtIndex(0),
							app.CrashedInstanceHeartbeatAtIndex(0),
							app.InstanceAtIndex(1).Heartbeat(),
							app.InstanceAtIndex(2).Heartbeat(),
						))
					})

					assertMessageWasSent()
				})

				Context("when there *is* a running instance reporting at that index", func() {
					BeforeEach(func() {
						store.SyncHeartbeats(dea.HeartbeatWith(
							app.InstanceAtIndex(0).Heartbeat(),
						))
					})
開發者ID:tomzhang,項目名稱:golang-devops-stuff,代碼行數:31,代碼來源:sender_test.go


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