本文整理汇总了Golang中github.com/cloudfoundry/bosh-agent/platform/fakes.FakePlatform.GetPersistentDiskFS方法的典型用法代码示例。如果您正苦于以下问题:Golang FakePlatform.GetPersistentDiskFS方法的具体用法?Golang FakePlatform.GetPersistentDiskFS怎么用?Golang FakePlatform.GetPersistentDiskFS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/bosh-agent/platform/fakes.FakePlatform
的用法示例。
在下文中一共展示了FakePlatform.GetPersistentDiskFS方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: init
func init() {
Describe("bootstrap", func() {
Describe("Run", func() {
var (
platform *fakeplatform.FakePlatform
dirProvider boshdir.Provider
settingsSource *fakeinf.FakeSettingsSource
settingsService *fakesettings.FakeSettingsService
)
BeforeEach(func() {
platform = fakeplatform.NewFakePlatform()
dirProvider = boshdir.NewProvider("/var/vcap")
settingsSource = &fakeinf.FakeSettingsSource{}
settingsService = &fakesettings.FakeSettingsService{}
})
bootstrap := func() error {
logger := boshlog.NewLogger(boshlog.LevelNone)
return NewBootstrap(platform, dirProvider, settingsService, logger).Run()
}
It("sets up runtime configuration", func() {
err := bootstrap()
Expect(err).NotTo(HaveOccurred())
Expect(platform.SetupRuntimeConfigurationWasInvoked).To(BeTrue())
})
Describe("SSH tunnel setup for registry", func() {
It("returns error without configuring ssh on the platform if getting public key fails", func() {
settingsService.PublicKeyErr = errors.New("fake-get-public-key-err")
err := bootstrap()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-get-public-key-err"))
Expect(platform.SetupSSHCalled).To(BeFalse())
})
Context("when public key is not empty", func() {
BeforeEach(func() {
settingsService.PublicKey = "fake-public-key"
})
It("gets the public key and sets up ssh via the platform", func() {
err := bootstrap()
Expect(err).NotTo(HaveOccurred())
Expect(platform.SetupSSHPublicKey).To(Equal("fake-public-key"))
Expect(platform.SetupSSHUsername).To(Equal("vcap"))
})
It("returns error if configuring ssh on the platform fails", func() {
platform.SetupSSHErr = errors.New("fake-setup-ssh-err")
err := bootstrap()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-setup-ssh-err"))
})
})
Context("when public key key is empty", func() {
BeforeEach(func() {
settingsSource.PublicKey = ""
})
It("gets the public key and does not setup SSH", func() {
err := bootstrap()
Expect(err).NotTo(HaveOccurred())
Expect(platform.SetupSSHCalled).To(BeFalse())
})
})
})
It("sets up hostname", func() {
settingsService.Settings.AgentID = "foo-bar-baz-123"
err := bootstrap()
Expect(err).NotTo(HaveOccurred())
Expect(platform.SetupHostnameHostname).To(Equal("foo-bar-baz-123"))
})
It("sets persistent disk filesystem", func() {
settingsService.Settings.Env.PersistentDiskFS = "ext4"
err := bootstrap()
Expect(err).NotTo(HaveOccurred())
Expect(platform.GetPersistentDiskFS()).To(Equal("ext4"))
})
It("fetches initial settings", func() {
err := bootstrap()
Expect(err).NotTo(HaveOccurred())
Expect(settingsService.SettingsWereLoaded).To(BeTrue())
})
It("returns error from loading initial settings", func() {
//.........这里部分代码省略.........