Ejemplo n.º 1
0
		logWriter    spec.CapturableWriter
		logger       boshlogger.Logger
		allowedNames []string
		port         int
		directorCert *tls.Certificate
		i            installer.Installer
		tmpDir       string
		tarballPath  string
	)

	BeforeEach(func() {
		var err error
		logWriter = spec.NewCapturableWriter(GinkgoWriter)
		sysLog := log.New(logWriter, "", 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)
Ejemplo n.º 2
0
		logger       boshlogger.Logger
		allowedNames []string
		port         int
		directorCert *tls.Certificate
		i            installer.Installer
		tmpDir       string
		tarballPath  string
	)

	BeforeEach(func() {
		var err error
		log.SetOutput(GinkgoWriter)
		logWriter = spec.NewCapturableWriter(GinkgoWriter)
		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")),
Ejemplo n.º 3
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,