summaryrefslogtreecommitdiffstats
path: root/tests/run.sh
diff options
context:
space:
mode:
authorTomi Juvonen <tomi.juvonen@nokia.com>2016-12-15 10:10:07 +0200
committerTomi Juvonen <tomi.juvonen@nokia.com>2017-04-18 12:35:15 +0300
commit661fbc57a5cd5137a58cc6a285f4b6f91d78e0f0 (patch)
treed360f0856b04a7a26ffb7f0821d6ae39d0433c2c /tests/run.sh
parent263682e54a4d75d1f33c76735ffa2fe9debe0161 (diff)
Change role of doctor user to _member_
Change role of doctor user to _member_ Do needful changes to API calls Add admin a role to project Add Fuel support JIRA: DOCTOR-80 Change-Id: Ic7f88b9ceb6c4fc90e5e985ecfbc50c907b2367e Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com>
Diffstat (limited to 'tests/run.sh')
-rwxr-xr-xtests/run.sh51
1 files changed, 37 insertions, 14 deletions
diff --git a/tests/run.sh b/tests/run.sh
index d97a5c9c..c21c3fd7 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -28,8 +28,7 @@ CONSUMER_PORT=12346
DOCTOR_USER=doctor
DOCTOR_PW=doctor
DOCTOR_PROJECT=doctor
-#TODO: change back to `_member_` when JIRA DOCTOR-55 is done
-DOCTOR_ROLE=admin
+DOCTOR_ROLE=_member_
PROFILER_TYPE=${PROFILER_TYPE:-none}
TOP_DIR=$(cd $(dirname "$0") && pwd)
@@ -39,13 +38,15 @@ as_doctor_user="--os-username $DOCTOR_USER --os-password $DOCTOR_PW
# NOTE: ceilometer command still requires '--os-tenant-name'.
#ceilometer="ceilometer ${as_doctor_user/--os-project-name/--os-tenant-name}"
ceilometer="ceilometer $as_doctor_user"
+as_admin_user="--os-username admin --os-project-name $DOCTOR_PROJECT
+ --os-tenant-name $DOCTOR_PROJECT"
# Functions
get_compute_host_info() {
- # get computer host info which first VM boot in
- COMPUTE_HOST=$(openstack $as_doctor_user server show ${VM_BASENAME}1 |
+ # get computer host info which first VM boot in as admin user
+ COMPUTE_HOST=$(openstack $as_admin_user server show ${VM_BASENAME}1 |
grep "OS-EXT-SRV-ATTR:host" | awk '{ print $4 }')
compute_host_in_undercloud=${COMPUTE_HOST%%.*}
die_if_not_set $LINENO COMPUTE_HOST "Failed to get compute hostname"
@@ -108,17 +109,25 @@ register_image() {
create_test_user() {
openstack project list | grep -q " $DOCTOR_PROJECT " || {
- openstack project create "$DOCTOR_PROJECT"
+ openstack project create --description "Doctor Project" \
+ "$DOCTOR_PROJECT"
}
openstack user list | grep -q " $DOCTOR_USER " || {
openstack user create "$DOCTOR_USER" --password "$DOCTOR_PW" \
--project "$DOCTOR_PROJECT"
}
- openstack role show "$DOCTOR_ROLE" || {
+ openstack role show "$DOCTOR_ROLE" | grep -q " $DOCTOR_ROLE " || {
openstack role create "$DOCTOR_ROLE"
}
- openstack role add "$DOCTOR_ROLE" --user "$DOCTOR_USER" \
- --project "$DOCTOR_PROJECT"
+ openstack role assignment list --user "$DOCTOR_USER" \
+ --project "$DOCTOR_PROJECT" --names | grep -q " $DOCTOR_ROLE " || {
+ openstack role add "$DOCTOR_ROLE" --user "$DOCTOR_USER" \
+ --project "$DOCTOR_PROJECT"
+ }
+ openstack role assignment list --user admin --project "$DOCTOR_PROJECT" \
+ --names | grep -q " admin " || {
+ openstack role add admin --user admin --project "$DOCTOR_PROJECT"
+ }
# tojuvone: openstack quota show is broken and have to use nova
# https://bugs.launchpad.net/manila/+bug/1652118
# Note! while it is encouraged to use openstack client it has proven
@@ -140,6 +149,24 @@ create_test_user() {
fi
}
+remove_test_user() {
+ openstack project list | grep -q " $DOCTOR_PROJECT " && {
+ openstack role assignment list --user admin \
+ --project "$DOCTOR_PROJECT" --names | grep -q " admin " && {
+ openstack role remove admin --user admin --project "$DOCTOR_PROJECT"
+ }
+ openstack user list | grep -q " $DOCTOR_USER " && {
+ openstack role assignment list --user "$DOCTOR_USER" \
+ --project "$DOCTOR_PROJECT" --names | grep -q " $DOCTOR_ROLE " && {
+ openstack role remove "$DOCTOR_ROLE" --user "$DOCTOR_USER" \
+ --project "$DOCTOR_PROJECT"
+ }
+ openstack user delete "$DOCTOR_USER"
+ }
+ openstack project delete "$DOCTOR_PROJECT"
+ }
+}
+
boot_vm() {
# test VM done with test user, so can test non-admin
@@ -435,12 +462,8 @@ cleanup() {
if [[ "$use_existing_image" == false ]] ; then
[ -n "$image_id" ] && openstack image delete "$image_id"
fi
- openstack role remove "$DOCTOR_ROLE" --user "$DOCTOR_USER" \
- --project "$DOCTOR_PROJECT"
- openstack project delete "$DOCTOR_PROJECT"
- openstack user delete "$DOCTOR_USER"
- # NOTE: remove role only for doctor test.
- #openstack role delete "$DOCTOR_ROLE"
+
+ remove_test_user
cleanup_installer
cleanup_inspector