Make tests atomic for parallel testing
This commit is contained in:
parent
f7c41dfd0c
commit
1fec331b99
112
tests/git.bats
112
tests/git.bats
|
@ -25,15 +25,15 @@ function setup {
|
|||
FORGEBUILDDIR="$TMPDIR"/forgebuild
|
||||
mkdir $FORGEBUILDDIR
|
||||
echo "$GITREPO" > $FORGEBUILDDIR/time.source
|
||||
echo "date +%s%N > /tmp/forgebuild-time" > $FORGEBUILDDIR/time
|
||||
echo "date +%s%N > $TMPDIR/forgebuild-time" > $FORGEBUILDDIR/time
|
||||
chmod +x $FORGEBUILDDIR/time
|
||||
echo "$GITREPO" > $FORGEBUILDDIR/host.source
|
||||
echo "cat \$GITBUILDCONF/entry > /tmp/forgebuild-host" > $FORGEBUILDDIR/host
|
||||
echo "cat \$GITBUILDCONF/entry > $TMPDIR/forgebuild-host" > $FORGEBUILDDIR/host
|
||||
chmod +x $FORGEBUILDDIR/host
|
||||
echo "$GITREPO" > $FORGEBUILDDIR/branch.source
|
||||
echo "cat \$GITBUILDDIR/.branch/branch > /tmp/forgebuild-branch" > $FORGEBUILDDIR/branch
|
||||
echo "cat \$GITBUILDDIR/.branch/branch > $TMPDIR/forgebuild-branch" > $FORGEBUILDDIR/branch
|
||||
chmod +x $FORGEBUILDDIR/branch
|
||||
echo "echo \$(pwd) > /tmp/forgebuild-pwd" > $FORGEBUILDDIR/pwd
|
||||
echo "echo \$(pwd) > $TMPDIR/forgebuild-pwd" > $FORGEBUILDDIR/pwd
|
||||
chmod +x $FORGEBUILDDIR/pwd
|
||||
echo "$GITREPO" > $FORGEBUILDDIR/pwd.source
|
||||
|
||||
|
@ -51,10 +51,6 @@ function teardown {
|
|||
|
||||
function clean {
|
||||
if [ -d $TMPDIR ]; then rm -rf $TMPDIR; fi
|
||||
if [ -f /tmp/forgebuild-time ]; then rm /tmp/forgebuild-time; fi
|
||||
if [ -f /tmp/forgebuild-host ]; then rm /tmp/forgebuild-host; fi
|
||||
if [ -f /tmp/forgebuild-branch ]; then rm /tmp/forgebuild-branch; fi
|
||||
if [ -f /tmp/forgebuild-pwd ]; then rm /tmp/forgebuild-pwd; fi
|
||||
}
|
||||
|
||||
# Simple repository
|
||||
|
@ -66,12 +62,12 @@ function clean {
|
|||
|
||||
@test "first run triggers task" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
}
|
||||
|
||||
@test "task is run from within its source folder" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR pwd
|
||||
PWD="$(cat /tmp/forgebuild-pwd)"
|
||||
PWD="$(cat $TMPDIR/forgebuild-pwd)"
|
||||
[[ "$PWD" = "$FORGEBUILDDIR/.pwd" ]]
|
||||
}
|
||||
|
||||
|
@ -83,24 +79,24 @@ function clean {
|
|||
|
||||
@test "no update does not trigger task" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
TIME="$(cat /tmp/forgebuild-time)"
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
TIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
[[ "$TIME" = "$NEWTIME" ]]
|
||||
}
|
||||
|
||||
@test "update triggers task" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
TIME="$(cat /tmp/forgebuild-time)"
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
TIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
cd $GITREPO
|
||||
touch NEWFILE
|
||||
git add NEWFILE
|
||||
git commit -m "second commit"
|
||||
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
|
||||
[[ "$TIME" != "$NEWTIME" ]]
|
||||
}
|
||||
|
@ -108,18 +104,18 @@ function clean {
|
|||
@test "update by source URL works" {
|
||||
echo "FALSESOURCE" > "$FORGEBUILDDIR"/branch.source
|
||||
$FORGEBUILD -b $FORGEBUILDDIR "$GITREPO"
|
||||
[ -f /tmp/forgebuild-host ]
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ ! -f /tmp/forgebuild-branch ]
|
||||
[ -f $TMPDIR/forgebuild-host ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
[ ! -f $TMPDIR/forgebuild-branch ]
|
||||
}
|
||||
|
||||
@test "update can mix source URL and task name" {
|
||||
git init $TMPDIR/newrepo
|
||||
echo "$TMPDIR/newrepo" > "$FORGEBUILDDIR"/branch.source
|
||||
$FORGEBUILD -b $FORGEBUILDDIR "$GITREPO" "branch"
|
||||
[ -f /tmp/forgebuild-host ]
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f /tmp/forgebuild-branch ]
|
||||
[ -f $TMPDIR/forgebuild-host ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-branch ]
|
||||
}
|
||||
|
||||
@test "support any default branch (not just master)" {
|
||||
|
@ -127,19 +123,19 @@ function clean {
|
|||
# Move "master" to "default" branch
|
||||
git branch -m default
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
}
|
||||
|
||||
# Task settings
|
||||
|
||||
@test "host-based settings are loaded" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR host
|
||||
[[ "$(cat /tmp/forgebuild-host)" = "host" ]]
|
||||
[[ "$(cat $TMPDIR/forgebuild-host)" = "host" ]]
|
||||
}
|
||||
|
||||
@test "unknown host uses default settings" {
|
||||
HOST="UNKNOWN" $FORGEBUILD -b $FORGEBUILDDIR host
|
||||
[[ "$(cat /tmp/forgebuild-host)" = "default" ]]
|
||||
[[ "$(cat $TMPDIR/forgebuild-host)" = "default" ]]
|
||||
}
|
||||
|
||||
@test "can checkout to a specific branch/commit" {
|
||||
|
@ -152,7 +148,7 @@ function clean {
|
|||
# TODO: should be able to checkout to the default branch even when it's not called master
|
||||
git checkout master
|
||||
$FORGEBUILD -b $FORGEBUILDDIR branch
|
||||
[[ "$(cat /tmp/forgebuild-branch)" = "branch" ]]
|
||||
[[ "$(cat $TMPDIR/forgebuild-branch)" = "branch" ]]
|
||||
}
|
||||
|
||||
@test "task only runs in allowlisted hosts" {
|
||||
|
@ -160,33 +156,33 @@ function clean {
|
|||
# runs the task
|
||||
echo "$HOSTNAME" > $FORGEBUILDDIR/time.hosts
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
TIME="$(cat /tmp/forgebuild-time)"
|
||||
TIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
|
||||
# Doesn't run on unknown host
|
||||
HOST="UNKNOWN" $FORGEBUILD -b $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
[[ "$TIME" = "$NEWTIME" ]]
|
||||
|
||||
echo "TESTHOST" >> $FORGEBUILDDIR/time.hosts
|
||||
# Force trigger because repo was not updated
|
||||
HOST="TESTHOST" $FORGEBUILD -f -b $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
[[ "$TIME" != "$NEWTIME" ]]
|
||||
}
|
||||
|
||||
@test "task doesn't run in ignored host" {
|
||||
touch $FORGEBUILDDIR/$HOSTNAME/time.ignore
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ ! -f /tmp/forgebuild-time ]
|
||||
[ ! -f $TMPDIR/forgebuild-time ]
|
||||
|
||||
HOST="TESTHOST" $FORGEBUILD -f -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
}
|
||||
|
||||
@test "repository unavailable fails to trigger task" {
|
||||
rm -Rf $GITREPO
|
||||
! $FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ ! -f /tmp/forgebuild-time ]
|
||||
[ ! -f $TMPDIR/forgebuild-time ]
|
||||
}
|
||||
|
||||
# Repository with submodules
|
||||
|
@ -215,7 +211,7 @@ function setup_submodule {
|
|||
@test "first submodule run triggers task" {
|
||||
setup_submodule
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
}
|
||||
|
||||
@test "submodule is updated on first clone is subupdates is enabled" {
|
||||
|
@ -232,8 +228,8 @@ function setup_submodule {
|
|||
@test "submodule update does not trigger task by default" {
|
||||
setup_submodule
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
TIME="$(cat /tmp/forgebuild-time)"
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
TIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
|
||||
cd $SUBMODULE
|
||||
echo "new stuff" > NEWFILE
|
||||
|
@ -241,7 +237,7 @@ function setup_submodule {
|
|||
git commit -m "second commit"
|
||||
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
|
||||
[[ "$TIME" = "$NEWTIME" ]]
|
||||
}
|
||||
|
@ -250,8 +246,8 @@ function setup_submodule {
|
|||
setup_submodule
|
||||
touch $FORGEBUILDDIR/time.subupdates
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
TIME="$(cat /tmp/forgebuild-time)"
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
TIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
|
||||
cd $SUBMODULE
|
||||
echo "new stuff" > NEWFILE
|
||||
|
@ -259,7 +255,7 @@ function setup_submodule {
|
|||
git commit -m "second commit"
|
||||
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
|
||||
[[ "$TIME" != "$NEWTIME" ]]
|
||||
}
|
||||
|
@ -268,59 +264,59 @@ function setup_submodule {
|
|||
|
||||
@test "running specific tasks only runs those tasks" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time host
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f /tmp/forgebuild-host ]
|
||||
[ ! -f /tmp/forgebuild-branch ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-host ]
|
||||
[ ! -f $TMPDIR/forgebuild-branch ]
|
||||
}
|
||||
|
||||
@test "not specifying tasks runs all tasks" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f /tmp/forgebuild-host ]
|
||||
[ -f /tmp/forgebuild-branch ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-host ]
|
||||
[ -f $TMPDIR/forgebuild-branch ]
|
||||
}
|
||||
|
||||
@test "forced run triggers task" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
TIME="$(cat /tmp/forgebuild-time)"
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
TIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
$FORGEBUILD -f -b $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
[[ "$TIME" != "$NEWTIME" ]]
|
||||
}
|
||||
|
||||
@test "can run with relative basedir" {
|
||||
cd $FORGEBUILDDIR
|
||||
$FORGEBUILD -b . time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
}
|
||||
|
||||
@test "can run with trailing slash in basedir" {
|
||||
cd $FORGEBUILDDIR
|
||||
$FORGEBUILD -b ./ time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
}
|
||||
|
||||
@test "can use long CLI flags" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
TIME="$(cat /tmp/forgebuild-time)"
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
TIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
$FORGEBUILD --force --basedir $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
[[ "$TIME" != "$NEWTIME" ]]
|
||||
}
|
||||
|
||||
@test "tasks are run in alphanumeric order" {
|
||||
# Run in background
|
||||
$FORGEBUILD -b $FORGEBUILDDIR &
|
||||
while [ ! -f /tmp/forgebuild-branch ]; do
|
||||
[ ! -f /tmp/forgebuild-host ] && [ ! -f /tmp/forgebuild-time ]
|
||||
while [ ! -f $TMPDIR/forgebuild-branch ]; do
|
||||
[ ! -f $TMPDIR/forgebuild-host ] && [ ! -f /tmp/forgebuild-time ]
|
||||
done
|
||||
while [ ! -f /tmp/forgebuild-host ]; do
|
||||
[ ! -f /tmp/forgebuild-time ]
|
||||
while [ ! -f $TMPDIR/forgebuild-host ]; do
|
||||
[ ! -f $TMPDIR/forgebuild-time ]
|
||||
done
|
||||
sleep 1
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
}
|
||||
|
||||
@test "can run with ~/.forgebuild" {
|
||||
|
|
|
@ -26,15 +26,15 @@ function setup {
|
|||
mkdir $FORGEBUILDDIR
|
||||
echo "$REPO" > $FORGEBUILDDIR/time.source
|
||||
echo "mercurial" > $FORGEBUILDDIR/time.dvcs
|
||||
echo "date +%s%N > /tmp/forgebuild-time" > $FORGEBUILDDIR/time
|
||||
echo "date +%s%N > $TMPDIR/forgebuild-time" > $FORGEBUILDDIR/time
|
||||
chmod +x $FORGEBUILDDIR/time
|
||||
echo "$REPO" > $FORGEBUILDDIR/host.source
|
||||
echo "mercurial" > $FORGEBUILDDIR/host.dvcs
|
||||
echo "cat \$GITBUILDCONF/entry > /tmp/forgebuild-host" > $FORGEBUILDDIR/host
|
||||
echo "cat \$GITBUILDCONF/entry > $TMPDIR/forgebuild-host" > $FORGEBUILDDIR/host
|
||||
chmod +x $FORGEBUILDDIR/host
|
||||
echo "$REPO" > $FORGEBUILDDIR/branch.source
|
||||
echo "mercurial" > $FORGEBUILDDIR/branch.dvcs
|
||||
echo "cat \$GITBUILDDIR/.branch/branch > /tmp/forgebuild-branch" > $FORGEBUILDDIR/branch
|
||||
echo "cat \$GITBUILDDIR/.branch/branch > $TMPDIR/forgebuild-branch" > $FORGEBUILDDIR/branch
|
||||
chmod +x $FORGEBUILDDIR/branch
|
||||
|
||||
# Setup settings
|
||||
|
@ -51,9 +51,6 @@ function teardown {
|
|||
|
||||
function clean {
|
||||
if [ -d $TMPDIR ]; then rm -rf $TMPDIR; fi
|
||||
if [ -f /tmp/forgebuild-time ]; then rm /tmp/forgebuild-time; fi
|
||||
if [ -f /tmp/forgebuild-host ]; then rm /tmp/forgebuild-host; fi
|
||||
if [ -f /tmp/forgebuild-branch ]; then rm /tmp/forgebuild-branch; fi
|
||||
}
|
||||
|
||||
# Simple repository
|
||||
|
@ -65,29 +62,29 @@ function clean {
|
|||
|
||||
@test "hg: first run triggers task" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
}
|
||||
|
||||
@test "hg: no update does not trigger task" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
TIME="$(cat /tmp/forgebuild-time)"
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
TIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
[[ "$TIME" = "$NEWTIME" ]]
|
||||
}
|
||||
|
||||
@test "hg: update triggers task" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
TIME="$(cat /tmp/forgebuild-time)"
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
TIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
cd $REPO
|
||||
touch NEWFILE
|
||||
hg add NEWFILE
|
||||
hg commit -m "second commit"
|
||||
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
|
||||
[[ "$TIME" != "$NEWTIME" ]]
|
||||
}
|
||||
|
@ -101,11 +98,11 @@ function clean {
|
|||
hg commit -m "new branch"
|
||||
hg update default
|
||||
$FORGEBUILD -b $FORGEBUILDDIR branch
|
||||
[[ "$(cat /tmp/forgebuild-branch)" = "branch" ]]
|
||||
[[ "$(cat $TMPDIR/forgebuild-branch)" = "branch" ]]
|
||||
}
|
||||
|
||||
@test "hg: repository unavailable fails to trigger task" {
|
||||
rm -Rf $REPO
|
||||
! $FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ ! -f /tmp/forgebuild-time ]
|
||||
[ ! -f $TMPDIR/forgebuild-time ]
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ function setup {
|
|||
# Setup forgebuild tasks
|
||||
FORGEBUILDDIR="$TMPDIR"/forgebuild
|
||||
mkdir $FORGEBUILDDIR
|
||||
echo "date +%s%N > /tmp/forgebuild-time" > $FORGEBUILDDIR/time
|
||||
echo "date +%s%N > $TMPDIR/forgebuild-time" > $FORGEBUILDDIR/time
|
||||
chmod +x $FORGEBUILDDIR/time
|
||||
echo "echo \$(pwd) > /tmp/forgebuild-pwd" > $FORGEBUILDDIR/pwd
|
||||
echo "echo \$(pwd) > $TMPDIR/forgebuild-pwd" > $FORGEBUILDDIR/pwd
|
||||
chmod +x $FORGEBUILDDIR/pwd
|
||||
|
||||
# Setup settings
|
||||
|
@ -34,25 +34,24 @@ function teardown {
|
|||
|
||||
function clean {
|
||||
if [ -d $TMPDIR ]; then rm -rf $TMPDIR; fi
|
||||
if [ -f /tmp/forgebuild-time ]; then rm /tmp/forgebuild-time; fi
|
||||
}
|
||||
|
||||
# Simple repository
|
||||
|
||||
@test "sourceless task runs only once" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
[ -f $FORGEBUILDDIR/time.done ]
|
||||
TIME="$(cat /tmp/forgebuild-time)"
|
||||
TIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
[[ "$TIME" = "$NEWTIME" ]]
|
||||
}
|
||||
|
||||
@test "sourceless task working dir is FORGEBUILDDIR" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR pwd
|
||||
PWD="$(cat /tmp/forgebuild-pwd)"
|
||||
cp /tmp/forgebuild-pwd{,-2}
|
||||
PWD="$(cat $TMPDIR/forgebuild-pwd)"
|
||||
cp $TMPDIR/forgebuild-pwd{,-2}
|
||||
[[ "$PWD" = "$FORGEBUILDDIR" ]]
|
||||
}
|
||||
|
||||
|
@ -64,27 +63,27 @@ function clean {
|
|||
|
||||
@test "sourceless task is not forced triggered by --force flag" {
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
[ -f $FORGEBUILDDIR/time.done ]
|
||||
TIME="$(cat /tmp/forgebuild-time)"
|
||||
TIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
$FORGEBUILD -f -b $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
[[ "$TIME" = "$NEWTIME" ]]
|
||||
}
|
||||
|
||||
@test "sourceless task can run on specific hosts" {
|
||||
echo "$HOSTNAME" > $FORGEBUILDDIR/time.hosts
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
TIME="$(cat /tmp/forgebuild-time)"
|
||||
TIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
HOST="UNKNOWN" $FORGEBUILD -b $FORGEBUILDDIR time
|
||||
NEWTIME="$(cat /tmp/forgebuild-time)"
|
||||
NEWTIME="$(cat $TMPDIR/forgebuild-time)"
|
||||
[[ "$TIME" = "$NEWTIME" ]]
|
||||
}
|
||||
|
||||
@test "sourceless task can be ignored on hosts" {
|
||||
touch $FORGEBUILDDIR/$HOSTNAME/time.ignore
|
||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ ! -f /tmp/forgebuild-time ]
|
||||
[ ! -f $TMPDIR/forgebuild-time ]
|
||||
HOST="UNKNOWN" $FORGEBUILD -b $FORGEBUILDDIR time
|
||||
[ -f /tmp/forgebuild-time ]
|
||||
[ -f $TMPDIR/forgebuild-time ]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue