func NewProvider(logger boshlog.Logger, dirProvider boshdirs.DirectoriesProvider) (p provider) { runner := boshsys.NewExecCmdRunner(logger) fs := boshsys.NewOsFileSystem(logger, runner) sigarCollector := boshstats.NewSigarStatsCollector() linuxDiskManager := boshdisk.NewLinuxDiskManager(logger, runner, fs) udev := boshudev.NewConcreteUdevDevice(runner) linuxCdrom := boshcdrom.NewLinuxCdrom("/dev/sr0", udev, runner) linuxCdutil := boshcd.NewCdUtil(dirProvider.SettingsDir(), fs, linuxCdrom) compressor := boshcmd.NewTarballCompressor(runner, fs) copier := boshcmd.NewCpCopier(runner, fs) vitalsService := boshvitals.NewService(sigarCollector, dirProvider) centosNetManager := boshnet.NewCentosNetManager(fs, runner, 10*time.Second) ubuntuNetManager := boshnet.NewUbuntuNetManager(fs, runner, 10*time.Second) centos := NewLinuxPlatform( fs, runner, sigarCollector, compressor, copier, dirProvider, vitalsService, linuxCdutil, linuxDiskManager, centosNetManager, 500*time.Millisecond, logger, ) ubuntu := NewLinuxPlatform( fs, runner, sigarCollector, compressor, copier, dirProvider, vitalsService, linuxCdutil, linuxDiskManager, ubuntuNetManager, 500*time.Millisecond, logger, ) p.platforms = map[string]Platform{ "ubuntu": ubuntu, "centos": centos, "dummy": NewDummyPlatform(sigarCollector, fs, runner, dirProvider, linuxDiskManager), } return }
func (app *app) buildApplierAndCompiler( dirProvider boshdirs.DirectoriesProvider, blobstore boshblob.Blobstore, jobSupervisor boshjobsuper.JobSupervisor, ) (boshapplier.Applier, boshcomp.Compiler) { jobsBc := boshbc.NewFileBundleCollection( dirProvider.DataDir(), dirProvider.BaseDir(), "jobs", app.platform.GetFs(), app.logger, ) packageApplierProvider := boshpa.NewConcretePackageApplierProvider( dirProvider.DataDir(), dirProvider.BaseDir(), dirProvider.JobsDir(), "packages", blobstore, app.platform.GetCompressor(), app.platform.GetFs(), app.logger, ) jobApplier := boshja.NewRenderedJobApplier( jobsBc, jobSupervisor, packageApplierProvider, blobstore, app.platform.GetCompressor(), app.platform.GetFs(), app.logger, ) applier := boshapplier.NewConcreteApplier( jobApplier, packageApplierProvider.Root(), app.platform, jobSupervisor, dirProvider, ) compiler := boshcomp.NewConcreteCompiler( app.platform.GetCompressor(), blobstore, app.platform.GetFs(), app.platform.GetRunner(), dirProvider, packageApplierProvider.Root(), packageApplierProvider.RootBundleCollection(), ) return applier, compiler }
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")) }) It("returns error if setting ephemeral disk fails", func() { platform.SetupEphemeralDiskWithPathErr = errors.New("fake-setup-ephemeral-disk-err") _, err := bootstrap() Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-setup-ephemeral-disk-err")) }) It("sets up data dir", func() { _, err := bootstrap() Expect(err).NotTo(HaveOccurred()) Expect(platform.SetupDataDirCalled).To(BeTrue()) }) It("returns error if set up of data dir fails", func() { platform.SetupDataDirErr = errors.New("fake-setup-data-dir-err") _, err := bootstrap() Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-setup-data-dir-err")) }) It("sets up tmp dir", func() { _, err := bootstrap() Expect(err).NotTo(HaveOccurred()) Expect(platform.SetupTmpDirCalled).To(BeTrue()) }) It("returns error if set up of tmp dir fails", func() { platform.SetupTmpDirErr = errors.New("fake-setup-tmp-dir-err") _, err := bootstrap() Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-setup-tmp-dir-err")) }) It("mounts persistent disk", func() { settingsService.Disks = boshsettings.Disks{ Persistent: map[string]string{"vol-123": "/dev/sdb"}, } _, err := bootstrap() Expect(err).NotTo(HaveOccurred()) Expect(platform.MountPersistentDiskDevicePath).To(Equal("/dev/sdb")) Expect(platform.MountPersistentDiskMountPoint).To(Equal(dirProvider.StoreDir())) }) It("errors if there is more than one persistent disk", func() { settingsService.Disks = boshsettings.Disks{ Persistent: map[string]string{ "vol-123": "/dev/sdb", "vol-456": "/dev/sdc", }, } _, err := bootstrap() Expect(err).To(HaveOccurred()) }) It("does not try to mount when no persistent disk", func() { settingsService.Disks = boshsettings.Disks{ Persistent: map[string]string{}, } _, err := bootstrap() Expect(err).NotTo(HaveOccurred()) Expect(platform.MountPersistentDiskDevicePath).To(Equal("")) Expect(platform.MountPersistentDiskMountPoint).To(Equal("")) }) It("sets root and vcap passwords", func() { settingsService.Settings.Env.Bosh.Password = "******" _, err := bootstrap() Expect(err).NotTo(HaveOccurred()) Expect(2).To(Equal(len(platform.UserPasswords))) Expect("some-encrypted-password").To(Equal(platform.UserPasswords["root"])) Expect("some-encrypted-password").To(Equal(platform.UserPasswords["vcap"])) }) It("does not set password if not provided", func() { _, err := bootstrap() Expect(err).NotTo(HaveOccurred()) Expect(0).To(Equal(len(platform.UserPasswords))) }) It("sets ntp", func() { settingsService.Settings.Ntp = []string{ "0.north-america.pool.ntp.org", "1.north-america.pool.ntp.org", } _, err := bootstrap() Expect(err).NotTo(HaveOccurred()) Expect(2).To(Equal(len(platform.SetTimeWithNtpServersServers))) Expect("0.north-america.pool.ntp.org").To(Equal(platform.SetTimeWithNtpServersServers[0])) Expect("1.north-america.pool.ntp.org").To(Equal(platform.SetTimeWithNtpServersServers[1])) }) It("setups up monit user", func() { _, err := bootstrap() Expect(err).NotTo(HaveOccurred()) Expect(platform.SetupMonitUserSetup).To(BeTrue()) }) It("starts monit", func() { _, err := bootstrap() Expect(err).NotTo(HaveOccurred()) Expect(platform.StartMonitStarted).To(BeTrue()) }) }) }) }
func NewProvider(logger boshlog.Logger, dirProvider boshdirs.DirectoriesProvider, options ProviderOptions) (p provider) { runner := boshsys.NewExecCmdRunner(logger) fs := boshsys.NewOsFileSystem(logger) linuxDiskManager := boshdisk.NewLinuxDiskManager(logger, runner, fs, options.Linux.BindMountPersistentDisk) udev := boshudev.NewConcreteUdevDevice(runner) linuxCdrom := boshcdrom.NewLinuxCdrom("/dev/sr0", udev, runner) linuxCdutil := boshcd.NewCdUtil(dirProvider.SettingsDir(), fs, linuxCdrom) compressor := boshcmd.NewTarballCompressor(runner, fs) copier := boshcmd.NewCpCopier(runner, fs, logger) sigarCollector := boshstats.NewSigarStatsCollector(&sigar.ConcreteSigar{}) // Kick of stats collection as soon as possible go sigarCollector.StartCollecting(SigarStatsCollectionInterval, nil) vitalsService := boshvitals.NewService(sigarCollector, dirProvider) routesSearcher := boshnet.NewCmdRoutesSearcher(runner) ipResolver := boship.NewIPResolver(boship.NetworkInterfaceToAddrsFunc) defaultNetworkResolver := boshnet.NewDefaultNetworkResolver(routesSearcher, ipResolver) arping := bosharp.NewArping(runner, fs, logger, ArpIterations, ArpIterationDelay, ArpInterfaceCheckDelay) centosNetManager := boshnet.NewCentosNetManager(fs, runner, defaultNetworkResolver, ipResolver, arping, logger) ubuntuNetManager := boshnet.NewUbuntuNetManager(fs, runner, defaultNetworkResolver, ipResolver, arping, logger) centos := NewLinuxPlatform( fs, runner, sigarCollector, compressor, copier, dirProvider, vitalsService, linuxCdutil, linuxDiskManager, centosNetManager, 500*time.Millisecond, options.Linux, logger, ) ubuntu := NewLinuxPlatform( fs, runner, sigarCollector, compressor, copier, dirProvider, vitalsService, linuxCdutil, linuxDiskManager, ubuntuNetManager, 500*time.Millisecond, options.Linux, logger, ) p.platforms = map[string]Platform{ "ubuntu": ubuntu, "centos": centos, "dummy": NewDummyPlatform(sigarCollector, fs, runner, dirProvider, logger), } return }
func init() { Describe("monitJobSupervisor", func() { var ( fs *fakesys.FakeFileSystem runner *fakesys.FakeCmdRunner client *fakemonit.FakeMonitClient logger boshlog.Logger dirProvider boshdir.DirectoriesProvider jobFailuresServerPort int monit JobSupervisor ) BeforeEach(func() { fs = &fakesys.FakeFileSystem{} runner = &fakesys.FakeCmdRunner{} client = fakemonit.NewFakeMonitClient() logger = boshlog.NewLogger(boshlog.LevelNone) dirProvider = boshdir.NewDirectoriesProvider("/var/vcap") jobFailuresServerPort = getJobFailureServerPort() monit = NewMonitJobSupervisor( fs, runner, client, logger, dirProvider, jobFailuresServerPort, 0*time.Millisecond, ) }) It("waits until the job is reloaded", func() { client.Incarnations = []int{1, 1, 1, 2, 3} client.StatusStatus = fakemonit.FakeMonitStatus{ Services: []boshmonit.Service{ boshmonit.Service{Monitored: true, Status: "failing"}, boshmonit.Service{Monitored: true, Status: "running"}, }, Incarnation: 1, } err := monit.Reload() Expect(err).ToNot(HaveOccurred()) Expect(1).To(Equal(len(runner.RunCommands))) Expect(runner.RunCommands[0]).To(Equal([]string{"monit", "reload"})) Expect(client.StatusCalledTimes).To(Equal(4)) }) It("stops trying to reload after 60 attempts", func() { for i := 0; i < 61; i++ { client.Incarnations = append(client.Incarnations, 1) } client.StatusStatus = fakemonit.FakeMonitStatus{ Services: []boshmonit.Service{ boshmonit.Service{Monitored: true, Status: "failing"}, boshmonit.Service{Monitored: true, Status: "running"}, }, Incarnation: 1, } err := monit.Reload() Expect(err).To(HaveOccurred()) Expect(1).To(Equal(len(runner.RunCommands))) Expect(runner.RunCommands[0]).To(Equal([]string{"monit", "reload"})) Expect(client.StatusCalledTimes).To(Equal(60)) }) It("start starts each monit service in group vcap", func() { client.ServicesInGroupServices = []string{"fake-service"} err := monit.Start() Expect(err).ToNot(HaveOccurred()) Expect("vcap").To(Equal(client.ServicesInGroupName)) Expect(1).To(Equal(len(client.StartServiceNames))) Expect("fake-service").To(Equal(client.StartServiceNames[0])) }) It("stop stops each monit service in group vcap", func() { client.ServicesInGroupServices = []string{"fake-service"} err := monit.Stop() Expect(err).ToNot(HaveOccurred()) Expect("vcap").To(Equal(client.ServicesInGroupName)) Expect(1).To(Equal(len(client.StopServiceNames))) Expect("fake-service").To(Equal(client.StopServiceNames[0])) }) It("status returns running when all services are monitored and running", func() { client.StatusStatus = fakemonit.FakeMonitStatus{ Services: []boshmonit.Service{ boshmonit.Service{Monitored: true, Status: "running"}, boshmonit.Service{Monitored: true, Status: "running"}, }, } status := monit.Status() Expect("running").To(Equal(status)) }) It("status returns failing when all services are monitored and at least one service is failing", func() { client.StatusStatus = fakemonit.FakeMonitStatus{ Services: []boshmonit.Service{ boshmonit.Service{Monitored: true, Status: "failing"}, boshmonit.Service{Monitored: true, Status: "running"}, }, } status := monit.Status() Expect("failing").To(Equal(status)) }) It("status returns failing when at least one service is not monitored", func() { client.StatusStatus = fakemonit.FakeMonitStatus{ Services: []boshmonit.Service{ boshmonit.Service{Monitored: false, Status: "running"}, boshmonit.Service{Monitored: true, Status: "running"}, }, } status := monit.Status() Expect("failing").To(Equal(status)) }) It("status returns start when at least one service is starting", func() { client.StatusStatus = fakemonit.FakeMonitStatus{ Services: []boshmonit.Service{ boshmonit.Service{Monitored: true, Status: "failing"}, boshmonit.Service{Monitored: true, Status: "starting"}, boshmonit.Service{Monitored: true, Status: "running"}, }, } status := monit.Status() Expect("starting").To(Equal(status)) }) It("status returns unknown when error", func() { client.StatusErr = errors.New("fake-monit-client-error") status := monit.Status() Expect("unknown").To(Equal(status)) }) It("monitor job failures", func() { var handledAlert boshalert.MonitAlert failureHandler := func(alert boshalert.MonitAlert) (err error) { handledAlert = alert return } go monit.MonitorJobFailures(failureHandler) msg := `Message-id: <1304319946.0@localhost> Service: nats Event: does not exist Action: restart Date: Sun, 22 May 2011 20:07:41 +0500 Description: process is not running` err := doJobFailureEmail(msg, jobFailuresServerPort) Expect(err).ToNot(HaveOccurred()) assert.Equal(GinkgoT(), handledAlert, boshalert.MonitAlert{ ID: "1304319946.0@localhost", Service: "nats", Event: "does not exist", Action: "restart", Date: "Sun, 22 May 2011 20:07:41 +0500", Description: "process is not running", }) }) It("monitor job failures ignores other emails", func() { var didHandleAlert bool failureHandler := func(alert boshalert.MonitAlert) (err error) { didHandleAlert = true return } go monit.MonitorJobFailures(failureHandler) msg := `Hi! How'sit goin` err := doJobFailureEmail(msg, jobFailuresServerPort) Expect(err).ToNot(HaveOccurred()) Expect(didHandleAlert).To(BeFalse()) }) Describe("AddJob", func() { BeforeEach(func() { fs.WriteFileString("/some/config/path", "fake-config") }) Context("when reading configuration from config path succeeds", func() { Context("when writing job configuration succeeds", func() { It("returns no error because monit can track added job in jobs directory", func() { err := monit.AddJob("router", 0, "/some/config/path") Expect(err).ToNot(HaveOccurred()) writtenConfig, err := fs.ReadFileString( dirProvider.MonitJobsDir() + "/0000_router.monitrc") Expect(err).ToNot(HaveOccurred()) Expect(writtenConfig).To(Equal("fake-config")) }) }) Context("when writing job configuration fails", func() { It("returns error", func() { fs.WriteToFileError = errors.New("fake-write-error") err := monit.AddJob("router", 0, "/some/config/path") Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-write-error")) }) }) }) Context("when reading configuration from config path fails", func() { It("returns error", func() { fs.ReadFileError = errors.New("fake-read-error") err := monit.AddJob("router", 0, "/some/config/path") Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-read-error")) }) }) }) Describe("RemoveAllJobs", func() { Context("when jobs directory removal succeeds", func() { It("does not return error because all jobs are removed from monit", func() { jobsDir := dirProvider.MonitJobsDir() jobBasename := "/0000_router.monitrc" fs.WriteFileString(jobsDir+jobBasename, "fake-added-job") err := monit.RemoveAllJobs() Expect(err).ToNot(HaveOccurred()) Expect(fs.FileExists(jobsDir)).To(BeFalse()) Expect(fs.FileExists(jobsDir + jobBasename)).To(BeFalse()) }) }) Context("when jobs directory removal fails", func() { It("returns error if removing jobs directory fails", func() { fs.RemoveAllError = errors.New("fake-remove-all-error") err := monit.RemoveAllJobs() Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-remove-all-error")) }) }) }) Describe("Unmonitor", func() { BeforeEach(func() { client.ServicesInGroupServices = []string{"fake-srv-1", "fake-srv-2", "fake-srv-3"} client.UnmonitorServiceErrs = []error{nil, nil, nil} }) Context("when all services succeed to be unmonitored", func() { It("returns no error because all services got unmonitored", func() { err := monit.Unmonitor() Expect(err).ToNot(HaveOccurred()) Expect(client.ServicesInGroupName).To(Equal("vcap")) Expect(client.UnmonitorServiceNames).To(Equal( []string{"fake-srv-1", "fake-srv-2", "fake-srv-3"})) }) }) Context("when at least one service fails to be unmonitored", func() { BeforeEach(func() { client.UnmonitorServiceErrs = []error{ nil, errors.New("fake-unmonitor-error"), nil, } }) It("returns first unmonitor error", func() { err := monit.Unmonitor() Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-unmonitor-error")) }) It("only tries to unmonitor services before the first unmonitor error", func() { err := monit.Unmonitor() Expect(err).To(HaveOccurred()) Expect(client.ServicesInGroupName).To(Equal("vcap")) Expect(client.UnmonitorServiceNames).To(Equal([]string{"fake-srv-1", "fake-srv-2"})) }) }) Context("when failed retrieving list of services", func() { It("returns error", func() { client.ServicesInGroupErr = errors.New("fake-services-error") err := monit.Unmonitor() Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-services-error")) }) }) }) }) }
. "github.com/onsi/gomega" "github.com/stretchr/testify/assert" . "bosh/infrastructure" fakedpresolv "bosh/infrastructure/devicepathresolver/fakes" fakeplatform "bosh/platform/fakes" boshsettings "bosh/settings" boshdir "bosh/settings/directories" fakefs "bosh/system/fakes" ) var _ = Describe("dummyInfrastructure", func() { Describe("GetSettings", func() { var ( fs *fakefs.FakeFileSystem dirProvider boshdir.DirectoriesProvider inf Infrastructure ) BeforeEach(func() { fs = fakefs.NewFakeFileSystem() dirProvider = boshdir.NewDirectoriesProvider("/var/vcap") platform := fakeplatform.NewFakePlatform() fakeDevicePathResolver := fakedpresolv.NewFakeDevicePathResolver() inf = NewDummyInfrastructure(fs, dirProvider, platform, fakeDevicePathResolver) }) Context("when infrastructure settings file is found", func() { BeforeEach(func() { settingsPath := filepath.Join(dirProvider.BoshDir(), "dummy-cpi-agent-env.json")
func NewProvider(logger boshlog.Logger, dirProvider boshdirs.DirectoriesProvider, options ProviderOptions) (p provider) { runner := boshsys.NewExecCmdRunner(logger) fs := boshsys.NewOsFileSystem(logger) linuxDiskManager := boshdisk.NewLinuxDiskManager(logger, runner, fs, options.Linux.BindMountPersistentDisk) udev := boshudev.NewConcreteUdevDevice(runner) linuxCdrom := boshcdrom.NewLinuxCdrom("/dev/sr0", udev, runner) linuxCdutil := boshcd.NewCdUtil(dirProvider.SettingsDir(), fs, linuxCdrom) compressor := boshcmd.NewTarballCompressor(runner, fs) copier := boshcmd.NewCpCopier(runner, fs, logger) sigarCollector := boshstats.NewSigarStatsCollector() vitalsService := boshvitals.NewService(sigarCollector, dirProvider) routesSearcher := boshnet.NewCmdRoutesSearcher(runner) defaultNetworkResolver := boshnet.NewDefaultNetworkResolver( routesSearcher, boshnet.DefaultInterfaceToAddrsFunc, ) centosNetManager := boshnet.NewCentosNetManager(fs, runner, defaultNetworkResolver, 10*time.Second, logger) ubuntuNetManager := boshnet.NewUbuntuNetManager(fs, runner, defaultNetworkResolver, 10*time.Second, logger) centos := NewLinuxPlatform( fs, runner, sigarCollector, compressor, copier, dirProvider, vitalsService, linuxCdutil, linuxDiskManager, centosNetManager, 500*time.Millisecond, options.Linux, logger, ) ubuntu := NewLinuxPlatform( fs, runner, sigarCollector, compressor, copier, dirProvider, vitalsService, linuxCdutil, linuxDiskManager, ubuntuNetManager, 500*time.Millisecond, options.Linux, logger, ) p.platforms = map[string]Platform{ "ubuntu": ubuntu, "centos": centos, "dummy": NewDummyPlatform(sigarCollector, fs, runner, dirProvider, linuxDiskManager, logger), } return }
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" boshlog "bosh/logger" . "bosh/platform" fakestats "bosh/platform/stats/fakes" boshsettings "bosh/settings" boshdirs "bosh/settings/directories" fakesys "bosh/system/fakes" ) var _ = Describe("dummyPlatform", func() { var ( collector *fakestats.FakeStatsCollector fs *fakesys.FakeFileSystem cmdRunner *fakesys.FakeCmdRunner dirProvider boshdirs.DirectoriesProvider platform Platform ) BeforeEach(func() { collector = &fakestats.FakeStatsCollector{} fs = fakesys.NewFakeFileSystem() cmdRunner = fakesys.NewFakeCmdRunner() dirProvider = boshdirs.NewDirectoriesProvider("/fake-dir") logger := boshlog.NewLogger(boshlog.LevelNone) platform = NewDummyPlatform(collector, fs, cmdRunner, dirProvider, logger) }) Describe("GetDefaultNetwork", func() { Context("when default networks settings file is found", func() {
boshalert "bosh/agent/alert" . "bosh/jobsupervisor" boshmonit "bosh/jobsupervisor/monit" fakemonit "bosh/jobsupervisor/monit/fakes" boshlog "bosh/logger" boshdir "bosh/settings/directories" fakesys "bosh/system/fakes" ) var _ = Describe("monitJobSupervisor", func() { var ( fs *fakesys.FakeFileSystem runner *fakesys.FakeCmdRunner client *fakemonit.FakeMonitClient logger boshlog.Logger dirProvider boshdir.DirectoriesProvider jobFailuresServerPort int monit JobSupervisor ) var jobFailureServerPort = 5000 getJobFailureServerPort := func() int { jobFailureServerPort++ return jobFailureServerPort } BeforeEach(func() { fs = fakesys.NewFakeFileSystem() runner = fakesys.NewFakeCmdRunner()