}) }) Context("has driver in location", func() { BeforeEach(func() { err := voldriver.WriteDriverSpec(logger, defaultPluginsDirectory, "fakedriver", "spec", []byte("http://0.0.0.0:8080")) Expect(err).NotTo(HaveOccurred()) driverSyncer = vollocal.NewDriverSyncerWithDriverFactory(logger, driverRegistry, []string{defaultPluginsDirectory}, scanInterval, fakeClock, fakeDriverFactory) client = vollocal.NewLocalClient(logger, driverRegistry, fakeClock) fakeDriver := new(voldriverfakes.FakeDriver) fakeDriverFactory.DriverReturns(fakeDriver, nil) fakeDriver.ActivateReturns(voldriver.ActivateResponse{Implements: []string{"VolumeDriver"}}) }) 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("after running drivers discovery", func() { BeforeEach(func() { process = ginkgomon.Invoke(driverSyncer.Runner()) }) AfterEach(func() { ginkgomon.Kill(process)
) BeforeEach(func() { logger = lagertest.NewTestLogger("driver-syncer-test") fakeClock = fakeclock.NewFakeClock(time.Unix(123, 456)) fakeDriverFactory = new(volmanfakes.FakeDriverFactory) scanInterval = 10 * time.Second 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))