Browse Source

Merge "Test run issue is fixed"

Jenkins 2 years ago
parent
commit
0019b1dac8
1 changed files with 18 additions and 29 deletions
  1. 18
    29
      plugin_test/utils/jenkins/system_tests.sh

+ 18
- 29
plugin_test/utils/jenkins/system_tests.sh View File

@@ -1,4 +1,4 @@
1
-#!/bin/sh
1
+#!/bin/bash
2 2
 PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
3 3
 
4 4
 INVALIDOPTS_ERR=100
@@ -407,11 +407,7 @@ RunTest() {
407 407
 
408 408
     # run python virtualenv
409 409
     if [ "${VENV}" = "yes" ]; then
410
-        if [ "${DRY_RUN}" = "yes" ]; then
411
-            echo . $VENV_PATH/bin/activate
412
-        else
413
-            . $VENV_PATH/bin/activate
414
-        fi
410
+      . $VENV_PATH/bin/activate
415 411
     fi
416 412
 
417 413
     if [ "${ENV_NAME}" = "" ]; then
@@ -431,14 +427,9 @@ RunTest() {
431 427
     export ISO_PATH
432 428
 
433 429
     if [ "${KEEP_BEFORE}" != "yes" ]; then
434
-      # remove previous environment
435
-      if [ "${DRY_RUN}" = "yes" ]; then
436
-        echo dos.py erase "${ENV_NAME}"
437
-      else
438 430
         if dos.py list | grep -q "^${ENV_NAME}\$" ; then
439
-          dos.py erase "${ENV_NAME}"
431
+            dos.py erase "${ENV_NAME}"
440 432
         fi
441
-      fi
442 433
     fi
443 434
 
444 435
     # gather additional option for this nose test run
@@ -455,16 +446,15 @@ RunTest() {
455 446
 
456 447
     clean_old_bridges
457 448
 
458
-    # run python test set to create environments, deploy and test product
459
-    if [ "${DRY_RUN}" = "yes" ]; then
460
-        echo export PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${WORKSPACE}"
461
-        echo python plugin_test/run_tests.py -q --nologcapture --with-xunit ${OPTS}
462
-    else
463
-        export PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${WORKSPACE}"
464
-        echo ${PYTHONPATH}
465
-        python plugin_test/run_tests.py -q --nologcapture --with-xunit ${OPTS} &
449
+    export PLUGIN_WORKSPACE="${WORKSPACE/\/fuel-qa}/plugin_test"
450
+    export WORKSPACE="${PLUGIN_WORKSPACE}/fuel-qa"
451
+    export PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${WORKSPACE}:${PLUGIN_WORKSPACE}"
466 452
 
467
-    fi
453
+    [[ "${DEBUG}" == "true" ]] && echo "PYTHONPATH:${PYTHONPATH} PATH${PATH}"
454
+    [[ "${DEBUG}" == "true" ]] && echo "PLUGIN_WORKSPACE:${PLUGIN_WORKSPACE}"
455
+    [[ "${DEBUG}" == "true" ]] && echo "WORKSPACE:${WORKSPACE}"
456
+
457
+    python $PLUGIN_WORKSPACE/run_tests.py -q --nologcapture --with-xunit ${OPTS} &
468 458
 
469 459
     SYSTEST_PID=$!
470 460
 
@@ -474,7 +464,7 @@ RunTest() {
474 464
 	  exit 1
475 465
     fi
476 466
 
477
-    while [ "$(virsh net-list | grep -c $ENV_NAME)" -ne 5 ];do sleep 10
467
+    while [ "$(virsh net-list | grep -c $ENV_NAME)" -ne 5 ]; do sleep 10
478 468
 	  if ! ps -p $SYSTEST_PID > /dev/null
479 469
 	  then
480 470
 	    echo System tests exited prematurely, aborting
@@ -578,17 +568,16 @@ clean_iptables() {
578 568
 }
579 569
 
580 570
 revert_ws() {
581
-  for i in $1
582
-  do
583
-    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; }
571
+  cmd="vmrun -T ws-shared -h https://localhost:443/sdk -u $WORKSTATION_USERNAME -p $WORKSTATION_PASSWORD"
572
+  for i in $1; do
573
+    $cmd listRegisteredVM | grep -q $i || { echo "VM $i does not exist"; continue; }
584 574
     echo vmrun: reverting $i to $WORKSTATION_SNAPSHOT
585
-    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; }
575
+    $cmd revertToSnapshot "[standard] $i/$i.vmx" $WORKSTATION_SNAPSHOT || { echo "Error: revert of $i failed";  return 1; }
586 576
   done
587 577
 
588
-  for i in $1
589
-  do
578
+  for i in $1; do
590 579
     echo vmrun: starting $i
591
-    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; }
580
+    $cmd start "[standard] $i/$i.vmx" || { echo "Error: $i failed to start";  return 1; }
592 581
   done
593 582
 }
594 583
 

Loading…
Cancel
Save