Esempio n. 1
0
func prepareStagingFilesystem(cloudfockerHome string) {
	if err := utils.CreateAndCleanAppDirs(cloudfockerHome); err != nil {
		log.Fatalf(" %s", err)
	}
	if err := buildpack.AtLeastOneBuildpackIn(cloudfockerHome + "/buildpacks"); err != nil {
		log.Fatalf(" %s", err)
	}
	if err := utils.CopyFockerBinaryToOwnDir(cloudfockerHome); err != nil {
		log.Fatalf(" %s", err)
	}
}
Esempio n. 2
0
				os.Setenv("CLOUDFOCKER_HOME", "")
				Expect(utils.CloudfockerHome()).To(Equal(os.Getenv("HOME") + "/.cloudfocker"))
			})
		})
		Context("with a CLOUDFOCKER_HOME env var set", func() {
			It("should return the specified URL", func() {
				os.Setenv("CLOUDFOCKER_HOME", "/dave")
				Expect(utils.CloudfockerHome()).To(Equal("/dave"))
			})
		})
	})
	Describe("Creating and cleaning application directories", func() {
		Context("without a previously staged application", func() {
			It("should create the correct directory structure", func() {
				cloudfockerHome, _ := ioutil.TempDir(os.TempDir(), "utils-test-create-clean")
				err := utils.CreateAndCleanAppDirs(cloudfockerHome)
				Expect(err).ShouldNot(HaveOccurred())
				cloudfockerHomeFile, err := os.Open(cloudfockerHome)
				cloudfockerHomeContents, err := cloudfockerHomeFile.Readdirnames(0)
				Expect(cloudfockerHomeContents, err).Should(ContainElement("buildpacks"))
				Expect(cloudfockerHomeContents, err).Should(ContainElement("droplet"))
				Expect(cloudfockerHomeContents, err).Should(ContainElement("cache"))
				Expect(cloudfockerHomeContents, err).Should(ContainElement("result"))
				Expect(cloudfockerHomeContents, err).Should(ContainElement("staging"))
				os.RemoveAll(cloudfockerHome)
			})
		})
		Context("with a previously staged application", func() {
			It("should clean the directory structure appropriately", func() {
				cloudfockerHome, _ := ioutil.TempDir(os.TempDir(), "utils-test-create-clean")
				dirs := map[string]bool{"/buildpacks": false, "/droplet": true, "/cache": false, "/result": true, "/staging": true}