Skip to content

Commit

Permalink
tests: add heredoc test
Browse files Browse the repository at this point in the history
Signed-off-by: Aditya R <arajan@redhat.com>
  • Loading branch information
flouthoc committed Oct 23, 2023
1 parent 13edc99 commit ab6f1fd
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/bud.bats
Expand Up @@ -267,6 +267,18 @@ _EOF
run_buildah 1 run myctr ls -l subdir/
}

@test "bud build with heredoc content" {
run_buildah build -t heredoc $WITH_POLICY_JSON -f $BUDFILES/heredoc/Containerfile .
expect_output --substring "print first line from heredoc"
expect_output --substring "print second line from heredoc"
expect_output --substring "Heredoc writing first file"
expect_output --substring "some text of first file"
expect_output --substring "file2 from python"
expect_output --substring "(your index page goes here)"
expect_output --substring "(robots content)"
expect_output --substring "(humans content)"
}

@test "bud with .containerignore" {
_prefetch alpine busybox
run_buildah 125 build -t testbud $WITH_POLICY_JSON -f $BUDFILES/containerignore/Dockerfile $BUDFILES/containerignore
Expand Down
35 changes: 35 additions & 0 deletions tests/bud/heredoc/Containerfile
@@ -0,0 +1,35 @@
FROM docker.io/library/python:latest

RUN <<EOF
echo "print first line from heredoc"
echo "print second line from heredoc"
EOF

RUN <<EOF
echo "Heredoc writing first file" >> /file1
echo "some text of first file" >> /file1
EOF

RUN cat file1

RUN python3 <<EOF
with open("/file2", "w") as f:
print("file2 from python", file=f)
EOF

RUN cat file2

ADD <<EOF /index.html
(your index page goes here)
EOF

RUN cat index.html

COPY <<robots.txt <<humans.txt /test/
(robots content)
robots.txt
(humans content)
humans.txt

RUN cat /test/robots.txt
RUN cat /test/humans.txt

0 comments on commit ab6f1fd

Please sign in to comment.