From 9828aadcc73fa8ed150f07fb0120316842d96775 Mon Sep 17 00:00:00 2001 From: Aditya R Date: Mon, 23 Oct 2023 14:29:08 +0530 Subject: [PATCH] tests: add heredoc test Signed-off-by: Aditya R --- tests/bud.bats | 19 +++++++++++ tests/bud/heredoc/Containerfile | 59 +++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 tests/bud/heredoc/Containerfile diff --git a/tests/bud.bats b/tests/bud.bats index 488e60a79b7..f119dd75f1a 100644 --- a/tests/bud.bats +++ b/tests/bud.bats @@ -267,6 +267,25 @@ _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)" + expect_output --substring "this is the output of test6 part1" + expect_output --substring "this is the output of test6 part2" + expect_output --substring "this is the output of test7 part1" + expect_output --substring "this is the output of test7 part2" + expect_output --substring "this is the output of test7 part3" + expect_output --substring "this is the output of test8 part1" + expect_output --substring "this is the output of test8 part2" +} + @test "bud with .containerignore" { _prefetch alpine busybox run_buildah 125 build -t testbud $WITH_POLICY_JSON -f $BUDFILES/containerignore/Dockerfile $BUDFILES/containerignore diff --git a/tests/bud/heredoc/Containerfile b/tests/bud/heredoc/Containerfile new file mode 100644 index 00000000000..788b2ffa763 --- /dev/null +++ b/tests/bud/heredoc/Containerfile @@ -0,0 +1,59 @@ +FROM docker.io/library/python:latest + +RUN <> /file1 +echo "some text of first file" >> /file1 +EOF + +RUN cat file1 + +RUN python3 < test6.txt +this is the output of test6 part1 +FILE1 +this is the output of test6 part2 +FILE2 + +RUN 5< test7.txt +this is the output of test7 part1 +file +this is the output of test7 part2 +FILE +this is the output of test7 part3 +File + +RUN < test8.1 && < test8.2 +this is the output of test8 part1 +FILE1 +this is the output of test8 part2 +FILE2 + +RUN cat /test/robots.txt +RUN cat /test/humans.txt +RUN cat test6.txt +RUN cat test7.txt +RUN cat test8.1 +RUN cat test8.2