当前位置: 首页>>代码示例>>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;未经允许,请勿转载。