Skip to content

Instantly share code, notes, and snippets.

@pawzar pawzar/Dockerfile
Created Apr 23, 2020

Embed
What would you like to do?
FROM bash
COPY test*.sh ./
RUN bash test_scenario.sh
set -e
function _clean() {
rm -f file-?.txt
}
function _testsShouldPass() {
echo -n "Test #$1: "
if bash tests.sh; then
echo "PASS"
else
echo "FAIL"
_clean
return 1
fi
}
function _testsShouldFail() {
echo -n "Test #$1: "
if ! bash tests.sh; then
echo "PASS"
else
echo "FAIL"
_clean
return 1
fi
}
_clean
_testsShouldFail 1
touch file-a.txt
_testsShouldFail 2
touch file-b.txt
_testsShouldFail 3
touch file-c.txt
_testsShouldPass 4
rm file-a.txt
_testsShouldFail 5
touch file-a.txt
rm file-b.txt
_testsShouldFail 6
touch file-b.txt
rm file-c.txt
_testsShouldFail 7
_clean
set -e
test -f file-a.txt
test -f file-b.txt
test -f file-c.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.