aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorboucherv <valentin.boucher@orange.com>2015-10-28 10:07:04 +0100
committerboucherv <valentin.boucher@orange.com>2015-10-28 12:03:54 +0100
commit11d8d4904b5346c8ca904e4a3723ddf5ba5bad8c (patch)
tree8665bf70446b5d94b3b8a8bf606beabb71e42570
parent6c22017400294fa017a28de00e6cc756db2d450f (diff)
vIMS test integration and move "push_results_to_db" method
Move "push_results_to_db" method to functest_util Updated some files for clearwater vIMS functional testing Change-Id: I21628b063470963e4e4425a0f89fefa33494e40d Signed-off-by: boucherv <valentin.boucher@orange.com>
-rw-r--r--docker/Dockerfile9
-rwxr-xr-xdocker/common.sh6
-rwxr-xr-xdocker/prepare_env.sh14
-rw-r--r--testcases/config_functest.yaml3
-rw-r--r--testcases/functest_utils.py18
-rw-r--r--testcases/vPing/CI/libraries/vPing.py22
6 files changed, 54 insertions, 18 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 59a262d2..836598a0 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -29,11 +29,13 @@ ENV repos_dir /home/opnfv/repos
RUN apt-get update && apt-get install -y \
ssh \
sshpass \
+curl \
git \
gcc \
wget \
python-dev \
python-pip \
+bundler \
postgresql \
build-essential \
libpq-dev \
@@ -53,7 +55,14 @@ RUN git clone https://gerrit.opnfv.org/gerrit/functest ${repos_dir}/functest
RUN git clone https://gerrit.opnfv.org/gerrit/releng ${repos_dir}/releng
RUN git clone https://github.com/openstack/rally.git ${repos_dir}/rally
RUN git clone https://github.com/opendaylight/integration.git ${repos_dir}/odl_integration
+RUN git clone -b stable https://github.com/boucherv-orange/clearwater-live-test ${repos_dir}/vims-test
RUN pip install -r ${repos_dir}/functest/docker/requirements.pip
+RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
+RUN curl -L https://get.rvm.io | bash -s stable
+RUN bash -c 'source /etc/profile.d/rvm.sh ; rvm autolibs enable ; rvm install 1.9.3 ; rvm use 1.9.3'
+RUN bash -c 'source /etc/profile.d/rvm.sh ; cd ${repos_dir}/vims-test ; bundle install'
+
ADD http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img /home/opnfv/functest/data/
+
diff --git a/docker/common.sh b/docker/common.sh
index 42b7d3e0..8c02d487 100755
--- a/docker/common.sh
+++ b/docker/common.sh
@@ -33,6 +33,7 @@ REPOS_DIR=$(cat $config_file | grep -w dir_repos | awk 'END {print $NF}')
FUNCTEST_REPO_DIR=$(cat $config_file | grep -w dir_repo_functest | awk 'END {print $NF}')
RALLY_REPO_DIR=$(cat $config_file | grep -w dir_repo_rally | awk 'END {print $NF}')
RELENG_REPO_DIR=$(cat $config_file | grep -w dir_repo_releng | awk 'END {print $NF}')
+VIMS_REPO_DIR=$(cat $config_file | grep -w dir_repo_vims_test | awk 'END {print $NF}')
FUNCTEST_DIR=$(cat $config_file | grep -w dir_functest | awk 'END {print $NF}')
FUNCTEST_RESULTS_DIR=$(cat $config_file | grep -w dir_results | awk 'END {print $NF}')
@@ -47,6 +48,8 @@ FUNCTEST_BRANCH=$(cat $config_file | grep -w functest_branch | awk 'END {print $
FUNCTEST_COMMIT=$(cat $config_file | grep -w functest_commit | awk 'END {print $NF}')
RELENG_BRANCH=$(cat $config_file | grep -w releng_branch | awk 'END {print $NF}')
RELENG_COMMIT=$(cat $config_file | grep -w releng_commit | awk 'END {print $NF}')
+VIMS_BRANCH=$(cat $config_file | grep -w vims_test_branch | awk 'END {print $NF}')
+VIMS_COMMIT=$(cat $config_file | grep -w vims_test_commit | awk 'END {print $NF}')
echo "_____Parsed needed data from ${config_file}:"
echo "####### Directories #######"
@@ -54,6 +57,7 @@ echo "REPOS_DIR=${REPOS_DIR}"
echo "FUNCTEST_REPO_DIR=${FUNCTEST_REPO_DIR}"
echo "RALLY_REPO_DIR=${RALLY_REPO_DIR}"
echo "RELENG_REPO_DIR=${RELENG_REPO_DIR}"
+echo "VIMS_REPO_DIR=${VIMS_REPO_DIR}"
echo "FUNCTEST_DIR=${FUNCTEST_DIR}"
echo "FUNCTEST_RESULTS_DIR=${FUNCTEST_RESULTS_DIR}"
echo "FUNCTEST_CONF_DIR=${FUNCTEST_CONF_DIR}"
@@ -66,6 +70,8 @@ echo "RELENG_BRANCH=${RELENG_BRANCH}"
echo "RELENG_COMMIT=${RELENG_COMMIT}"
echo "RALLY_BRANCH=${RALLY_BRANCH}"
echo "RALLY_COMMIT=${RALLY_COMMIT}"
+echo "VIMS_BRANCH=${VIMS_BRANCH}"
+echo "VIMS_COMMIT=${VIMS_COMMIT}"
echo "############################"
info () {
diff --git a/docker/prepare_env.sh b/docker/prepare_env.sh
index 42b1e1c4..6c77e814 100755
--- a/docker/prepare_env.sh
+++ b/docker/prepare_env.sh
@@ -104,6 +104,20 @@ if [ $offline == false ]; then
cd ${RALLY_REPO_DIR}
info "Rally repo: pulling to latest..."
git pull
+
+ info "Updating vIMS test repository...."
+ cd ${VIMS_REPO_DIR}
+ if [ ${VIMS_BRANCH} != "stable" ]; then
+ info "Releng repo: checkout ${VIMS_TEST_BRANCH} branch..."
+ git checkout ${VIMS_BRANCH}
+ fi
+ info "vIMS test repo: pulling to latest..."
+ git pull
+ if [ ${VIMS_COMMIT} != "latest" ]; then
+ info "vIMS test repo: given commit is ${VIMS_TEST_COMMIT}. Reseting..."
+ git reset --hard ${VIMS_COMMIT}
+ fi
+
fi
# We do this regardless if its online or offline mode.
diff --git a/testcases/config_functest.yaml b/testcases/config_functest.yaml
index 03835158..46033577 100644
--- a/testcases/config_functest.yaml
+++ b/testcases/config_functest.yaml
@@ -13,6 +13,7 @@ general:
dir_repo_functest: /home/opnfv/repos/functest
dir_repo_rally: /home/opnfv/repos/rally
dir_repo_releng: /home/opnfv/repos/releng
+ dir_repo_vims_test: /home/opnfv/repos/vims-test
dir_functest: /home/opnfv/functest
dir_results: /home/opnfv/functest/results
dir_functest_conf: /home/opnfv/functest/conf
@@ -29,6 +30,8 @@ general:
releng_commit: latest
rally_branch: master
rally_commit: 9a17d8490e7fb4afee2f5629e6db41eabe4bc4d4
+ vims_test_branch: stable
+ vims_test_commit: latest
openstack:
image_name: functest-img
diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py
index 59e89a5a..262149b2 100644
--- a/testcases/functest_utils.py
+++ b/testcases/functest_utils.py
@@ -13,6 +13,8 @@ import os
import urllib2
import subprocess
import sys
+import requests
+import json
from git import Repo
@@ -434,3 +436,19 @@ def get_installer_type(logger=None):
installer = "Unkown"
return installer
+
+def push_results_to_db(db_url, case_name, logger, pod_name, git_version, payload):
+ url = db_url + "/results"
+ installer = get_installer_type(logger)
+ params = {"project_name": "functest", "case_name": case_name,
+ "pod_name": pod_name, "installer": installer,
+ "version": git_version, "details": payload}
+
+ headers = {'Content-Type': 'application/json'}
+ try:
+ r = requests.post(url, data=json.dumps(params), headers=headers)
+ logger.debug(r)
+ return True
+ except:
+ print "Error:", sys.exc_info()[0]
+ return False
diff --git a/testcases/vPing/CI/libraries/vPing.py b/testcases/vPing/CI/libraries/vPing.py
index b51bb628..14671b66 100644
--- a/testcases/vPing/CI/libraries/vPing.py
+++ b/testcases/vPing/CI/libraries/vPing.py
@@ -242,22 +242,6 @@ def cleanup(nova, neutron, network_dic):
"Network '%s' deleted successfully" % NEUTRON_PRIVATE_NET_NAME)
return True
-
-def push_results_to_db(payload):
-
- url = TEST_DB + "/results"
- installer = functest_utils.get_installer_type(logger)
- git_version = functest_utils.get_git_branch(args.repo_path)
- # TODO pod_name hardcoded, info shall come from Jenkins
- params = {"project_name": "functest", "case_name": "vPing",
- "pod_name": "opnfv-jump-2", "installer": installer,
- "version": git_version, "details": payload}
-
- headers = {'Content-Type': 'application/json'}
- r = requests.post(url, data=json.dumps(params), headers=headers)
- logger.debug(r)
-
-
def main():
creds_nova = functest_utils.get_credentials("nova")
@@ -437,8 +421,10 @@ def main():
if args.report:
logger.debug("Push result into DB")
# TODO check path result for the file
- push_results_to_db(
- {'timestart': start_time_ts, 'duration': duration,
+ git_version = functest_utils.get_git_branch(args.repo_path)
+ functest_utils.push_results_to_db(db_url=TEST_DB, case_name="vPing",
+ logger=logger, pod_name="opnfv-jump-2", git_version=git_version,
+ payload={'timestart': start_time_ts, 'duration': duration,
'status': test_status})
# with open("vPing-result.json", "w") as outfile:
# json.dump({'timestart': start_time_ts, 'duration': duration,