Skip to content

Commit

Permalink
Improve test of stash_plugin to be more like HTCSS environment
Browse files Browse the repository at this point in the history
This adds two test cases, when `HOME` is not set and when `HOME` is set to a non-writable dir and ensures we exit(0) from `stash_plugin -classad` for both those cases. Meant to mimic an environment like HTCondor.
  • Loading branch information
joereuss12 committed Oct 19, 2023
1 parent 2f35006 commit 789f2de
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/citests.sh
Original file line number Diff line number Diff line change
@@ -56,4 +56,36 @@ EOF

./stash_plugin -infile $PWD/infile -outfile $PWD/outfile

# Test we return 0 when HOME is not set
OLDHOME=$HOME
unset HOME
./stash_plugin -classad
exit_status=$?

if ! [[ "$exit_status" = 0 ]]; then
echo "Plugin did not return 0 when HOME is not set"
to_exit=1
fi

export HOME=$OLDHOME

# Test we return 0 when HOME points to a nonwritable directory
OLDHOME=$HOME
unset HOME
mkdir unwritable_dir
chmod u-w,a-w unwritable_dir
export HOME=unwriteable_dir

./stash_plugin -classad
exit_status=$?

if ! [[ "$exit_status" = 0 ]]; then
echo "Plugin did not return 0 when HOME is set to an unwritable dir"
to_exit=1
fi

unset HOME
export HOME=$OLDHOME
rm -r unwritable_dir

exit $to_exit

0 comments on commit 789f2de

Please sign in to comment.