diff --git a/functions.sh b/functions.sh index 9fdaa7a3..fb94c63e 100644 --- a/functions.sh +++ b/functions.sh @@ -345,7 +345,12 @@ function setup_project { fi # Try the specified branch before the ZUUL_BRANCH. - OVERRIDE_ZUUL_REF=$(echo $ZUUL_REF | sed -e "s,$ZUUL_BRANCH,$branch,") + if [[ ! -z $ZUUL_BRANCH ]]; then + OVERRIDE_ZUUL_REF=$(echo $ZUUL_REF | sed -e "s,$ZUUL_BRANCH,$branch,") + else + OVERRIDE_ZUUL_REF="" + fi + # Update git remotes git_remote_update diff --git a/test-functions.sh b/test-functions.sh index 92dd60c1..3f181c47 100755 --- a/test-functions.sh +++ b/test-functions.sh @@ -398,6 +398,19 @@ function test_periodic { assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'stable/havana' } +# Run setup_project without setting a ZUUL_BRANCH which is how a subset of +# periodic jobs operate +function test_periodic_no_branch { + + declare -A TEST_GIT_CHECKOUTS + declare -A TEST_ZUUL_REF + local ZUUL_PROJECT='openstack/glance' + + setup_project openstack/glance 'master' + + assert_equal "${TEST_GIT_CHECKOUTS[glance]}" 'master' +} + # setup_workspace fails without argument function test_workspace_branch_arg { assert_raises setup_workspace @@ -466,6 +479,7 @@ test_multi_branch_on_stable test_multi_branch_project_override test_one_on_master test_periodic +test_periodic_no_branch test_two_on_master test_workspace_branch_arg test_call_hook_if_defined