BeforeEach(func() { fakeDriverFactory = new(volmanfakes.FakeDriverFactory) fakeClock = fakeclock.NewFakeClock(time.Unix(123, 456)) scanInterval = 1 * time.Second driverRegistry = vollocal.NewDriverRegistry() }) Describe("ListDrivers", func() { BeforeEach(func() { driverSyncer = vollocal.NewDriverSyncerWithDriverFactory(logger, driverRegistry, []string{"/somePath"}, scanInterval, fakeClock, fakeDriverFactory) client = vollocal.NewLocalClient(logger, driverRegistry, fakeClock) process = ginkgomon.Invoke(driverSyncer.Runner()) }) It("should report empty list of drivers", func() { drivers, err := client.ListDrivers(logger) Expect(err).NotTo(HaveOccurred()) Expect(len(drivers.Drivers)).To(Equal(0)) }) Context("has no drivers in location", func() { BeforeEach(func() { fakeDriverFactory = new(volmanfakes.FakeDriverFactory) }) It("should report empty list of drivers", func() {
registry = vollocal.NewDriverRegistry() syncer = vollocal.NewDriverSyncerWithDriverFactory(logger, registry, []string{defaultPluginsDirectory}, scanInterval, fakeClock, fakeDriverFactory) fakeDriver = new(voldriverfakes.FakeDriver) fakeDriver.ActivateReturns(voldriver.ActivateResponse{ Implements: []string{"VolumeDriver"}, }) fakeDriverFactory.DriverReturns(fakeDriver, nil) driverName = "some-driver-name" }) Describe("#Runner", func() { It("has a non-nil runner", func() { Expect(syncer.Runner()).NotTo(BeNil()) }) It("has a non-nil and empty driver registry", func() { Expect(registry).NotTo(BeNil()) Expect(len(registry.Drivers())).To(Equal(0)) }) }) Describe("#Run", func() { Context("when there are no drivers", func() { It("should have no drivers in registry map", func() { drivers := registry.Drivers() Expect(len(drivers)).To(Equal(0)) Expect(fakeDriverFactory.DriverCallCount()).To(Equal(0)) })