This adds unit tests for all the GIT* definitions, ensuring that for
libraries we think should be defined, they are. It exposed a bug in
glance_store definitions in the process.
The GITDIR definition for python-openstackclient is moved to stackrc
for testability.
Change-Id: Ibd9ab665f0362a84f4f7e80e80da56a4737f584e
| ... | ... |
@@ -28,7 +28,7 @@ set +o xtrace |
| 28 | 28 |
|
| 29 | 29 |
# Set up default directories |
| 30 | 30 |
GITDIR["python-glanceclient"]=$DEST/python-glanceclient |
| 31 |
-GIRDIR["glance_store"]=$DEST/glance_store |
|
| 31 |
+GITDIR["glance_store"]=$DEST/glance_store |
|
| 32 | 32 |
|
| 33 | 33 |
GLANCE_DIR=$DEST/glance |
| 34 | 34 |
GLANCE_CACHE_DIR=${GLANCE_CACHE_DIR:=$DATA_DIR/glance/cache}
|
| ... | ... |
@@ -575,9 +575,6 @@ if [[ -d $TOP_DIR/extras.d ]]; then |
| 575 | 575 |
done |
| 576 | 576 |
fi |
| 577 | 577 |
|
| 578 |
-# Set the destination directories for other OpenStack projects |
|
| 579 |
-GITDIR["python-openstackclient"]=$DEST/python-openstackclient |
|
| 580 |
- |
|
| 581 | 578 |
# Interactive Configuration |
| 582 | 579 |
# ------------------------- |
| 583 | 580 |
|
| ... | ... |
@@ -273,6 +273,8 @@ GITBRANCH["python-troveclient"]=${TROVECLIENT_BRANCH:-master}
|
| 273 | 273 |
# consolidated openstack python client |
| 274 | 274 |
GITREPO["python-openstackclient"]=${OPENSTACKCLIENT_REPO:-${GIT_BASE}/openstack/python-openstackclient.git}
|
| 275 | 275 |
GITBRANCH["python-openstackclient"]=${OPENSTACKCLIENT_BRANCH:-master}
|
| 276 |
+# this doesn't exist in a lib file, so set it here |
|
| 277 |
+GITDIR["python-openstackclient"]=$DEST/python-openstackclient |
|
| 276 | 278 |
|
| 277 | 279 |
################### |
| 278 | 280 |
# |
| 279 | 281 |
new file mode 100755 |
| ... | ... |
@@ -0,0 +1,96 @@ |
| 0 |
+#!/usr/bin/env bash |
|
| 1 |
+# |
|
| 2 |
+# Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 3 |
+# you may not use this file except in compliance with the License. |
|
| 4 |
+# You may obtain a copy of the License at |
|
| 5 |
+# |
|
| 6 |
+# http://www.apache.org/licenses/LICENSE-2.0 |
|
| 7 |
+# |
|
| 8 |
+# Unless required by applicable law or agreed to in writing, software |
|
| 9 |
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
|
| 10 |
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
|
| 11 |
+# License for the specific language governing permissions and limitations |
|
| 12 |
+# under the License. |
|
| 13 |
+ |
|
| 14 |
+ |
|
| 15 |
+TOP=$(cd $(dirname "$0")/.. && pwd) |
|
| 16 |
+ |
|
| 17 |
+export TOP_DIR=$TOP |
|
| 18 |
+ |
|
| 19 |
+# Import common functions |
|
| 20 |
+source $TOP/functions |
|
| 21 |
+source $TOP/stackrc |
|
| 22 |
+source $TOP/lib/tls |
|
| 23 |
+for i in $TOP/lib/*; do |
|
| 24 |
+ if [[ -f $i ]]; then |
|
| 25 |
+ source $i |
|
| 26 |
+ fi |
|
| 27 |
+done |
|
| 28 |
+ |
|
| 29 |
+ALL_LIBS="python-novaclient oslo.config pbr oslo.context python-troveclient python-keystoneclient taskflow oslo.middleware pycadf python-glanceclient python-ironicclient tempest-lib oslo.messaging oslo.log cliff python-heatclient stevedore python-cinderclient glance_store oslo.concurrency oslo.db oslo.vmware keystonemiddleware oslo.serialization python-saharaclient django_openstack_auth python-openstackclient oslo.rootwrap oslo.i18n python-ceilometerclient oslo.utils python-swiftclient python-neutronclient" |
|
| 30 |
+ |
|
| 31 |
+# Generate the above list with |
|
| 32 |
+# echo ${!GITREPO[@]}
|
|
| 33 |
+ |
|
| 34 |
+function check_exists {
|
|
| 35 |
+ local thing=$1 |
|
| 36 |
+ local hash=$2 |
|
| 37 |
+ local key=$3 |
|
| 38 |
+ if [[ ! -z "$VERBOSE" ]]; then |
|
| 39 |
+ echo "Checking for $hash[$key]" |
|
| 40 |
+ fi |
|
| 41 |
+ if [[ -z $thing ]]; then |
|
| 42 |
+ echo "$hash[$key] does not exit!" |
|
| 43 |
+ exit 1 |
|
| 44 |
+ else |
|
| 45 |
+ if [[ ! -z "$VERBOSE" ]]; then |
|
| 46 |
+ echo "$hash[$key] => $thing" |
|
| 47 |
+ fi |
|
| 48 |
+ fi |
|
| 49 |
+} |
|
| 50 |
+ |
|
| 51 |
+function test_all_libs_upto_date {
|
|
| 52 |
+ # this is all the magics |
|
| 53 |
+ local found_libs=${!GITREPO[@]}
|
|
| 54 |
+ declare -A all_libs |
|
| 55 |
+ for lib in $ALL_LIBS; do |
|
| 56 |
+ all_libs[$lib]=1 |
|
| 57 |
+ done |
|
| 58 |
+ |
|
| 59 |
+ for lib in $found_libs; do |
|
| 60 |
+ if [[ -z ${all_libs[$lib]} ]]; then
|
|
| 61 |
+ echo "Library '$lib' not listed in unit tests, please add to ALL_LIBS" |
|
| 62 |
+ exit 1 |
|
| 63 |
+ fi |
|
| 64 |
+ |
|
| 65 |
+ done |
|
| 66 |
+ echo "test_all_libs_upto_date PASSED" |
|
| 67 |
+} |
|
| 68 |
+ |
|
| 69 |
+function test_libs_exist {
|
|
| 70 |
+ local lib="" |
|
| 71 |
+ for lib in $ALL_LIBS; do |
|
| 72 |
+ check_exists "${GITREPO[$lib]}" "GITREPO" "$lib"
|
|
| 73 |
+ check_exists "${GITBRANCH[$lib]}" "GITBRANCH" "$lib"
|
|
| 74 |
+ check_exists "${GITDIR[$lib]}" "GITDIR" "$lib"
|
|
| 75 |
+ done |
|
| 76 |
+ |
|
| 77 |
+ echo "test_libs_exist PASSED" |
|
| 78 |
+} |
|
| 79 |
+ |
|
| 80 |
+function test_branch_master {
|
|
| 81 |
+ for lib in $ALL_LIBS; do |
|
| 82 |
+ if [[ ${GITBRANCH[$lib]} != "master" ]]; then
|
|
| 83 |
+ echo "GITBRANCH for $lib not master (${GITBRANCH[$lib]})"
|
|
| 84 |
+ exit 1 |
|
| 85 |
+ fi |
|
| 86 |
+ done |
|
| 87 |
+ |
|
| 88 |
+ echo "test_branch_master PASSED" |
|
| 89 |
+} |
|
| 90 |
+ |
|
| 91 |
+set -o errexit |
|
| 92 |
+ |
|
| 93 |
+test_libs_exist |
|
| 94 |
+test_branch_master |
|
| 95 |
+test_all_libs_upto_date |