func init() { Describe("Testing with Ginkgo", func() { var ( logger boshlog.Logger platform *fakeplatform.FakePlatform ) BeforeEach(func() { platform = fakeplatform.NewFakePlatform() logger = boshlog.NewLogger(boshlog.LEVEL_NONE) }) It("list disk should be synchronous", func() { settings := &fakesettings.FakeSettingsService{} action := NewListDisk(settings, platform, logger) Expect(action.IsAsynchronous()).To(BeFalse()) }) It("is not persistent", func() { settings := &fakesettings.FakeSettingsService{} action := NewListDisk(settings, platform, logger) Expect(action.IsPersistent()).To(BeFalse()) }) It("list disk run", func() { settings := &fakesettings.FakeSettingsService{ Disks: boshsettings.Disks{ Persistent: map[string]string{ "volume-1": "/dev/sda", "volume-2": "/dev/sdb", "volume-3": "/dev/sdc", }, }, } platform.MountedDevicePaths = []string{"/dev/sdb", "/dev/sdc"} action := NewListDisk(settings, platform, logger) value, err := action.Run() Expect(err).ToNot(HaveOccurred()) boshassert.MatchesJsonString(GinkgoT(), value, `["volume-2","volume-3"]`) }) }) }
func init() { Describe("ListDisk", func() { var ( settingsService *fakesettings.FakeSettingsService platform *fakeplatform.FakePlatform logger boshlog.Logger action ListDiskAction ) BeforeEach(func() { settingsService = &fakesettings.FakeSettingsService{} platform = fakeplatform.NewFakePlatform() logger = boshlog.NewLogger(boshlog.LevelNone) action = NewListDisk(settingsService, platform, logger) }) It("list disk should be synchronous", func() { Expect(action.IsAsynchronous()).To(BeFalse()) }) It("is not persistent", func() { Expect(action.IsPersistent()).To(BeFalse()) }) It("list disk run", func() { platform.MountedDevicePaths = []string{"/dev/sdb", "/dev/sdc"} settingsService.Settings.Disks = boshsettings.Disks{ Persistent: map[string]string{ "volume-1": "/dev/sda", "volume-2": "/dev/sdb", "volume-3": "/dev/sdc", }, } value, err := action.Run() Expect(err).ToNot(HaveOccurred()) boshassert.MatchesJSONString(GinkgoT(), value, `["volume-2","volume-3"]`) }) }) }