func (d *deploymentManagerFactory2) loadCpiUninstaller() biinstall.Uninstaller { return biinstall.NewUninstaller(d.f.fs, d.f.logger) }
Describe("Uninstall", func() { It("deletes the installation target directory", func() { logBuffer := gbytes.NewBuffer() goLogger := log.New(logBuffer, "", log.LstdFlags) boshlogger := logger.New(logger.LevelInfo, goLogger, goLogger) fs := system.NewOsFileSystem(boshlogger) installationPath, err := fs.TempDir("some-installation-dir") Expect(err).ToNot(HaveOccurred()) err = fs.WriteFileString(filepath.Join(installationPath, "some-installation-artifact"), "something-blah") Expect(err).ToNot(HaveOccurred()) installationTarget := installation.NewTarget(installationPath) uninstaller := installation.NewUninstaller(fs, boshlogger) Expect(fs.FileExists(installationPath)).To(BeTrue()) err = uninstaller.Uninstall(installationTarget) Expect(err).ToNot(HaveOccurred()) Expect(fs.FileExists(installationPath)).To(BeFalse()) Expect(logBuffer).To(gbytes.Say("Successfully uninstalled CPI from '%s'", installationPath)) }) It("returns and logs errors when remove all fails", func() { logBuffer := gbytes.NewBuffer() goLogger := log.New(logBuffer, "", log.LstdFlags) boshlogger := logger.New(logger.LevelInfo, goLogger, goLogger)