From d1a1c788312c7c5b1b098dfecc3ee0c2e0a039f5 Mon Sep 17 00:00:00 2001 From: QiLiang Date: Thu, 29 Mar 2018 16:27:57 +0800 Subject: Add Functest test hook 2 - Temporary run functest testcase after all clover env setup. - TODO: Use jenkins to trigger functest job. Change-Id: I5f620496d747c4d742c7bbf8bb825616f8c69499 Signed-off-by: QiLiang --- ci/deploy.sh | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/ci/deploy.sh b/ci/deploy.sh index d1f2961..2580dbc 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -9,12 +9,16 @@ # set -ex -CLOVER_BASE_DIR=`cd ${BASH_SOURCE[0]%/*}/..;pwd` +CLOVER_BASE_DIR=$(cd ${BASH_SOURCE[0]%/*}/..;pwd) CLOVER_WORK_DIR=$CLOVER_BASE_DIR/work -MASTER_NODE_NAME='master' +MASTER_NODE_NAME="master" SSH_OPTIONS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" K8S_ISTIO_DEPLOY_TIMEOUT=3600 +FUNCTEST_IMAGE="opnfv/functest-kubernetes:latest" +INSTALLER_TYPE="container4nfv" +DEPLOY_SCENARIO="k8-istio-clover" + mkdir -p $CLOVER_WORK_DIR cd $CLOVER_WORK_DIR @@ -42,3 +46,35 @@ scp $SSH_OPTIONS -i $MASTER_NODE_KEY -r $CLOVER_BASE_DIR ${MASTER_NODE_USER}@${M ssh $SSH_OPTIONS -i $MASTER_NODE_KEY ${MASTER_NODE_USER}@${MASTER_NODE_HOST} ./clover/ci/test.sh echo "Clover deploy complete!" + +############################################################################### +# Prepare and run functest. +# TODO: Use jenkins to trigger functest job. + +# Setup configuration file for running functest +mkdir -p $CLOVER_WORK_DIR/functest/results +scp $SSH_OPTIONS -i $MASTER_NODE_KEY \ + ${MASTER_NODE_USER}@${MASTER_NODE_HOST}:.kube/config \ + $CLOVER_WORK_DIR/functest/kube-config +RC_FILE=$CLOVER_WORK_DIR/functest/k8.creds +echo "export KUBERNETES_PROVIDER=local" > $RC_FILE +KUBE_MASTER_URL=$(cat $CLOVER_WORK_DIR/functest/kube-config | grep server | awk '{print $2}') +echo "export KUBE_MASTER_URL=$KUBE_MASTER_URL" >> $RC_FILE +KUBE_MASTER_IP=$(echo $KUBE_MASTER_URL | awk -F'https://|:[0-9]+' '$0=$2') +echo "export KUBE_MASTER_IP=$KUBE_MASTER_IP" >> $RC_FILE + +# Run functest +sudo docker pull $FUNCTEST_IMAGE +sudo docker run --rm \ + -e INSTALLER_TYPE=$INSTALLER_TYPE \ + -e NODE_NAME=$NODE_NAME \ + -e DEPLOY_SCENARIO=$DEPLOY_SCENARIO \ + -e BUILD_TAG=$BUILD_TAG \ + -v $RC_FILE:/home/opnfv/functest/conf/env_file \ + -v $CLOVER_WORK_DIR/functest/results:/home/opnfv/functest/results \ + -v $CLOVER_WORK_DIR/functest/kube-config:/root/.kube/config \ + $FUNCTEST_IMAGE \ + /bin/bash -c 'run_tests -r -t all' + +echo "Clover run functest complete!" +############################################################################### -- cgit 1.2.3-korg