Skip to content

Commit

Permalink
test: Add a test for --ssh option in finch build command (#101)
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.

Issue #, if available: N/A

*Description of changes:* Details are described in this commit message.

*Testing done:* Yes



- [x] I've reviewed the guidance in CONTRIBUTING.md


#### License Acceptance

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Signed-off-by: Hayato Kiwata <[email protected]>
  • Loading branch information
haytok authored Nov 21, 2023
1 parent 1cb5cc6 commit f68c13c
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 f68c13c

Please sign in to comment.