本文整理汇总了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() {
示例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() {
示例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(),
))
})