]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Enhance configure_for_func_testing.sh for *aaS use
authorPaul Michali <pc@michali.net>
Tue, 21 Apr 2015 20:12:38 +0000 (16:12 -0400)
committerPaul Michali <pc@michali.net>
Mon, 4 May 2015 19:23:12 +0000 (15:23 -0400)
Modify the script so that it can be used by the *aaS functional tests.
This is done by allowing callers, namely other *aaS repos, to override
information, like the project name and virtual environment used (for
example, VPNaaS has two functional jobs with different virtual env).

Change-Id: I450273036e938a4acc9a7bc1dc193a9c207b2d58
Closes-Bug: #1446807

neutron/tests/contrib/gate_hook.sh
tools/configure_for_func_testing.sh

index 4c777f5251ef4d7488786c47d50c4c361360d905..dc31d2f68179361501c1af47a89b5155d35f11bd 100644 (file)
@@ -4,16 +4,17 @@
 set -ex
 
 
-venv=${1:-"dsvm-functional"}
+VENV=${1:-"dsvm-functional"}
 
 
-if [ "$venv" == "dsvm-functional" ]
+if [ "$VENV" == "dsvm-functional" ]
 then
     # The following need to be set before sourcing
     # configure_for_func_testing.
     GATE_DEST=$BASE/new
     GATE_STACK_USER=stack
     NEUTRON_PATH=$GATE_DEST/neutron
+    PROJECT_NAME=neutron
     DEVSTACK_PATH=$GATE_DEST/devstack
     IS_GATE=True
 
@@ -22,8 +23,8 @@ then
     # Make the workspace owned by the stack user
     sudo chown -R $STACK_USER:$STACK_USER $BASE
 
-    configure_host_for_func_testing $STACK_USER
-elif [ "$venv" == "api" ]
+    configure_host_for_func_testing
+elif [ "$VENV" == "api" ]
 then
     $BASE/new/devstack-gate/devstack-vm-gate.sh
 fi
index e04b07f6dd48f0cc03f9097201440458a9ecc9bc..3b4e124ac7fa0d99487a2aecc3a767327a6f5c77 100755 (executable)
@@ -49,8 +49,11 @@ done
 
 # Default to environment variables to permit the gate_hook to override
 # when sourcing.
+VENV=${VENV:-dsvm-functional}
 DEVSTACK_PATH=${DEVSTACK_PATH:-$1}
- # The gate should automatically install dependencies.
+PROJECT_NAME=${PROJECT_NAME:-neutron}
+REPO_BASE=${GATE_DEST:-$(cd $(dirname "$0")/../.. && pwd)}
+# The gate should automatically install dependencies.
 INSTALL_BASE_DEPENDENCIES=${INSTALL_BASE_DEPENDENCIES:-$IS_GATE}
 
 
@@ -64,8 +67,6 @@ set -x
 
 
 function _init {
-    NEUTRON_PATH=${NEUTRON_PATH:-$(cd $(dirname "$0")/.. && pwd)}
-
     # Subsequently-called devstack functions depend on the following variables.
     HOST_IP=127.0.0.1
     FILES=$DEVSTACK_PATH/files
@@ -175,10 +176,9 @@ function _install_agent_deps {
 function _install_rootwrap_sudoers {
     echo_summary "Installing rootwrap sudoers file"
 
-    VENV_NAME=${venv:-dsvm-functional}
-    VENV_PATH=$NEUTRON_PATH/.tox/$VENV_NAME
-    ROOTWRAP_SUDOER_CMD="$VENV_PATH/bin/neutron-rootwrap $VENV_PATH/etc/neutron/rootwrap.conf *"
-    ROOTWRAP_DAEMON_SUDOER_CMD="$VENV_PATH/bin/neutron-rootwrap-daemon $VENV_PATH/etc/neutron/rootwrap.conf"
+    PROJECT_VENV=$REPO_BASE/$PROJECT_NAME/.tox/$VENV
+    ROOTWRAP_SUDOER_CMD="$PROJECT_VENV/bin/neutron-rootwrap $PROJECT_VENV/etc/neutron/rootwrap.conf *"
+    ROOTWRAP_DAEMON_SUDOER_CMD="$PROJECT_VENV/bin/neutron-rootwrap-daemon $PROJECT_VENV/etc/neutron/rootwrap.conf"
     TEMPFILE=$(mktemp)
     cat << EOF > $TEMPFILE
 # A bug in oslo.rootwrap [1] prevents commands executed with 'ip netns
@@ -193,7 +193,7 @@ function _install_rootwrap_sudoers {
 #
 # 1: https://bugs.launchpad.net/oslo.rootwrap/+bug/1417331
 #
-Defaults:$STACK_USER  secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$VENV_PATH/bin"
+Defaults:$STACK_USER  secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PROJECT_VENV/bin"
 $STACK_USER ALL=(root) NOPASSWD: $ROOTWRAP_SUDOER_CMD
 $STACK_USER ALL=(root) NOPASSWD: $ROOTWRAP_DAEMON_SUDOER_CMD
 EOF