當前位置: 首頁>>代碼示例>>Golang>>正文


Golang FakePlatform.SetIsPersistentDiskPartitioned方法代碼示例

本文整理匯總了Golang中github.com/cloudfoundry/bosh-agent/platform/fakes.FakePlatform.SetIsPersistentDiskPartitioned方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakePlatform.SetIsPersistentDiskPartitioned方法的具體用法?Golang FakePlatform.SetIsPersistentDiskPartitioned怎麽用?Golang FakePlatform.SetIsPersistentDiskPartitioned使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cloudfoundry/bosh-agent/platform/fakes.FakePlatform的用法示例。


在下文中一共展示了FakePlatform.SetIsPersistentDiskPartitioned方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: init


//.........這裏部分代碼省略.........
					It("returns error", func() {
						settingsService.Settings.Disks = boshsettings.Disks{
							Persistent: map[string]interface{}{
								"vol-123": "/dev/sdb",
								"vol-456": "/dev/sdc",
							},
						}

						err := bootstrap()
						Expect(err).To(HaveOccurred())
					})
				})

				Context("when there is no persistent disk", func() {
					It("does not try to mount ", func() {
						settingsService.Settings.Disks = boshsettings.Disks{
							Persistent: map[string]interface{}{},
						}

						err := bootstrap()
						Expect(err).NotTo(HaveOccurred())
						Expect(platform.MountPersistentDiskSettings).To(Equal(boshsettings.DiskSettings{}))
						Expect(platform.MountPersistentDiskMountPoint).To(Equal(""))
					})
				})

				Context("when there is no drive specified by settings", func() {
					It("returns error", func() {
						settingsService.Settings.Disks = boshsettings.Disks{
							Persistent: map[string]interface{}{
								"vol-123": "/dev/not-exists",
							},
						}
						platform.SetIsPersistentDiskPartitioned(false, errors.New("Drive not exist!"))

						err := bootstrap()
						Expect(err).To(HaveOccurred())
						Expect(platform.MountPersistentDiskSettings).To(Equal(boshsettings.DiskSettings{}))
						Expect(platform.MountPersistentDiskMountPoint).To(Equal(""))
					})
				})

				Context("when there is no partition on drive specified by settings", func() {
					It("does not try to mount ", func() {
						settingsService.Settings.Disks = boshsettings.Disks{
							Persistent: map[string]interface{}{
								"vol-123": "/dev/valid",
							},
						}
						platform.SetIsPersistentDiskPartitioned(false, nil)

						err := bootstrap()
						Expect(err).NotTo(HaveOccurred())
						Expect(platform.MountPersistentDiskSettings).To(Equal(boshsettings.DiskSettings{}))
						Expect(platform.MountPersistentDiskMountPoint).To(Equal(""))
					})
				})

				Context("when specified disk has partition", func() {
					It("mounts persistent disk", func() {
						settingsService.Settings.Disks = boshsettings.Disks{
							Persistent: map[string]interface{}{
								"vol-123": map[string]interface{}{
									"volume_id": "2",
									"path":      "/dev/sdb",
								},
開發者ID:EMC-CMD,項目名稱:bosh-agent,代碼行數:67,代碼來源:bootstrap_test.go


注:本文中的github.com/cloudfoundry/bosh-agent/platform/fakes.FakePlatform.SetIsPersistentDiskPartitioned方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。