summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
Diffstat (limited to 'ci')
-rw-r--r--ci/docker/yardstick-ci/Dockerfile9
-rwxr-xr-xci/docker/yardstick-ci/run_benchmarks45
-rwxr-xr-xci/yardstick-verify163
3 files changed, 179 insertions, 38 deletions
diff --git a/ci/docker/yardstick-ci/Dockerfile b/ci/docker/yardstick-ci/Dockerfile
index 15b0f6224..9a1e83262 100644
--- a/ci/docker/yardstick-ci/Dockerfile
+++ b/ci/docker/yardstick-ci/Dockerfile
@@ -11,7 +11,11 @@ FROM ubuntu:14.04
LABEL image=opnfv/yardstick-ci
-ENV YARDSTICK_REPO_DIR /home/yardstick
+# GIT repo directory
+ENV REPOS_DIR /home/opnfv/repos
+
+# Yardstick repo
+ENV YARDSTICK_REPO_DIR ${REPOS_DIR}/yardstick
RUN apt-get update && apt-get install -y \
wget \
@@ -29,6 +33,9 @@ RUN apt-get update && apt-get install -y \
RUN apt-get -y autoremove && \
apt-get clean
+RUN mkdir -p ${REPOS_DIR}
+
+RUN git config --global http.sslVerify false
RUN git clone https://gerrit.opnfv.org/gerrit/yardstick ${YARDSTICK_REPO_DIR}
COPY ./run_benchmarks /usr/local/bin/
diff --git a/ci/docker/yardstick-ci/run_benchmarks b/ci/docker/yardstick-ci/run_benchmarks
index 391ee63a4..501b661be 100755
--- a/ci/docker/yardstick-ci/run_benchmarks
+++ b/ci/docker/yardstick-ci/run_benchmarks
@@ -11,33 +11,51 @@
set -e
: ${YARDSTICK_REPO:='https://gerrit.opnfv.org/gerrit/yardstick'}
-: ${YARDSTICK_REPO_DIR:='/home/yardstick'}
-: ${YARDSTICK_BRANCH:='master'}
+: ${YARDSTICK_REPO_DIR:='/home/opnfv/yardstick'}
+: ${YARDSTICK_BRANCH:='master'} # branch, tag, sha1 or refspec
: ${RELENG_REPO:='https://gerrit.opnfv.org/gerrit/releng'}
-: ${RELENG_REPO_DIR:='/home/releng'}
-: ${RELENG_BRANCH:='master'}
+: ${RELENG_REPO_DIR:='/home/opnfv/repos/releng'}
+: ${RELENG_BRANCH:='master'} # branch, tag, sha1 or refspec
: ${INSTALLER_TYPE:='fuel'}
: ${INSTALLER_IP:='10.20.0.2'}
-: ${EXTERNAL_NET_ID:='net04_ext'}
+: ${POD_NAME:='opnfv-jump-2'}
+: ${EXTERNAL_NET:='net04_ext'}
-# clone releng
+git_checkout()
+{
+ if git cat-file -e $1^{commit} 2>/dev/null; then
+ # branch, tag or sha1 object
+ git checkout $1
+ else
+ # refspec / changeset
+ git fetch --tags --progress $2 $1
+ git checkout FETCH_HEAD
+ fi
+}
+
+echo
+echo "INFO: Updating releng -> $RELENG_BRANCH"
if [ ! -d $RELENG_REPO_DIR ]; then
git clone $RELENG_REPO $RELENG_REPO_DIR
fi
cd $RELENG_REPO_DIR
-git fetch --tags --progress $RELENG_REPO $RELENG_BRANCH
-git checkout FETCH_HEAD
+git checkout master && git pull
+git_checkout $RELENG_BRANCH $RELENG_REPO
-# clone yardstick
+echo
+echo "INFO: Updating yardstick -> $YARDSTICK_BRANCH"
if [ ! -d $YARDSTICK_REPO_DIR ]; then
git clone YARDSTICK_REPO $YARDSTICK_REPO_DIR
fi
cd $YARDSTICK_REPO_DIR
-git fetch --tags --progress $YARDSTICK_REPO $YARDSTICK_BRANCH
-git checkout FETCH_HEAD
+git checkout master && git pull
+git_checkout $YARDSTICK_BRANCH $YARDSTICK_REPO
+
+echo
+echo "INFO: Creating openstack credentials .."
# Create openstack credentials
$RELENG_REPO_DIR/utils/fetch_os_creds.sh \
@@ -51,10 +69,11 @@ if [ "$INSTALLER_TYPE" == "fuel" ]; then
ssh_opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
if sshpass -p r00tme ssh 2>/dev/null $ssh_opts root@${INSTALLER_IP} \
fuel environment --env 1 | grep opnfv-virt; then
+ echo "INFO: applying OPNFV playground hack"
export OS_ENDPOINT_TYPE='publicURL'
fi
fi
-export EXTERNAL_NET_ID
+export EXTERNAL_NET INSTALLER_TYPE POD_NAME
-$YARDSTICK_REPO_DIR/ci/yardstick-verify
+$YARDSTICK_REPO_DIR/ci/yardstick-verify $@
diff --git a/ci/yardstick-verify b/ci/yardstick-verify
index 15ea022e4..beb2170d3 100755
--- a/ci/yardstick-verify
+++ b/ci/yardstick-verify
@@ -8,10 +8,60 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-YARDSTICK_IMAGE_ID=
-CIRROS_IMAGE_ID=
+#
+# Set up the environment and run yardstick test suites.
+#
+# Example invocation: yardstick-verify -r 10.4.4.4 suite1.yaml suite2.yaml
+#
+# Openstack credentials must be set and the script must be run from its
+# original location in the yardstick repo.
+#
+# This script is intended to be used by the CI pipeline but it may also
+# be invoked manually.
+#
-QCOW_IMAGE="/tmp/workspace/yardstick/yardstick-trusty-server.img"
+SCRIPT=$0
+SCRIPT_ARGS=$@
+
+usage()
+{
+ cat << EOF
+usage: $0 options [TEST_SUITE ...]
+
+If no test suites are given ping.yaml is run.
+
+OPTIONS:
+ -h Show this message
+ -r IP address for Result API.
+ Default is to store the results to file ($DISPATCHER_FILE_NAME)
+ if this option is not present.
+
+EOF
+}
+
+DISPATCHER_TYPE=file
+DISPATCHER_FILE_NAME="/tmp/yardstick.out"
+DISPATCHER_HTTP_TARGET=
+
+while getopts "r:h" OPTION; do
+ case $OPTION in
+ h)
+ usage
+ exit 0
+ ;;
+ r)
+ DISPATCHER_TYPE=http
+ DISPATCHER_HTTP_TARGET=http://${OPTARG}/results
+ ;;
+ *)
+ echo "${OPTION} is not a valid argument"
+ exit 1
+ ;;
+ esac
+done
+
+shift $[OPTIND - 1]
+TEST_SUITES=$@
cleanup()
{
@@ -124,13 +174,64 @@ load_yardstick_image()
run_test()
{
echo
- echo "========== Running yardstick test suite =========="
+ echo "========== Running yardstick test suites =========="
+
+ mkdir -p /etc/yardstick
+
+ cat << EOF >> /etc/yardstick/yardstick.conf
+[DEFAULT]
+debug = True
+dispatcher = ${DISPATCHER_TYPE}
+
+[dispatcher_file]
+file_name = ${DISPATCHER_FILE_NAME}
+
+[dispatcher_http]
+timeout = 5
+target = ${DISPATCHER_HTTP_TARGET}
+EOF
+
+ local failed=0
+
+ if [ ${#SUITE_FILES[@]} -gt 0 ]; then
+
+ for suite in ${SUITE_FILES[*]}; do
+
+ echo "---------------------------"
+ echo "Running test suite: $suite"
+ echo "---------------------------"
+
+ if ! yardstick task start --suite $suite; then
+ echo "test suite $suite FAILED";
+
+ # Mark the test suite failed but continue
+ # running the remaining test suites.
+ (( failed++ ))
+ fi
+
+ done
+
+ if [ $failed -gt 0 ]; then
+
+ echo "---------------------------"
+ echo "$failed out of ${SUITE_FILES[*]} test suites FAILED"
+ echo "---------------------------"
+ exit 1
+ fi
+
+ else
+
+ echo "---------------------------"
+ echo "Running samples/ping.yaml "
+ echo "---------------------------"
+
+ if ! yardstick task start samples/ping.yaml; then
+ echo "Yardstick test FAILED"
+ exit 1
+ fi
- # Just run sample ping for now.
- if ! yardstick -d task start samples/ping.yaml; then
- echo "Yardstick test FAILED"
- exit 1
fi
+
}
main()
@@ -139,6 +240,34 @@ main()
cd $GITROOT
+ export YARDSTICK_VERSION=$(git rev-parse HEAD)
+
+ SUITE_FILES=()
+
+ # find the test suite files
+ for suite in $TEST_SUITES; do
+ if [ -f $suite ]; then
+ SUITE_FILES+=($suite)
+ else
+ tsdir=$GITROOT/tests/opnfv/test_suites
+ if [ ! -f $tsdir/$suite ]; then
+ echo "Test suite \"$suite\" does not exist"
+ exit 1
+ fi
+ SUITE_FILES+=($tsdir/$suite)
+ fi
+ done
+
+ echo
+ echo "========== Running Yardstick CI with following parameters =========="
+ echo "Script options: ${SCRIPT} $SCRIPT_ARGS"
+ echo "Result API: ${DISPATCHER_HTTP_TARGET:-$DISPATCHER_FILE_NAME}"
+ echo "YARDSTICK_VERSION: ${YARDSTICK_VERSION}"
+ echo "Number of test suites: ${#SUITE_FILES[@]}"
+ for suite in ${SUITE_FILES[*]}; do
+ echo " $suite"
+ done
+
# install yardstick
install_yardstick
@@ -148,22 +277,6 @@ main()
exit 1
fi
- # extract auth ip
- ip=$(echo $OS_AUTH_URL | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
-
- ## FIXME: temporarily disabling this because
- ## of timeout errors on LF-POD2.
- ## Maybe we need a longer timeout ??
- # check if the auth port is open
- # echo "Checking if tcp port $ip:5000 is open..."
- # nc -zv -w 10 $ip 5000; rc=$?;
- # if [ $rc -eq 0 ]; then
- # echo "$ip:5000 is open for tcp connections"
- # else
- # echo "$ip:5000 is closed"
- # exit 1
- # fi
-
# check if the api is up
echo "Checking if OS API is working..."
if ! glance image-list > /dev/null; then
@@ -175,6 +288,8 @@ main()
trap "error_exit" EXIT SIGTERM
+ QCOW_IMAGE="/tmp/workspace/yardstick/yardstick-trusty-server.img"
+
build_yardstick_image
load_yardstick_image
load_cirros_image