Merge "Test run issue is fixed"

This commit is contained in:
Jenkins 2016-11-22 11:20:18 +00:00 committed by Gerrit Code Review
commit 0019b1dac8
1 changed files with 18 additions and 29 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
INVALIDOPTS_ERR=100 INVALIDOPTS_ERR=100
@ -407,11 +407,7 @@ RunTest() {
# run python virtualenv # run python virtualenv
if [ "${VENV}" = "yes" ]; then if [ "${VENV}" = "yes" ]; then
if [ "${DRY_RUN}" = "yes" ]; then . $VENV_PATH/bin/activate
echo . $VENV_PATH/bin/activate
else
. $VENV_PATH/bin/activate
fi
fi fi
if [ "${ENV_NAME}" = "" ]; then if [ "${ENV_NAME}" = "" ]; then
@ -431,14 +427,9 @@ RunTest() {
export ISO_PATH export ISO_PATH
if [ "${KEEP_BEFORE}" != "yes" ]; then if [ "${KEEP_BEFORE}" != "yes" ]; then
# remove previous environment
if [ "${DRY_RUN}" = "yes" ]; then
echo dos.py erase "${ENV_NAME}"
else
if dos.py list | grep -q "^${ENV_NAME}\$" ; then if dos.py list | grep -q "^${ENV_NAME}\$" ; then
dos.py erase "${ENV_NAME}" dos.py erase "${ENV_NAME}"
fi fi
fi
fi fi
# gather additional option for this nose test run # gather additional option for this nose test run
@ -455,16 +446,15 @@ RunTest() {
clean_old_bridges clean_old_bridges
# run python test set to create environments, deploy and test product export PLUGIN_WORKSPACE="${WORKSPACE/\/fuel-qa}/plugin_test"
if [ "${DRY_RUN}" = "yes" ]; then export WORKSPACE="${PLUGIN_WORKSPACE}/fuel-qa"
echo export PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${WORKSPACE}" export PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${WORKSPACE}:${PLUGIN_WORKSPACE}"
echo python plugin_test/run_tests.py -q --nologcapture --with-xunit ${OPTS}
else
export PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${WORKSPACE}"
echo ${PYTHONPATH}
python plugin_test/run_tests.py -q --nologcapture --with-xunit ${OPTS} &
fi [[ "${DEBUG}" == "true" ]] && echo "PYTHONPATH:${PYTHONPATH} PATH${PATH}"
[[ "${DEBUG}" == "true" ]] && echo "PLUGIN_WORKSPACE:${PLUGIN_WORKSPACE}"
[[ "${DEBUG}" == "true" ]] && echo "WORKSPACE:${WORKSPACE}"
python $PLUGIN_WORKSPACE/run_tests.py -q --nologcapture --with-xunit ${OPTS} &
SYSTEST_PID=$! SYSTEST_PID=$!
@ -474,7 +464,7 @@ RunTest() {
exit 1 exit 1
fi fi
while [ "$(virsh net-list | grep -c $ENV_NAME)" -ne 5 ];do sleep 10 while [ "$(virsh net-list | grep -c $ENV_NAME)" -ne 5 ]; do sleep 10
if ! ps -p $SYSTEST_PID > /dev/null if ! ps -p $SYSTEST_PID > /dev/null
then then
echo System tests exited prematurely, aborting echo System tests exited prematurely, aborting
@ -578,17 +568,16 @@ clean_iptables() {
} }
revert_ws() { revert_ws() {
for i in $1 cmd="vmrun -T ws-shared -h https://localhost:443/sdk -u $WORKSTATION_USERNAME -p $WORKSTATION_PASSWORD"
do for i in $1; do
vmrun -T ws-shared -h https://localhost:443/sdk -u $WORKSTATION_USERNAME -p $WORKSTATION_PASSWORD listRegisteredVM | grep -q $i || { echo "VM $i does not exist"; continue; } $cmd listRegisteredVM | grep -q $i || { echo "VM $i does not exist"; continue; }
echo vmrun: reverting $i to $WORKSTATION_SNAPSHOT echo vmrun: reverting $i to $WORKSTATION_SNAPSHOT
vmrun -T ws-shared -h https://localhost:443/sdk -u $WORKSTATION_USERNAME -p $WORKSTATION_PASSWORD revertToSnapshot "[standard] $i/$i.vmx" $WORKSTATION_SNAPSHOT || { echo "Error: revert of $i failed"; return 1; } $cmd revertToSnapshot "[standard] $i/$i.vmx" $WORKSTATION_SNAPSHOT || { echo "Error: revert of $i failed"; return 1; }
done done
for i in $1 for i in $1; do
do
echo vmrun: starting $i echo vmrun: starting $i
vmrun -T ws-shared -h https://localhost:443/sdk -u $WORKSTATION_USERNAME -p $WORKSTATION_PASSWORD start "[standard] $i/$i.vmx" || { echo "Error: $i failed to start"; return 1; } $cmd start "[standard] $i/$i.vmx" || { echo "Error: $i failed to start"; return 1; }
done done
} }