本文整理汇总了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()