本文整理匯總了Golang中github.com/cloudfoundry/bosh-agent/system/fakes.FakeFileSystem.OpenFileErr方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeFileSystem.OpenFileErr方法的具體用法?Golang FakeFileSystem.OpenFileErr怎麽用?Golang FakeFileSystem.OpenFileErr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/bosh-agent/system/fakes.FakeFileSystem
的用法示例。
在下文中一共展示了FakeFileSystem.OpenFileErr方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
It("executes given command", func() {
_, err := runner.RunCommand("fake-log-dir-name", "fake-log-file-name", cmd)
Expect(err).ToNot(HaveOccurred())
Expect(cmdRunner.RunComplexCommands).To(HaveLen(1))
actualCmd := cmdRunner.RunComplexCommands[0]
Expect(actualCmd.Name).To(Equal("fake-cmd"))
Expect(actualCmd.Args).To(Equal([]string{"fake-args"}))
Expect(actualCmd.Env).To(Equal(map[string]string{"fake-env-key": "fake-env-var"}))
Expect(actualCmd.WorkingDir).To(Equal("/fake-working-dir"))
})
It("returns an error if it fails to save output", func() {
fs.OpenFileErr = errors.New("fake-open-file-error")
_, err := runner.RunCommand("fake-log-dir-name", "fake-log-file-name", cmd)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-open-file-error"))
})
Context("when command succeeds", func() {
BeforeEach(func() {
cmdRunner.AddCmdResult("fake-cmd fake-args", fakesys.FakeCmdResult{
Stdout: "fake-stdout",
Stderr: "fake-stderr",
ExitStatus: 0,
})
})