本文整理汇总了Golang中github.com/cloudfoundry/bosh-agent/agent/applier/applyspec/fakes.FakeV1Service.PopulateDynamicNetworksErr方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeV1Service.PopulateDynamicNetworksErr方法的具体用法?Golang FakeV1Service.PopulateDynamicNetworksErr怎么用?Golang FakeV1Service.PopulateDynamicNetworksErr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/bosh-agent/agent/applier/applyspec/fakes.FakeV1Service
的用法示例。
在下文中一共展示了FakeV1Service.PopulateDynamicNetworksErr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: init
//.........这里部分代码省略.........
Context("when saving populated desires spec as current spec fails", func() {
It("returns error because agent was not able to remember that is converged to desired spec", func() {
specService.SetErr = errors.New("fake-set-error")
_, err := action.Run(desiredApplySpec)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-set-error"))
})
})
})
Context("when applier fails applying desired spec", func() {
BeforeEach(func() {
applier.ApplyError = errors.New("fake-apply-error")
})
It("returns error", func() {
_, err := action.Run(desiredApplySpec)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-apply-error"))
})
It("does not save desired spec as current spec", func() {
_, err := action.Run(desiredApplySpec)
Expect(err).To(HaveOccurred())
Expect(specService.Spec).To(Equal(currentApplySpec))
})
})
})
Context("when resolving dynamic networks fails", func() {
BeforeEach(func() {
specService.PopulateDynamicNetworksErr = errors.New("fake-populate-dynamic-networks-err")
})
It("returns error", func() {
_, err := action.Run(desiredApplySpec)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-populate-dynamic-networks-err"))
})
It("does not apply desired spec as current spec", func() {
_, err := action.Run(desiredApplySpec)
Expect(err).To(HaveOccurred())
Expect(applier.Applied).To(BeFalse())
})
It("does not save desired spec as current spec", func() {
_, err := action.Run(desiredApplySpec)
Expect(err).To(HaveOccurred())
Expect(specService.Spec).To(Equal(currentApplySpec))
})
})
})
Context("when current spec cannot be retrieved", func() {
BeforeEach(func() {
specService.Spec = currentApplySpec
specService.GetErr = errors.New("fake-get-error")
})
It("returns error and does not apply desired spec", func() {
_, err := action.Run(desiredApplySpec)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-get-error"))