cleaned up test, looks good

bugfix-109-spaces
Dave Musicant (home machine) 1 year ago
parent dd8164a0a9
commit 641230668f

@ -1,46 +0,0 @@
setup() {
# Time to wait for gitwatch to respond
# shellcheck disable=SC2034
WAITTIME=4
# Set up directory structure and initialize remote
testdir=$(mktemp -d)
# shellcheck disable=SC2164
cd "$testdir"
mkdir remote
# shellcheck disable=SC2164
cd remote
git init -q --bare
# shellcheck disable=SC2103
cd ..
# shellcheck disable=SC2164
mkdir local
# shellcheck disable=SC2164
cd local
git clone -q ../remote
}
teardown() {
echo '# Teardown started' >&3
# Remove testing directories
# shellcheck disable=SC2164
cd /tmp
# rm -rf $testdir
echo "Process id again $GITWATCH_PID" >&3
# Try killing background process
kill -9 %1
fg
# Make sure gitwatch script gets killed if script stopped background
# Also make sure to kill fswatch if on Mac
killall fswatch
# Must kill the entire tree of processes generated
pkill -15 -P "$GITWATCH_PID"
close_non_std_fds
echo '# Teardown complete' >&3
}

@ -1,45 +0,0 @@
#!/usr/bin/env bats
# This is a testscript using the bats testing framework:
# https://github.com/sstephenson/bats
# To run it, at a command prompt:
# bats testscript.bats
load startup-shutdown
function commit_log_messages_working { #@test
# Start up gitwatch with logging, see if works
"${BATS_TEST_DIRNAME}"/../gitwatch.sh -l 10 "$testdir/local/remote" 3>&- &
GITWATCH_PID=$!
echo "Process id $GITWATCH_PID" >&3
echo "Test complete" >&3
}
# # Start up gitwatch with logging, see if works
# "${BATS_TEST_DIRNAME}"/../gitwatch.sh -l 10 "$testdir/local/remote" 3>&- &
# GITWATCH_PID=$!
# # Keeps kill message from printing to screen
# disown
# # Create a file, verify that it hasn't been added yet, then commit
# cd remote
# # According to inotify documentation, a race condition results if you write
# # to directory too soon after it has been created; hence, a short wait.
# sleep 1
# echo "line1" >> file1.txt
# # Wait a bit for inotify to figure out the file has changed, and do its add,
# # and commit
# sleep "$WAITTIME"
# # Make a new change
# echo "line2" >> file1.txt
# sleep "$WAITTIME"
# # Check commit log that the diff is in there
# run git log -1 --oneline
# [[ $output == *"file1.txt"* ]]
# }

@ -1,5 +1,7 @@
#!/usr/bin/env bats
# This inserts customs setup and teardown because of spaces in the file name
function spaces_in_target_dir { #@test
# Time to wait for gitwatch to respond
# shellcheck disable=SC2034
@ -31,23 +33,6 @@ function spaces_in_target_dir { #@test
# Create a file, verify that it hasn't been added yet, then commit
cd remote
# # According to inotify documentation, a race condition results if you write
# # to directory too soon after it has been created; hence, a short wait.
# sleep 1
# echo "line1" >> file1.txt
# # Wait a bit for inotify to figure out the file has changed, and do its add,
# # and commit
# sleep "$WAITTIME"
# # Make a new change
# echo "line2" >> file1.txt
# sleep "$WAITTIME"
# # Check commit log that the diff is in there
# run git log -1 --oneline
# [[ $output == *"file1.txt"* ]]
echo '# Teardown started' >&3
# Remove testing directories
# shellcheck disable=SC2164

Loading…
Cancel
Save