Skip to content

Commit

Permalink
test: Add a test for --ssh option in finch build command
Browse files Browse the repository at this point in the history
The following pull request attempts to modify the finch build command to
allow the --ssh option.

- runfinch/finch#696

Therefore, this commit adds a test to run finch build with the --ssh
option.

Signed-off-by: Hayato Kiwata <[email protected]>
  • Loading branch information
haytok committed Nov 17, 2023
1 parent 1cb5cc6 commit 5abafc0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

// Build command building an image.
//
// TODO: --no-cache, --ssh, syntax check for docker files
// TODO: --no-cache, syntax check for docker files
// --no-cache flag is added to tests asserting the output from `RUN` command.
// [Discussion]: https://github.com/runfinch/common-tests/pull/4#discussion_r971338825
func Build(o *option.Option) {
Expand Down Expand Up @@ -126,6 +126,16 @@ func Build(o *option.Option) {
gomega.Expect(ffs.CheckIfFileExists(outputFilePath)).To(gomega.Equal(true))
})

ginkgo.It("Build an image with --ssh option", func() {
containerWithSSH := fmt.Sprintf(`FROM %s
RUN ["echo", "built from Dockerfile.with-ssh"]
`, defaultImage)
dockerFilePath := filepath.Join(buildContext, "Dockerfile.with-ssh")
ffs.WriteFile(dockerFilePath, containerWithSSH)
stdErr := command.Stderr(o, "build", "--ssh", "default", "-f", dockerFilePath, buildContext)
gomega.Expect(stdErr).Should(gomega.ContainSubstring("built from Dockerfile.with-ssh"))
})

ginkgo.Context("Docker file syntax tests", func() {
negativeTests := []struct {
test string
Expand Down

0 comments on commit 5abafc0

Please sign in to comment.