Skip to content

Commit

Permalink
Add test for orb with local executors and commands in folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Scott committed Jun 22, 2018
1 parent fa63a02 commit f23054e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cmd/collapse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
})
})
19 changes: 19 additions & 0 deletions cmd/testdata/myorb/result.yml
Original file line number Diff line number Diff line change
@@ -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

7 changes: 7 additions & 0 deletions cmd/testdata/myorb/test/commands/zomg.yml
Original file line number Diff line number Diff line change
@@ -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 >>"
10 changes: 10 additions & 0 deletions cmd/testdata/myorb/test/orb.yml
Original file line number Diff line number Diff line change
@@ -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 >>

0 comments on commit f23054e

Please sign in to comment.