2121source functions.sh
2222
2323SUDO=" "
24+ LOCAL_AAR_VARS=" TEST_GIT_CHECKOUTS TEST_ZUUL_REFS GIT_CLONE_AND_CD_ARG"
2425
2526# Mock out the checkout function since the refs we're checking out do
2627# not exist.
@@ -86,6 +87,12 @@ function git_remote_set_url {
8687}
8788
8889function git_clone_and_cd {
90+ if [[ " x${2} " == " x" ]]; then
91+ GIT_CLONE_AND_CD_ARG[" ERROR" ]=" ERROR"
92+ return 1
93+ else
94+ GIT_CLONE_AND_CD_ARG[$2 ]=" $1 ,$3 "
95+ fi
8996 return 0
9097}
9198
@@ -114,8 +121,9 @@ function assert_raises {
114121# Tests follow:
115122function test_one_on_master {
116123 # devstack-gate master ZA
117- declare -A TEST_GIT_CHECKOUTS
118- declare -A TEST_ZUUL_REFS
124+ for aar_var in $LOCAL_AAR_VARS ; do
125+ eval ` echo " declare -A $aar_var " `
126+ done
119127 local ZUUL_PROJECT=' openstack-infra/devstack-gate'
120128 local ZUUL_BRANCH=' master'
121129 local ZUUL_REF=' refs/zuul/master/ZA'
@@ -129,8 +137,9 @@ function test_one_on_master {
129137function test_two_on_master {
130138 # devstack-gate master ZA
131139 # glance master ZB
132- declare -A TEST_GIT_CHECKOUTS
133- declare -A TEST_ZUUL_REFS
140+ for aar_var in $LOCAL_AAR_VARS ; do
141+ eval ` echo " declare -A $aar_var " `
142+ done
134143 local ZUUL_PROJECT=' openstack/glance'
135144 local ZUUL_BRANCH=' master'
136145 local ZUUL_REF=' refs/zuul/master/ZB'
@@ -149,8 +158,9 @@ function test_multi_branch_on_master {
149158 # devstack-gate master ZA
150159 # glance stable/havana ZB
151160 # python-glanceclient master ZC
152- declare -A TEST_GIT_CHECKOUTS
153- declare -A TEST_ZUUL_REFS
161+ for aar_var in $LOCAL_AAR_VARS ; do
162+ eval ` echo " declare -A $aar_var " `
163+ done
154164 local ZUUL_PROJECT=' openstack/python-glanceclient'
155165 local ZUUL_BRANCH=' master'
156166 local ZUUL_REF=' refs/zuul/master/ZC'
@@ -179,8 +189,9 @@ function test_multi_branch_project_override {
179189 # tempest not in queue (override to master)
180190 # oslo.config not in queue (master because no stable/havana branch)
181191 # nova not in queue (stable/havana)
182- declare -A TEST_GIT_CHECKOUTS
183- declare -A TEST_ZUUL_REFS
192+ for aar_var in $LOCAL_AAR_VARS ; do
193+ eval ` echo " declare -A $aar_var " `
194+ done
184195 local ZUUL_PROJECT=' openstack/glance'
185196 local ZUUL_BRANCH=' stable/havana'
186197 local OVERRIDE_TEMPEST_PROJECT_BRANCH=' master'
@@ -212,8 +223,9 @@ function test_multi_branch_on_stable {
212223 # devstack-gate master ZA
213224 # glance stable/havana ZB
214225 # python-glanceclient not in queue
215- declare -A TEST_GIT_CHECKOUTS
216- declare -A TEST_ZUUL_REFS
226+ for aar_var in $LOCAL_AAR_VARS ; do
227+ eval ` echo " declare -A $aar_var " `
228+ done
217229 local ZUUL_PROJECT=' openstack/glance'
218230 local ZUUL_BRANCH=' stable/havana'
219231 local ZUUL_REF=' refs/zuul/stable/havana/ZB'
@@ -230,6 +242,36 @@ function test_multi_branch_on_stable {
230242 assert_equal " ${TEST_GIT_CHECKOUTS[python-glanceclient]} " ' master'
231243}
232244
245+ function test_multi_git_base_project_override {
246+ # osrg/ryu https://github.com
247+ # test/devstack-gate https://example.com
248+ # openstack/keystone https://git.openstack.org
249+ # openstack/glance http://tarballs.openstack.org
250+ for aar_var in $LOCAL_AAR_VARS ; do
251+ eval ` echo " declare -A $aar_var " `
252+ done
253+ GIT_CLONE_AND_CD_ARG[" ERROR" ]=" NULL"
254+ local ZUUL_PROJECT=' openstack/neutron'
255+ local ZUUL_BRANCH=' master'
256+ local ZUUL_REF=' refs/zuul/master/ZA'
257+ local GIT_BASE=" "
258+ local GIT_BASE_DEF=" https://git.openstack.org"
259+
260+ local OVERRIDE_RYU_GIT_BASE=' https://github.com'
261+ setup_project " osrg/ryu" $ZUUL_BRANCH
262+ local OVERRIDE_DEVSTACK_GATE_GIT_BASE=' https://example.com'
263+ setup_project " test/devstack-gate" $ZUUL_BRANCH
264+ setup_project " openstack/keystone" $ZUUL_BRANCH
265+ local GIT_BASE=" http://tarballs.openstack.org"
266+ setup_project " openstack/glance" $ZUUL_BRANCH
267+
268+ assert_equal " ${GIT_CLONE_AND_CD_ARG["ryu"]} " " osrg/ryu,$OVERRIDE_RYU_GIT_BASE "
269+ assert_equal " ${GIT_CLONE_AND_CD_ARG["devstack-gate"]} " " test/devstack-gate,$OVERRIDE_DEVSTACK_GATE_GIT_BASE "
270+ assert_equal " ${GIT_CLONE_AND_CD_ARG["keystone"]} " " openstack/keystone,$GIT_BASE_DEF "
271+ assert_equal " ${GIT_CLONE_AND_CD_ARG["glance"]} " " openstack/glance,$GIT_BASE "
272+ assert_equal " ${GIT_CLONE_AND_CD_ARG["ERROR"]} " " NULL"
273+ }
274+
233275function test_grenade_backward {
234276 # devstack-gate master ZA
235277 # nova stable/havana ZB
@@ -240,8 +282,9 @@ function test_grenade_backward {
240282 # python-glanceclient not in queue
241283 # havana -> master (with changes)
242284
243- declare -A TEST_GIT_CHECKOUTS
244- declare -A TEST_ZUUL_REFS
285+ for aar_var in $LOCAL_AAR_VARS ; do
286+ eval ` echo " declare -A $aar_var " `
287+ done
245288 local ZUUL_PROJECT=' openstack/glance'
246289 local ZUUL_BRANCH=' master'
247290 local ZUUL_REF=' refs/zuul/master/ZE'
@@ -304,8 +347,9 @@ function test_grenade_forward {
304347 # python-glanceclient not in queue
305348 # havana (with changes) -> master
306349
307- declare -A TEST_GIT_CHECKOUTS
308- declare -A TEST_ZUUL_REFS
350+ for aar_var in $LOCAL_AAR_VARS ; do
351+ eval ` echo " declare -A $aar_var " `
352+ done
309353 local ZUUL_PROJECT=' openstack/glance'
310354 local ZUUL_BRANCH=' stable/havana'
311355 local ZUUL_REF=' refs/zuul/stable/havana/ZE'
@@ -364,8 +408,9 @@ function test_branch_override {
364408 # swift not in queue
365409 # python-glanceclient not in queue
366410
367- declare -A TEST_GIT_CHECKOUTS
368- declare -A TEST_ZUUL_REFS
411+ for aar_var in $LOCAL_AAR_VARS ; do
412+ eval ` echo " declare -A $aar_var " `
413+ done
369414 local ZUUL_PROJECT=' openstack-infra/devstack-gate'
370415 local ZUUL_BRANCH=' master'
371416 local ZUUL_REF=' refs/zuul/master/ZB'
@@ -388,8 +433,9 @@ function test_branch_override {
388433function test_periodic {
389434 # No queue
390435
391- declare -A TEST_GIT_CHECKOUTS
392- declare -A TEST_ZUUL_REFS
436+ for aar_var in $LOCAL_AAR_VARS ; do
437+ eval ` echo " declare -A $aar_var " `
438+ done
393439 local ZUUL_BRANCH=' stable/havana'
394440 local ZUUL_PROJECT=' openstack/glance'
395441
@@ -477,6 +523,7 @@ test_grenade_forward
477523test_multi_branch_on_master
478524test_multi_branch_on_stable
479525test_multi_branch_project_override
526+ test_multi_git_base_project_override
480527test_one_on_master
481528test_periodic
482529test_periodic_no_branch
0 commit comments