本文整理匯總了Golang中bosh/settings/fakes.FakeSettingsService.Disks方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeSettingsService.Disks方法的具體用法?Golang FakeSettingsService.Disks怎麽用?Golang FakeSettingsService.Disks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類bosh/settings/fakes.FakeSettingsService
的用法示例。
在下文中一共展示了FakeSettingsService.Disks方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: init
func init() {
Describe("bootstrap", func() {
Describe("Run", func() {
var (
inf *fakeinf.FakeInfrastructure
platform *fakeplatform.FakePlatform
dirProvider boshdir.DirectoriesProvider
settingsServiceProvider *fakesettings.FakeSettingsServiceProvider
settingsService *fakesettings.FakeSettingsService
)
BeforeEach(func() {
inf = &fakeinf.FakeInfrastructure{
GetEphemeralDiskPathFound: true,
GetEphemeralDiskPathRealPath: "/dev/sdz",
}
platform = fakeplatform.NewFakePlatform()
dirProvider = boshdir.NewDirectoriesProvider("/var/vcap")
settingsServiceProvider = fakesettings.NewServiceProvider()
settingsService = settingsServiceProvider.NewServiceSettingsService
})
bootstrap := func() (boshsettings.Service, error) {
logger := boshlog.NewLogger(boshlog.LevelNone)
return New(inf, platform, dirProvider, settingsServiceProvider, logger).Run()
}
It("sets up runtime configuration", func() {
_, err := bootstrap()
Expect(err).NotTo(HaveOccurred())
Expect(platform.SetupRuntimeConfigurationWasInvoked).To(BeTrue())
})
It("sets up ssh", func() {
_, err := bootstrap()
Expect(err).NotTo(HaveOccurred())
Expect(inf.SetupSshUsername).To(Equal("vcap"))
})
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("returns the settings service", func() {
settingsService, err := bootstrap()
Expect(err).NotTo(HaveOccurred())
Expect(settingsService).To(Equal(settingsService))
Expect(settingsServiceProvider.NewServiceFs).To(Equal(platform.GetFs()))
Expect(settingsServiceProvider.NewServiceDir).To(Equal(dirProvider.BoshDir()))
fetchedSettings, err := settingsServiceProvider.NewServiceFetcher()
Expect(err).NotTo(HaveOccurred())
Expect(fetchedSettings).To(Equal(inf.Settings))
})
It("fetches initial settings", func() {
_, err := bootstrap()
Expect(err).NotTo(HaveOccurred())
Expect(settingsService.SettingsWereLoaded).To(BeTrue())
})
It("returns error from loading initial settings", func() {
settingsService.LoadSettingsError = errors.New("fake-load-error")
_, err := bootstrap()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-load-error"))
})
It("sets up networking", func() {
networks := boshsettings.Networks{
"bosh": boshsettings.Network{},
}
settingsService.Settings.Networks = networks
_, err := bootstrap()
Expect(err).NotTo(HaveOccurred())
Expect(inf.SetupNetworkingNetworks).To(Equal(networks))
})
It("sets up ephemeral disk", func() {
settingsService.Disks = boshsettings.Disks{
Ephemeral: "fake-ephemeral-disk-setting",
}
inf.GetEphemeralDiskPathRealPath = "/dev/sda"
inf.GetEphemeralDiskPathFound = true
_, err := bootstrap()
Expect(err).NotTo(HaveOccurred())
Expect(platform.SetupEphemeralDiskWithPathDevicePath).To(Equal("/dev/sda"))
Expect(inf.GetEphemeralDiskPathDevicePath).To(Equal("fake-ephemeral-disk-setting"))
})
//.........這裏部分代碼省略.........