test for checking out to a specific branch
This commit is contained in:
parent
17f4b3e150
commit
983b155fa9
|
@ -31,6 +31,9 @@ function setup {
|
|||
echo "$GITREPO" > $FORGEBUILDDIR/host.source
|
||||
echo "cat \$GITBUILDCONF/entry > /tmp/forgebuild-host" > $FORGEBUILDDIR/host
|
||||
chmod +x $FORGEBUILDDIR/host
|
||||
echo "$GITREPO" > $FORGEBUILDDIR/branch.source
|
||||
echo "cat \$GITBUILDDIR/.branch/branch > /tmp/forgebuild-branch" > $FORGEBUILDDIR/branch
|
||||
chmod +x $FORGEBUILDDIR/branch
|
||||
|
||||
# Setup settings
|
||||
mkdir $FORGEBUILDDIR/config
|
||||
|
@ -49,6 +52,7 @@ function clean {
|
|||
if [ -d $FORGEBUILDDIR ]; then rm -rf $FORGEBUILDDIR; 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
|
||||
|
@ -108,6 +112,19 @@ function clean {
|
|||
[[ "$(cat /tmp/forgebuild-host)" = "default" ]]
|
||||
}
|
||||
|
||||
@test "can checkout to a specific branch/commit" {
|
||||
echo "branch" > $FORGEBUILDDIR/branch.checkout
|
||||
cd $GITREPO
|
||||
git checkout -b branch
|
||||
echo "branch" > branch
|
||||
git add branch
|
||||
git commit -m "new branch"
|
||||
# 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" ]]
|
||||
}
|
||||
|
||||
@test "task only runs in allowlisted hosts" {
|
||||
# When t.hosts exist, only this (line-separated) list of hosts
|
||||
# runs the task
|
||||
|
|
Loading…
Reference in New Issue