summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/test/testapi/htmlize/doc-build.sh10
-rw-r--r--utils/test/testapi/htmlize/finish.sh15
-rw-r--r--utils/test/testapi/htmlize/htmlize.py4
-rw-r--r--utils/test/testapi/htmlize/prepare.sh25
-rwxr-xr-xutils/test/testapi/run_test.sh44
-rw-r--r--utils/test/testapi/test-requirements.txt7
6 files changed, 49 insertions, 56 deletions
diff --git a/utils/test/testapi/htmlize/doc-build.sh b/utils/test/testapi/htmlize/doc-build.sh
index 427b4378b..33560ceea 100644
--- a/utils/test/testapi/htmlize/doc-build.sh
+++ b/utils/test/testapi/htmlize/doc-build.sh
@@ -3,8 +3,18 @@
set -o errexit
# Create virtual environment
+virtualenv $WORKSPACE/testapi_venv
source $WORKSPACE/testapi_venv/bin/activate
+# Swgger Codegen Tool
+url="http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.1/swagger-codegen-cli-2.2.1.jar"
+
+# Check for jar file locally and in the repo
+if [ ! -f swagger-codegen-cli.jar ];
+then
+ wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.1/swagger-codegen-cli-2.2.1.jar -O swagger-codegen-cli.jar
+fi
+
# Install Pre-requistics
pip install requests
diff --git a/utils/test/testapi/htmlize/finish.sh b/utils/test/testapi/htmlize/finish.sh
deleted file mode 100644
index dc3aa868b..000000000
--- a/utils/test/testapi/htmlize/finish.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# Stop opnfv-testapi server
-proc_number=`ps -ef | grep opnfv-testapi | grep -v grep | wc -l`
-
-if [ $proc_number -gt 0 ]; then
- procs=`ps -ef | grep opnfv-testapi | grep -v grep`
- echo "Kill opnfv-testapi server $procs"
- ps -ef | grep opnfv-testapi | grep -v grep | awk '{print $2}' | xargs kill -kill &>/dev/null
-fi
diff --git a/utils/test/testapi/htmlize/htmlize.py b/utils/test/testapi/htmlize/htmlize.py
index c07f98ecf..075e31f79 100644
--- a/utils/test/testapi/htmlize/htmlize.py
+++ b/utils/test/testapi/htmlize/htmlize.py
@@ -39,12 +39,12 @@ if __name__ == '__main__':
parser.add_argument('-ru', '--resource-listing-url',
type=str,
required=False,
- default='http://localhost:8000/swagger/spec.json',
+ default='http://testresults.opnfv.org/test/swagger/spec.json',
help='Resource Listing Spec File')
parser.add_argument('-au', '--api-declaration-url',
type=str,
required=False,
- default='http://localhost:8000/swagger/spec',
+ default='http://testresults.opnfv.org/test/swagger/spec',
help='API Declaration Spec File')
parser.add_argument('-o', '--output-directory',
required=True,
diff --git a/utils/test/testapi/htmlize/prepare.sh b/utils/test/testapi/htmlize/prepare.sh
deleted file mode 100644
index e79ac5693..000000000
--- a/utils/test/testapi/htmlize/prepare.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-#Creating virtual environment
-virtualenv testapi_venv
-source testapi_venv/bin/activate
-
-# Swgger Codegen Tool
-url="http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.1/swagger-codegen-cli-2.2.1.jar"
-
-#Check for jar file locally and in the repo
-if [ ! -f swagger-codegen-cli.jar ];
-then
- wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.1/swagger-codegen-cli-2.2.1.jar -O swagger-codegen-cli.jar
-fi
-
-# Start OPNFV Test API Server
-cd utils/test/testapi/
-pip install -r requirements.txt
-./install.sh
-opnfv-testapi -c ../../../testapi_venv/etc/opnfv_testapi/config.ini &
diff --git a/utils/test/testapi/run_test.sh b/utils/test/testapi/run_test.sh
index 9b25f8ffc..d1f05f201 100755
--- a/utils/test/testapi/run_test.sh
+++ b/utils/test/testapi/run_test.sh
@@ -1,10 +1,40 @@
-#! /bin/bash
+#!/bin/bash
-# Before run this script, make sure that testtools and discover
-# had been installed in your env
-# or else using pip to install them as follows:
-# pip install testtools, discover
+set -o errexit
+
+# Get script directory
+SCRIPTDIR=`dirname $0`
+
+# Either Workspace is set (CI)
+if [ -z $WORKSPACE ]
+then
+ WORKSPACE="."
+fi
+
+echo "Running unit tests..."
+
+# Creating virtual environment
+virtualenv $WORKSPACE/testapi_venv
+source $WORKSPACE/testapi_venv/bin/activate
+
+# Install requirements
+pip install -r $SCRIPTDIR/requirements.txt
find . -type f -name "*.pyc" -delete
-testrargs="discover ./opnfv_testapi/tests/unit"
-python -m testtools.run $testrargs
+
+nosetests --with-xunit \
+ --with-coverage \
+ --cover-erase \
+ --cover-package=$SCRIPTDIR/opnfv_testapi/cmd \
+ --cover-package=$SCRIPTDIR/opnfv_testapi/commonn \
+ --cover-package=$SCRIPTDIR/opnfv_testapi/resources \
+ --cover-package=$SCRIPTDIR/opnfv_testapi/router \
+ --cover-xml \
+ --cover-html \
+ $SCRIPTDIR/opnfv_testapi/tests
+
+exit_code=$?
+
+deactivate
+
+exit $exit_code
diff --git a/utils/test/testapi/test-requirements.txt b/utils/test/testapi/test-requirements.txt
deleted file mode 100644
index ddbdefcfd..000000000
--- a/utils/test/testapi/test-requirements.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# The order of packages is significant, because pip processes them in the order
-# of appearance. Changing the order has an impact on the overall integration
-# process, which may cause wedges in the gate later.
-
-testtools>=1.4.0
-discover
-futures \ No newline at end of file