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