Esempio n. 1
0
		logger = boshlogger.New(boshlogger.LevelDebug, sysLog, sysLog)
		directorCert = spec.CertFor("director")
		port = spec.GetFreePort()
		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)
	})

	JustBeforeEach(func() {
		listener = spec.StartDownloadServer(port, tarballPath, directorCert)
		tarballURL = fmt.Sprintf("https://localhost:%d/tarball.tgz", port)

		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())
		dl = downloader.NewDownloader(config, i)
	})

	AfterEach(func() {
		if listener != nil {
			listener.Close()
Esempio n. 2
0
})

var _ = SynchronizedAfterSuite(func() {}, func() {
	gexec.CleanupBuildArtifacts()
})

var _ = Describe("Main", func() {
	var session *gexec.Session

	Describe("download", func() {
		var listener net.Listener

		BeforeEach(func() {
			installScript := "#!/bin/bash\necho hello from install script \n"
			tarballPath := spec.CreateTarball(installScript)
			listener = spec.StartDownloadServer(9003, tarballPath, spec.CertFor("director"))
		})

		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,