本文整理匯總了Golang中github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes.FakeFileSystem.ReadLink方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeFileSystem.ReadLink方法的具體用法?Golang FakeFileSystem.ReadLink怎麽用?Golang FakeFileSystem.ReadLink使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes.FakeFileSystem
的用法示例。
在下文中一共展示了FakeFileSystem.ReadLink方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: describeLinuxPlatform
//.........這裏部分代碼省略.........
Context("when device path cannot be resolved", func() {
BeforeEach(func() {
devicePathResolver.GetRealDevicePathErr = errors.New("fake-get-real-device-path-err")
devicePathResolver.GetRealDevicePathTimedOut = false
})
It("returns error", func() {
isMounted, err := act()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-get-real-device-path-err"))
Expect(isMounted).To(BeFalse())
})
})
Context("when device path cannot be resolved due to timeout", func() {
BeforeEach(func() {
devicePathResolver.GetRealDevicePathErr = errors.New("fake-get-real-device-path-err")
devicePathResolver.GetRealDevicePathTimedOut = true
})
It("does not return error", func() {
isMounted, err := act()
Expect(err).NotTo(HaveOccurred())
Expect(isMounted).To(BeFalse())
})
})
})
Describe("StartMonit", func() {
It("creates a symlink between /etc/service/monit and /etc/sv/monit", func() {
err := platform.StartMonit()
Expect(err).NotTo(HaveOccurred())
target, _ := fs.ReadLink(filepath.Join("/etc", "service", "monit"))
Expect(target).To(Equal(filepath.Join("/etc", "sv", "monit")))
})
It("retries to start monit", func() {
err := platform.StartMonit()
Expect(err).NotTo(HaveOccurred())
Expect(monitRetryStrategy.TryCalled).To(BeTrue())
})
It("returns error if retrying to start monit fails", func() {
monitRetryStrategy.TryErr = errors.New("fake-retry-monit-error")
err := platform.StartMonit()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-retry-monit-error"))
})
})
Describe("SetupMonitUser", func() {
It("setup monit user if file does not exist", func() {
err := platform.SetupMonitUser()
Expect(err).NotTo(HaveOccurred())
monitUserFileStats := fs.GetFileTestStat("/fake-dir/monit/monit.user")
Expect(monitUserFileStats).ToNot(BeNil())
Expect(monitUserFileStats.StringContents()).To(Equal("vcap:random-password"))
})
It("setup monit user if file does exist", func() {
fs.WriteFileString("/fake-dir/monit/monit.user", "vcap:other-random-password")
err := platform.SetupMonitUser()