sysLog := log.New(logWriter, "", 0) logger = boshlogger.New(boshlogger.LevelDebug, sysLog, sysLog) directorCert = spec.CertFor("director") tmpDir, err = ioutil.TempDir("", "test-tmp") Expect(err).ToNot(HaveOccurred()) installScript := fmt.Sprintf("#!/bin/bash\necho hiya > %s/install.log\n", tmpDir) tarballPath = spec.CreateTarball(installScript) allowedNames = []string{"*"} system := system.NewOsSystem() i = installer.New(system) port = spec.GetFreePort() }) JustBeforeEach(func() { config, err := auth.NewSSLConfig( spec.FixtureFilename("certs/bootstrapper.crt"), spec.FixtureFilename("certs/bootstrapper.key"), (string)(spec.FixtureData("certs/rootCA.pem")), allowedNames, ) Expect(err).ToNot(HaveOccurred()) l = listener.NewListener(config, i) }) AfterEach(func() { if l != nil { l.Close() } })
}) AfterEach(func() { if listener != nil { listener.Close() } }) It("downloads and runs the installer", func() { path := "/tarball.tgz" url := "https://localhost:9003" + path cmd := exec.Command( bin, "download", url, "-certFile", spec.FixtureFilename("certs/bootstrapper.crt"), "-keyFile", spec.FixtureFilename("certs/bootstrapper.key"), "-caPemFile", spec.FixtureFilename("certs/rootCA.pem"), "-allowedName", "*", ) var startErr error session, startErr = gexec.Start(cmd, GinkgoWriter, GinkgoWriter) Expect(startErr).ToNot(HaveOccurred()) Eventually(session).Should(gexec.Exit(0)) Expect(session.Out).To(gbytes.Say("hello from install script")) Expect(session.Out).To(gbytes.Say("Download succeeded")) }) }) Describe("listen", func() { var session *gexec.Session