Merge "Sanity check in setup_workspace"
This commit is contained in:
commit
2a47c2237d
|
@ -358,16 +358,16 @@ tsfilter setup_host &> $WORKSPACE/logs/devstack-gate-setup-host.txt
|
|||
if [ -n "$DEVSTACK_GATE_GRENADE" ]; then
|
||||
echo "Setting up the new (migrate to) workspace"
|
||||
echo "... this takes 3 - 5 minutes (logs at logs/devstack-gate-setup-workspace-new.txt.gz)"
|
||||
tsfilter setup_workspace $GRENADE_NEW_BRANCH $BASE/new copycache &> \
|
||||
tsfilter setup_workspace "$GRENADE_NEW_BRANCH" "$BASE/new" copycache &> \
|
||||
$WORKSPACE/logs/devstack-gate-setup-workspace-new.txt
|
||||
echo "Setting up the old (migrate from) workspace ..."
|
||||
echo "... this takes 3 - 5 minutes (logs at logs/devstack-gate-setup-workspace-old.txt.gz)"
|
||||
tsfilter setup_workspace $GRENADE_OLD_BRANCH $BASE/old &> \
|
||||
tsfilter setup_workspace "$GRENADE_OLD_BRANCH" "$BASE/old" &> \
|
||||
$WORKSPACE/logs/devstack-gate-setup-workspace-old.txt
|
||||
else
|
||||
echo "Setting up the workspace"
|
||||
echo "... this takes 3 - 5 minutes (logs at logs/devstack-gate-setup-workspace-new.txt.gz)"
|
||||
tsfilter setup_workspace $OVERRIDE_ZUUL_BRANCH $BASE/new &> \
|
||||
tsfilter setup_workspace "$OVERRIDE_ZUUL_BRANCH" "$BASE/new" &> \
|
||||
$WORKSPACE/logs/devstack-gate-setup-workspace-new.txt
|
||||
fi
|
||||
# It is in brackets for avoiding inheriting a huge environment variable
|
||||
|
|
|
@ -341,6 +341,11 @@ function setup_workspace {
|
|||
# Enabled detailed logging, since output of this function is redirected
|
||||
set -o xtrace
|
||||
|
||||
if [ -z "$base_branch" ]; then
|
||||
echo "ERROR: setup_workspace: base_branch is an empty string!" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
fix_disk_layout
|
||||
|
||||
sudo mkdir -p $DEST
|
||||
|
|
|
@ -99,6 +99,16 @@ function assert_equal {
|
|||
fi
|
||||
}
|
||||
|
||||
function assert_raises {
|
||||
local lineno=`caller 0 | awk '{print $1}'`
|
||||
local function=`caller 0 | awk '{print $2}'`
|
||||
eval "$@" &>/dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
ERROR=1
|
||||
echo "ERROR: \`\`$@\`\` returned OK instead of error in $function:L$lineno!"
|
||||
fi
|
||||
}
|
||||
|
||||
# Tests follow:
|
||||
function test_one_on_master {
|
||||
# devstack-gate master ZA
|
||||
|
@ -386,6 +396,11 @@ function test_periodic {
|
|||
assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'stable/havana'
|
||||
}
|
||||
|
||||
# setup_workspace fails without argument
|
||||
function test_workspace_branch_arg {
|
||||
assert_raises setup_workspace
|
||||
}
|
||||
|
||||
# Run tests:
|
||||
#set -o xtrace
|
||||
test_branch_override
|
||||
|
@ -397,6 +412,7 @@ test_multi_branch_project_override
|
|||
test_one_on_master
|
||||
test_periodic
|
||||
test_two_on_master
|
||||
test_workspace_branch_arg
|
||||
|
||||
if [[ ! -z "$ERROR" ]]; then
|
||||
echo
|
||||
|
|
Loading…
Reference in New Issue