func prepareRuntimeFilesystem(cloudfockerHome string) { if err := utils.AddSoldierRunScript(cloudfockerHome + "/droplet/app"); err != nil { log.Fatalf(" %s", err) } }
Expect(dirs).Should(ContainElement("dir2")) Expect(dirs).ShouldNot(ContainElement("testfile")) os.RemoveAll(parentDir) }) }) Describe("Copying the focker binary to its own directory", func() { It("should create a focker subdirectory with the fock binary inside it", func() { cloudfockerHome, _ := ioutil.TempDir(os.TempDir(), "utils-test-cp-focker") err := utils.CopyFockerBinaryToOwnDir(cloudfockerHome) Expect(err).ShouldNot(HaveOccurred()) fockerOwnDirFile, err := os.Open(cloudfockerHome + "/focker") fockerOwnDirContents, err := fockerOwnDirFile.Readdirnames(0) Expect(fockerOwnDirContents, err).Should(ContainElement("fock")) info, _ := os.Stat(cloudfockerHome + "/focker/fock") mode := info.Mode() Expect(mode).To(Equal(os.FileMode(0755))) os.RemoveAll(cloudfockerHome) }) }) Describe("Adding the soldier run script to a directory", func() { It("should create a script called cloudfocker-start.sh with expected contents", func() { appDir, _ := ioutil.TempDir(os.TempDir(), "utils-test-soldier") utils.AddSoldierRunScript(appDir) written, _ := ioutil.ReadFile(appDir + "/cloudfocker-start-1c4352a23e52040ddb1857d7675fe3cc.sh") fixture, _ := ioutil.ReadFile("fixtures/cloudfocker-start.sh") Expect(written).To(Equal(fixture)) os.RemoveAll(appDir) }) }) })