Skip to content

Commit

Permalink
test: add a few more pipeline tests
Browse files Browse the repository at this point in the history
Plus some cleanup to pipelines.sh

Signed-off-by: Nick Mitchell <[email protected]>
  • Loading branch information
starpit committed Oct 22, 2024
1 parent b95f963 commit 985fa7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ __pycache__
.venv

# up copyout test leftovers
task.*.output.txt
task.*.output.txt
tmp.output.*
14 changes: 10 additions & 4 deletions tests/bin/pipelines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ set -eo pipefail
SCRIPTDIR=$(cd $(dirname "$0") && pwd)
TOP="$SCRIPTDIR"/../..

"$TOP"/hack/setup/cli.sh /tmp/lunchpail
lp=/tmp/lunchpail
"$TOP"/hack/setup/cli.sh $lp

IN1=$(mktemp)
echo "hello world" > $IN1
Expand Down Expand Up @@ -73,10 +74,15 @@ function tester {
fi
}

tester "/tmp/lunchpail cat $IN1 $VERBOSE | LUNCHPAIL_FORCE_TTY=1 /tmp/lunchpail cat $VERBOSE" "$IN1" $(actual "$IN1" .) # input should still equal output
lpcat="$lp cat $VERBOSE"
lpcatfinal="LUNCHPAIL_FORCE_TTY=1 $lp cat $VERBOSE"

tester "LUNCHPAIL_FORCE_TTY=1 /tmp/lunchpail cat $IN1 $VERBOSE" "$IN1" $(actual "$IN1") # input should equal output
tester "LUNCHPAIL_FORCE_TTY=1 /tmp/lunchpail cat nopenopenopenopenope $VERBOSE" n/a n/a 1 # expect failure trying to cat a non-existent file
tester "$lpcatfinal $IN1" "$IN1" $(actual "$IN1") # input should equal output
tester "$lpcatfinal nopenopenopenopenope" n/a n/a 1 # expect failure trying to cat a non-existent file

tester "$lpcat $IN1 | $lpcatfinal" "$IN1" $(actual "$IN1" .) # cat | cat: input should still equal output
tester "$lpcat $IN1 | $lpcat | $lpcatfinal" "$IN1" $(actual "$IN1" .) # cat | cat | cat: input should still equal output
tester "$lpcat $IN1 | $lpcat | $lpcat | $lpcatfinal" "$IN1" $(actual "$IN1" .) # cat | cat | cat | cat: input should still equal output


echo "✅ PASS all pipeline tests have passed!"

0 comments on commit 985fa7a

Please sign in to comment.