本文整理匯總了Golang中github.com/cloudfoundry/bosh-utils/system/fakes.FakeFileSystem.WalkErr方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeFileSystem.WalkErr方法的具體用法?Golang FakeFileSystem.WalkErr怎麽用?Golang FakeFileSystem.WalkErr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/bosh-utils/system/fakes.FakeFileSystem
的用法示例。
在下文中一共展示了FakeFileSystem.WalkErr方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: init
//.........這裏部分代碼省略.........
Expect(err).ToNot(HaveOccurred())
Expect(blobstore.GetBlobIDs[0]).To(Equal("fake-blobstore-id"))
Expect(blobstore.GetFingerprints[0]).To(Equal(boshcrypto.NewDigest("sha1", "fake-blob-sha1")))
})
It("can process sha2 checksums", func() {
blobstore.GetFileName = "/fake-blobstore-file-name"
job.Source.Sha1 = "sha256:fake-blob-sha256"
err := act()
Expect(err).ToNot(HaveOccurred())
Expect(blobstore.GetBlobIDs[0]).To(Equal("fake-blobstore-id"))
Expect(blobstore.GetFingerprints[0]).To(Equal(boshcrypto.NewDigest("sha256", "fake-blob-sha256")))
})
It("returns error when given and unsupported fingerprint", func() {
blobstore.GetFileName = "/fake-blobstore-file-name"
job.Source.Sha1 = "unsupported:checksum"
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("Parsing job blob digest"))
})
It("returns error when decompressing job template fails", func() {
compressor.DecompressFileToDirErr = errors.New("fake-decompress-error")
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-decompress-error"))
})
It("returns error when walking the tree of files fails", func() {
fs.WalkErr = errors.New("fake-walk-error")
err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-walk-error"))
})
It("installs bundle from decompressed tmp path of a job template", func() {
var installedBeforeDecompression bool
compressor.DecompressFileToDirCallBack = func() {
installedBeforeDecompression = bundle.Installed
}
err := act()
Expect(err).ToNot(HaveOccurred())
// bundle installation did not happen before decompression
Expect(installedBeforeDecompression).To(BeFalse())
// make sure that bundle install happened after decompression
Expect(bundle.InstallSourcePath).To(Equal("/fake-tmp-dir/fake-path-in-archive"))
})
It("sets executable bit for the bin and config directories", func() {
var binDirStats, configDirStats *fakesys.FakeFileStats
compressor.DecompressFileToDirCallBack = func() {
fs.WriteFile("/fake-tmp-dir/fake-path-in-archive/bin/blarg", []byte{})
fs.WriteFile("/fake-tmp-dir/fake-path-in-archive/config/blarg.yml", []byte{})
}
bundle.InstallCallBack = func() {
binDirStats = fs.GetFileTestStat("/fake-tmp-dir/fake-path-in-archive/bin")