本文整理匯總了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(),
))
})