本文整理匯總了Golang中github.com/cloudfoundry/bosh-agent/system/fakes.FakeFileSystem.MkdirAllError方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeFileSystem.MkdirAllError方法的具體用法?Golang FakeFileSystem.MkdirAllError怎麽用?Golang FakeFileSystem.MkdirAllError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/bosh-agent/system/fakes.FakeFileSystem
的用法示例。
在下文中一共展示了FakeFileSystem.MkdirAllError方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
_, err = runner.RunCommand("fake-log-dir-name", "fake-log-file-name", cmd)
Expect(err).ToNot(HaveOccurred())
Expect(fs.FileExists("/fake-base-dir/fake-log-dir-name/old-file")).To(BeFalse())
})
It("returns an error if it fails to remove previous logs directory", func() {
fs.RemoveAllError = errors.New("fake-remove-all-error")
_, err := runner.RunCommand("fake-log-dir-name", "fake-log-file-name", cmd)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-remove-all-error"))
})
It("returns an error if it fails to create logs directory", func() {
fs.MkdirAllError = errors.New("fake-mkdir-all-error")
_, err := runner.RunCommand("fake-log-dir-name", "fake-log-file-name", cmd)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-mkdir-all-error"))
})
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"}))