diff --git a/cmd/collapse_test.go b/cmd/collapse_test.go index 4c6a9d0ff..623ed1d84 100644 --- a/cmd/collapse_test.go +++ b/cmd/collapse_test.go @@ -86,4 +86,22 @@ var _ = Describe("collapse with testdata", func() { Eventually(session).Should(gexec.Exit(0)) }) }) + + Describe("an orb containing local executors and commands in folder", func() { + BeforeEach(func() { + var err error + command = exec.Command(pathCLI, "collapse", "-r", "testdata/myorb/test") + results, err = ioutil.ReadFile("testdata/myorb/result.yml") + Expect(err).ShouldNot(HaveOccurred()) + }) + + It("collapse all YAML contents as expected", func() { + session, err := gexec.Start(command, GinkgoWriter, GinkgoWriter) + session.Wait() + Expect(err).ShouldNot(HaveOccurred()) + Eventually(session.Err.Contents()).Should(BeEmpty()) + Eventually(session.Out.Contents()).Should(MatchYAML(results)) + Eventually(session).Should(gexec.Exit(0)) + }) + }) }) diff --git a/cmd/testdata/myorb/result.yml b/cmd/testdata/myorb/result.yml new file mode 100644 index 000000000..281d6c05a --- /dev/null +++ b/cmd/testdata/myorb/result.yml @@ -0,0 +1,19 @@ +commands: + zomg: + description: a command inside a folder in an orb + parameters: + tm: + description: Tell me something. + type: string + steps: + - run: echo "You don't say... << parameters.saywhat >>" +description: A simple encapsulation of common tasks in Hugo +executors: + default: + docker: + - image: cibuilds/hugo:<< parameters.image >> + parameters: + tag: + description: The tag to use on the image + type: string + diff --git a/cmd/testdata/myorb/test/commands/zomg.yml b/cmd/testdata/myorb/test/commands/zomg.yml new file mode 100644 index 000000000..11289f015 --- /dev/null +++ b/cmd/testdata/myorb/test/commands/zomg.yml @@ -0,0 +1,7 @@ +description: "a command inside a folder in an orb" +parameters: + tm: + description: "Tell me something." + type: string +steps: + - run: echo "You don't say... << parameters.saywhat >>" diff --git a/cmd/testdata/myorb/test/orb.yml b/cmd/testdata/myorb/test/orb.yml new file mode 100644 index 000000000..d12c0a238 --- /dev/null +++ b/cmd/testdata/myorb/test/orb.yml @@ -0,0 +1,10 @@ +description: "A simple encapsulation of common tasks in Hugo" + +executors: + default: + parameters: + tag: + description: "The tag to use on the image" + type: string + docker: + - image: cibuilds/hugo:<< parameters.image >>