diff --git a/Jenkinsfile b/Jenkinsfile index 1fdae467..ae2d2e0b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -69,20 +69,12 @@ def stage_rpmbuild(label) { } } -def stage_integration(label) { +def stage_acceptance(label) { node("multibox") { + stage "Acceptance Test ${label}" checkout_and_merge() - stage "Build Integration Environment" write_build_env(label) - - try { - sh "cd ci/multibox/ ; ./build.sh" - stage "Run Tntegration Test" - // This is where the integration test will be run - } finally { - stage "Cleanup Environment" - sh "cd ci/multibox/ ; ./destroy_leaving_cache.sh" - } + sh "./ci/acceptance-test/build_and_run_in_docker.sh ./build.env" } } @@ -112,5 +104,5 @@ if( buildParams.BUILD_OS != "all" ){ for( label in build_nodes) { stage_unit_test(label) stage_rpmbuild(label) - stage_integration(label) + stage_acceptance(label) } diff --git a/ci/acceptance-test/.dockerignore b/ci/acceptance-test/.dockerignore new file mode 100644 index 00000000..6e706149 --- /dev/null +++ b/ci/acceptance-test/.dockerignore @@ -0,0 +1,3 @@ +tests +illustrations +build_and_run_in_docker.sh diff --git a/ci/acceptance-test/Dockerfile b/ci/acceptance-test/Dockerfile new file mode 100644 index 00000000..b47b532b --- /dev/null +++ b/ci/acceptance-test/Dockerfile @@ -0,0 +1,29 @@ +FROM centos:7 + +MAINTAINER "Axsh Co. LTD" + +VOLUME /data + +RUN ["yum", "install", "-y", "epel-release"] +RUN ["yum", "install", "-y", "rsync", "bridge-utils", "qemu-kvm", "qemu-system-x86", "parted", "sudo", "openssh-clients", "nmap-ncat"] + +RUN groupadd -r axsh && useradd -d /home/axsh -g axsh axsh +WORKDIR /home/axsh + +ARG BRANCH +ARG RELEASE_SUFFIX +ARG REBUILD + +# Set the ARGs to ENV because otherwise they're not visible to the run_tests.sh script +ENV BRANCH=${BRANCH:-master} RELEASE_SUFFIX=${RELEASE_SUFFIX:-current} REBUILD=${REBUILD:-false} + +LABEL "jp.axsh.vendor"="Axsh Co. LTD" \ + "jp.axsh.project"="OpenVDC" \ + "jp.axsh.task"="acceptance test" \ + "jp.axsh.branch"="$BRANCH" \ + "jp.axsh.release_suffix"="$RELEASE_SUFFIX" + +COPY ["multibox", "/multibox"] +COPY ["run_tests.sh", "run_tests.sh"] + +ENTRYPOINT ["./run_tests.sh", "RUN"] diff --git a/ci/acceptance-test/README.md b/ci/acceptance-test/README.md new file mode 100644 index 00000000..9caff47d --- /dev/null +++ b/ci/acceptance-test/README.md @@ -0,0 +1,141 @@ +# OpenVDC Acceptance Test + +## Quick start + +![Test environment drawing](illustrations/drawing.svg) + +This is the environment used on the OpenVDC CI to run the integration tests. To run this environment locally first make a file containing the following environment variables. + +``` +# The following two lines make up the yum repository from which we'll download OpenVDC packages to test +# "https://ci.openvdc.org/repos/${BRANCH}/${RELEASE_SUFFIX}/" +BRANCH="master" +RELEASE_SUFFIX="current" + +# Set to "1" if you don't want to remove the Docker container after running +REBUILD="0" + +# This variable holds the directory on the *host* that will be bind mounted +# into the Docker container to place the cache for KVM images. +# If not provided, the default value is "/data2" +DATA_DIR=/data2 +``` + +Let's save this file as `build.env`. Now kick off the `build_and_run_in_docker.sh` script, passing in that file as an argument. + +``` +./build_and_run_in_docker.sh build.env +``` + +That's it. This should build the environment and run the tests + +## The nitty gritty + +Here's everything you need to know about how this acceptance test works exactly. + +### The actual test code + +The actual test code is in the `tests` directory. This is written in go using the [Testing](https://golang.org/pkg/testing/) package. During the CI's rpmbuild stage, these tests are compiled as a binary and packaged in an rpm called `openvdc-acceptance-test`. This way we don't have to worry about installing go and setting up a GOPATH on the test environment. + +### The Docker container + +The test environment consists of multiple KVM machines and we've decided to put them all together in a Docker container. That way we can test multiple branches in parallel and cleanup becomes simple. We just remove the container when we're done. + +The command we run inside of the Docker container is `run_tests.sh`. This script will first write the correct OpenVDC yum repository to `/etc/yum.repos.d/openvdc.repo`. The environment variables described in [Quick start](#quick-start) decide which repository is used. + +Next the `run_tests.sh` script installs the `openvdc-acceptance-test` package through yum which depends on `openvdc-cli`. + +Now we build the KVM environment. + +### The KVM environment + +The code that builds the KVM machines running inside of the Docker container is in the `multibox` directory. + +If you want to run this KVM environment locally without Docker, you can do so like this. + +``` +BRANCH=master RELEASE_SUFFIX=current REBUILD=false ./build.sh +``` + +This environment uses a caching system to avoid having to constantly rebuild the images every time we test a new branch or commit. The system works as follows. + +#### First time ever run + +* Download seed image containing a minimal Centos 7. All images built are based on this. + +#### First time run on a branch + +* Build images in .raw format **without** openvdc installed. We use .raw so we can loopback mount and install packages using chroot. + +* Convert images to .qcow format so we can use copy-on-write. + +* Store images in cache directory. + +#### Every time we run on a branch + +* Copy-on-write cached images for branch to the directory we will run KVM from. + +* Run KVM. + +* Install OpenVDC packages on KVM VMs for the branch/commit we're testing + +The cache directory is bind mounted into the Docker container so the same cache is re-used every time the tests run. + +### The actual tests + +Once the KVM environment is in place we can run the actual tests. This is the `run_tests.sh` script's final action. + +To make sure that the `openvdc` command doesn't require root previliges, we run it as an unpreviliged `axsh` user. + +### Cleanup + +The `build_and_run_in_docker.sh` script traps EXIT and calls a cleanup function that will remove the Docker container unless `LEAVE_CONTAINER` is set. + +The leftover KVM cache and Docker images are cleaned up periodically by a garbage collection job on Jenkins. + +## FAQ + +Keep in mind that all answers are true at time of writing (January 2017) and might no longer be accurate. + +#### What OS has it run on successfully? + +Fedora 23 and Arch Linux. + +#### What Docker versions has it run on successfully? + +1.10.3 on Fedora and 1.12.6 on Arch. + +#### How much disk space is required? + +609 MB for the KVM centos 7 seed image. + +``` +> du -hs openvdc-ci/boxes + +609M openvdc-ci/boxes +``` + +About 3.9 GB KVM cache per branch + +``` +> du -hs openvdc-ci/branches/* + +3.9G openvdc-ci/branches/acceptance-test +3.8G openvdc-ci/branches/master +``` + +About 470 MB per Docker image plus about 190 MB for the base Centos 7 image. + +``` +> sudo docker images + +REPOSITORY TAG IMAGE ID CREATED SIZE +openvdc/acceptance-test acceptance-test.current 8f53091d43bb 29 minutes ago 470.8 MB +centos 7 67591570dd29 5 weeks ago 191.8 MB +``` + +You do the math. :p + +#### How much memory is required? + +We've got 5 KVM machines with 1 GB of memory assigned to each one. diff --git a/ci/acceptance-test/build_and_run_in_docker.sh b/ci/acceptance-test/build_and_run_in_docker.sh new file mode 100755 index 00000000..89a97d74 --- /dev/null +++ b/ci/acceptance-test/build_and_run_in_docker.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -ex -o pipefail + +whereami="$(cd "$(dirname $(readlink -f "$0"))" && pwd -P)" + +BUILD_ENV_PATH=${1:?"ERROR: env file is not given."} +if [[ -n "${BUILD_ENV_PATH}" && ! -f "${BUILD_ENV_PATH}" ]]; then + echo "ERROR: Can't find the file: ${BUILD_ENV_PATH}" >&2 + exit 1 +fi + +set -a +. ${BUILD_ENV_PATH} +set +a + +DATA_DIR="${DATA_DIR:-/data2}" +repo_and_tag="openvdc/acceptance-test:${BRANCH}.${RELEASE_SUFFIX}" + +function cleanup() { + if [[ -z "${LEAVE_CONTAINER}" || "${LEAVE_CONTAINER}" == "0" ]]; then + # Clean up containers + # Images don't need to be cleaned up. Removing them immediately would slow down + # builds and they can be garbage collected later. + for CID in $(sudo docker ps -af ancestor="${repo_and_tag}" --format "{{.ID}}"); do + sudo docker rm "${CID}" + done + else + echo "LEAVE_CONTAINER was set and not 0. Skip container cleanup." + fi +} +trap "cleanup" EXIT + +sudo docker build -t "${repo_and_tag}" --build-arg BRANCH="${BRANCH}" \ + --build-arg RELEASE_SUFFIX="${RELEASE_SUFFIX}" \ + --build-arg REBUILD="${REBUILD}" \ + "${whereami}" + +sudo docker run --privileged -v "${DATA_DIR}":/data "${repo_and_tag}" diff --git a/ci/acceptance-test/illustrations/drawing.svg b/ci/acceptance-test/illustrations/drawing.svg new file mode 100644 index 00000000..2634d27e --- /dev/null +++ b/ci/acceptance-test/illustrations/drawing.svg @@ -0,0 +1,275 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Host (bare metal) + + + + + + + + Docker container + + + + + + + + openvdc-cli + + + + + + + + openvdc-acceptance-test + + + + + + + + kvm + + + + + + + + vdc_env_br010.0.100.1 + + + + + + + + openvdc-executor-lxc + + + + + + 10.0.100.14 + + + + + + + + kvm + + + + + + + + openvdc-executor-null + + + + + + 10.0.100.13 + + + + + + + + kvm + + + + + + + + mesos-master + + + + + + 10.0.100.11 + + + + + + + + kvm + + + + + + + + zookeeper + + + + + + 10.0.100.10 + + + + + + + + kvm + + + + + + + + openvdc-scheduler + + + + + + 10.0.100.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ci/multibox/10.0.100.10-zookeeper/build.sh b/ci/acceptance-test/multibox/10.0.100.10-zookeeper/build.sh similarity index 100% rename from ci/multibox/10.0.100.10-zookeeper/build.sh rename to ci/acceptance-test/multibox/10.0.100.10-zookeeper/build.sh diff --git a/ci/multibox/10.0.100.10-zookeeper/destroy.sh b/ci/acceptance-test/multibox/10.0.100.10-zookeeper/destroy.sh similarity index 100% rename from ci/multibox/10.0.100.10-zookeeper/destroy.sh rename to ci/acceptance-test/multibox/10.0.100.10-zookeeper/destroy.sh diff --git a/ci/multibox/10.0.100.10-zookeeper/destroy_cache.sh b/ci/acceptance-test/multibox/10.0.100.10-zookeeper/destroy_cache.sh similarity index 100% rename from ci/multibox/10.0.100.10-zookeeper/destroy_cache.sh rename to ci/acceptance-test/multibox/10.0.100.10-zookeeper/destroy_cache.sh diff --git a/ci/multibox/10.0.100.10-zookeeper/guestroot/etc/sysconfig/network b/ci/acceptance-test/multibox/10.0.100.10-zookeeper/guestroot/etc/sysconfig/network similarity index 100% rename from ci/multibox/10.0.100.10-zookeeper/guestroot/etc/sysconfig/network rename to ci/acceptance-test/multibox/10.0.100.10-zookeeper/guestroot/etc/sysconfig/network diff --git a/ci/multibox/10.0.100.10-zookeeper/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 b/ci/acceptance-test/multibox/10.0.100.10-zookeeper/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 similarity index 100% rename from ci/multibox/10.0.100.10-zookeeper/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 rename to ci/acceptance-test/multibox/10.0.100.10-zookeeper/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 diff --git a/ci/multibox/10.0.100.10-zookeeper/login.sh b/ci/acceptance-test/multibox/10.0.100.10-zookeeper/login.sh similarity index 100% rename from ci/multibox/10.0.100.10-zookeeper/login.sh rename to ci/acceptance-test/multibox/10.0.100.10-zookeeper/login.sh diff --git a/ci/multibox/10.0.100.10-zookeeper/vmspec.conf b/ci/acceptance-test/multibox/10.0.100.10-zookeeper/vmspec.conf similarity index 100% rename from ci/multibox/10.0.100.10-zookeeper/vmspec.conf rename to ci/acceptance-test/multibox/10.0.100.10-zookeeper/vmspec.conf diff --git a/ci/multibox/10.0.100.11-mesos-master/build.sh b/ci/acceptance-test/multibox/10.0.100.11-mesos-master/build.sh similarity index 100% rename from ci/multibox/10.0.100.11-mesos-master/build.sh rename to ci/acceptance-test/multibox/10.0.100.11-mesos-master/build.sh diff --git a/ci/multibox/10.0.100.11-mesos-master/destroy.sh b/ci/acceptance-test/multibox/10.0.100.11-mesos-master/destroy.sh similarity index 100% rename from ci/multibox/10.0.100.11-mesos-master/destroy.sh rename to ci/acceptance-test/multibox/10.0.100.11-mesos-master/destroy.sh diff --git a/ci/multibox/10.0.100.11-mesos-master/destroy_cache.sh b/ci/acceptance-test/multibox/10.0.100.11-mesos-master/destroy_cache.sh similarity index 100% rename from ci/multibox/10.0.100.11-mesos-master/destroy_cache.sh rename to ci/acceptance-test/multibox/10.0.100.11-mesos-master/destroy_cache.sh diff --git a/ci/multibox/10.0.100.11-mesos-master/guestroot/etc/default/mesos b/ci/acceptance-test/multibox/10.0.100.11-mesos-master/guestroot/etc/default/mesos similarity index 100% rename from ci/multibox/10.0.100.11-mesos-master/guestroot/etc/default/mesos rename to ci/acceptance-test/multibox/10.0.100.11-mesos-master/guestroot/etc/default/mesos diff --git a/ci/multibox/10.0.100.11-mesos-master/guestroot/etc/default/mesos-master b/ci/acceptance-test/multibox/10.0.100.11-mesos-master/guestroot/etc/default/mesos-master similarity index 100% rename from ci/multibox/10.0.100.11-mesos-master/guestroot/etc/default/mesos-master rename to ci/acceptance-test/multibox/10.0.100.11-mesos-master/guestroot/etc/default/mesos-master diff --git a/ci/multibox/10.0.100.11-mesos-master/guestroot/etc/mesos/zk b/ci/acceptance-test/multibox/10.0.100.11-mesos-master/guestroot/etc/mesos/zk similarity index 100% rename from ci/multibox/10.0.100.11-mesos-master/guestroot/etc/mesos/zk rename to ci/acceptance-test/multibox/10.0.100.11-mesos-master/guestroot/etc/mesos/zk diff --git a/ci/multibox/10.0.100.11-mesos-master/guestroot/etc/sysconfig/network b/ci/acceptance-test/multibox/10.0.100.11-mesos-master/guestroot/etc/sysconfig/network similarity index 100% rename from ci/multibox/10.0.100.11-mesos-master/guestroot/etc/sysconfig/network rename to ci/acceptance-test/multibox/10.0.100.11-mesos-master/guestroot/etc/sysconfig/network diff --git a/ci/multibox/10.0.100.11-mesos-master/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 b/ci/acceptance-test/multibox/10.0.100.11-mesos-master/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 similarity index 100% rename from ci/multibox/10.0.100.11-mesos-master/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 rename to ci/acceptance-test/multibox/10.0.100.11-mesos-master/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 diff --git a/ci/multibox/10.0.100.11-mesos-master/login.sh b/ci/acceptance-test/multibox/10.0.100.11-mesos-master/login.sh similarity index 100% rename from ci/multibox/10.0.100.11-mesos-master/login.sh rename to ci/acceptance-test/multibox/10.0.100.11-mesos-master/login.sh diff --git a/ci/multibox/10.0.100.11-mesos-master/vmspec.conf b/ci/acceptance-test/multibox/10.0.100.11-mesos-master/vmspec.conf similarity index 100% rename from ci/multibox/10.0.100.11-mesos-master/vmspec.conf rename to ci/acceptance-test/multibox/10.0.100.11-mesos-master/vmspec.conf diff --git a/ci/multibox/10.0.100.12-vdc-scheduler/build.sh b/ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/build.sh similarity index 100% rename from ci/multibox/10.0.100.12-vdc-scheduler/build.sh rename to ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/build.sh diff --git a/ci/multibox/10.0.100.12-vdc-scheduler/destroy.sh b/ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/destroy.sh similarity index 100% rename from ci/multibox/10.0.100.12-vdc-scheduler/destroy.sh rename to ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/destroy.sh diff --git a/ci/multibox/10.0.100.12-vdc-scheduler/destroy_cache.sh b/ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/destroy_cache.sh similarity index 100% rename from ci/multibox/10.0.100.12-vdc-scheduler/destroy_cache.sh rename to ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/destroy_cache.sh diff --git a/ci/multibox/10.0.100.12-vdc-scheduler/guestroot/etc/sysconfig/network b/ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/guestroot/etc/sysconfig/network similarity index 100% rename from ci/multibox/10.0.100.12-vdc-scheduler/guestroot/etc/sysconfig/network rename to ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/guestroot/etc/sysconfig/network diff --git a/ci/multibox/10.0.100.12-vdc-scheduler/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 b/ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 similarity index 100% rename from ci/multibox/10.0.100.12-vdc-scheduler/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 rename to ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 diff --git a/ci/multibox/10.0.100.12-vdc-scheduler/login.sh b/ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/login.sh similarity index 100% rename from ci/multibox/10.0.100.12-vdc-scheduler/login.sh rename to ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/login.sh diff --git a/ci/multibox/10.0.100.12-vdc-scheduler/vmspec.conf b/ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/vmspec.conf similarity index 100% rename from ci/multibox/10.0.100.12-vdc-scheduler/vmspec.conf rename to ci/acceptance-test/multibox/10.0.100.12-vdc-scheduler/vmspec.conf diff --git a/ci/multibox/10.0.100.14-vdc-executor-lxc/build.sh b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/build.sh similarity index 96% rename from ci/multibox/10.0.100.14-vdc-executor-lxc/build.sh rename to ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/build.sh index beb00e01..327cba3f 100755 --- a/ci/multibox/10.0.100.14-vdc-executor-lxc/build.sh +++ b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/build.sh @@ -22,8 +22,6 @@ IND_STEPS=( build "${IND_STEPS[@]}" -install_openvdc_yum_repo - # This is not part of the ind-steps because we don't want OpenVDC installed in # the cached images. We want a clean cache without OpenVDC so we can install a # different version to test every the CI runs. diff --git a/ci/multibox/10.0.100.13-vdc-executor-null/destroy.sh b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/destroy.sh similarity index 100% rename from ci/multibox/10.0.100.13-vdc-executor-null/destroy.sh rename to ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/destroy.sh diff --git a/ci/multibox/10.0.100.13-vdc-executor-null/destroy_cache.sh b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/destroy_cache.sh similarity index 100% rename from ci/multibox/10.0.100.13-vdc-executor-null/destroy_cache.sh rename to ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/destroy_cache.sh diff --git a/ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/default/mesos b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/default/mesos similarity index 100% rename from ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/default/mesos rename to ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/default/mesos diff --git a/ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/default/mesos-slave b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/default/mesos-slave similarity index 100% rename from ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/default/mesos-slave rename to ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/default/mesos-slave diff --git a/ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/mesos-slave/attributes b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/mesos-slave/attributes similarity index 100% rename from ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/mesos-slave/attributes rename to ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/mesos-slave/attributes diff --git a/ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/mesos-slave/executor_environment_variables b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/mesos-slave/executor_environment_variables similarity index 100% rename from ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/mesos-slave/executor_environment_variables rename to ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/mesos-slave/executor_environment_variables diff --git a/ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/mesos/zk b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/mesos/zk similarity index 100% rename from ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/mesos/zk rename to ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/mesos/zk diff --git a/ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/sysconfig/network b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/sysconfig/network similarity index 100% rename from ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/sysconfig/network rename to ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/sysconfig/network diff --git a/ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 similarity index 100% rename from ci/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 rename to ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 diff --git a/ci/multibox/10.0.100.13-vdc-executor-null/login.sh b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/login.sh similarity index 100% rename from ci/multibox/10.0.100.13-vdc-executor-null/login.sh rename to ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/login.sh diff --git a/ci/multibox/10.0.100.13-vdc-executor-null/vmspec.conf b/ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/vmspec.conf similarity index 100% rename from ci/multibox/10.0.100.13-vdc-executor-null/vmspec.conf rename to ci/acceptance-test/multibox/10.0.100.13-vdc-executor-null/vmspec.conf diff --git a/ci/multibox/10.0.100.13-vdc-executor-null/build.sh b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/build.sh similarity index 71% rename from ci/multibox/10.0.100.13-vdc-executor-null/build.sh rename to ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/build.sh index e6fb8b4f..327cba3f 100755 --- a/ci/multibox/10.0.100.13-vdc-executor-null/build.sh +++ b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/build.sh @@ -22,14 +22,8 @@ IND_STEPS=( build "${IND_STEPS[@]}" -install_openvdc_yum_repo - # This is not part of the ind-steps because we don't want OpenVDC installed in # the cached images. We want a clean cache without OpenVDC so we can install a # different version to test every the CI runs. -# -# The CLI could be installed in any node but let's do it here. This is the best -# place because we want to make sure everything works with other addresses than -# 127.0.0.1 install_openvdc_yum_repo -install_yum_package_over_ssh "openvdc-executor openvdc-cli" +install_yum_package_over_ssh "openvdc-executor" diff --git a/ci/multibox/10.0.100.14-vdc-executor-lxc/destroy.sh b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/destroy.sh similarity index 100% rename from ci/multibox/10.0.100.14-vdc-executor-lxc/destroy.sh rename to ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/destroy.sh diff --git a/ci/multibox/10.0.100.14-vdc-executor-lxc/destroy_cache.sh b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/destroy_cache.sh similarity index 100% rename from ci/multibox/10.0.100.14-vdc-executor-lxc/destroy_cache.sh rename to ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/destroy_cache.sh diff --git a/ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/default/mesos b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/default/mesos similarity index 100% rename from ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/default/mesos rename to ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/default/mesos diff --git a/ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/default/mesos-slave b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/default/mesos-slave similarity index 100% rename from ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/default/mesos-slave rename to ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/default/mesos-slave diff --git a/ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/mesos-slave/attributes b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/mesos-slave/attributes similarity index 100% rename from ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/mesos-slave/attributes rename to ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/mesos-slave/attributes diff --git a/ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/mesos-slave/executor_environment_variables b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/mesos-slave/executor_environment_variables similarity index 100% rename from ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/mesos-slave/executor_environment_variables rename to ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/mesos-slave/executor_environment_variables diff --git a/ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/mesos/zk b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/mesos/zk similarity index 100% rename from ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/mesos/zk rename to ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/mesos/zk diff --git a/ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/sysconfig/network b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/sysconfig/network similarity index 100% rename from ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/sysconfig/network rename to ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/sysconfig/network diff --git a/ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 similarity index 100% rename from ci/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 rename to ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/guestroot/etc/sysconfig/network-scripts/ifcfg-eth0 diff --git a/ci/multibox/10.0.100.14-vdc-executor-lxc/login.sh b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/login.sh similarity index 100% rename from ci/multibox/10.0.100.14-vdc-executor-lxc/login.sh rename to ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/login.sh diff --git a/ci/multibox/10.0.100.14-vdc-executor-lxc/vmspec.conf b/ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/vmspec.conf similarity index 100% rename from ci/multibox/10.0.100.14-vdc-executor-lxc/vmspec.conf rename to ci/acceptance-test/multibox/10.0.100.14-vdc-executor-lxc/vmspec.conf diff --git a/ci/multibox/build.sh b/ci/acceptance-test/multibox/build.sh similarity index 92% rename from ci/multibox/build.sh rename to ci/acceptance-test/multibox/build.sh index ecc85a1f..cdef9bb5 100755 --- a/ci/multibox/build.sh +++ b/ci/acceptance-test/multibox/build.sh @@ -8,13 +8,13 @@ export ENV_ROOTDIR="$(cd "$(dirname $(readlink -f "$0"))" && pwd -P)" . "${ENV_ROOTDIR}/config.source" # Jenkins writes its environment variables to a build.env file in OpenVDC root -if [[ -f "${ENV_ROOTDIR}/../../build.env" ]]; then - . "${ENV_ROOTDIR}/../../build.env" -fi +#if [[ -f "${ENV_ROOTDIR}/../../build.env" ]]; then +# . "${ENV_ROOTDIR}/../../build.env" +#fi require_branch_variable require_rebuild_variable -#TODO: require release suffix +require_release_suffix YUM_REPO_URL="https://ci.openvdc.org/repos/${BRANCH}/${RELEASE_SUFFIX}/" curl -fs --head "${YUM_REPO_URL}" > /dev/null @@ -37,6 +37,9 @@ check_dep "rsync" check_dep "brctl" check_dep "qemu-system-x86_64" check_dep "parted" # For mount-partition.sh +check_dep "sudo" +check_dep "ssh" +check_dep "nc" ( $starting_step "Enable IP forwarding" diff --git a/ci/multibox/build_map_clone.md b/ci/acceptance-test/multibox/build_map_clone.md similarity index 100% rename from ci/multibox/build_map_clone.md rename to ci/acceptance-test/multibox/build_map_clone.md diff --git a/ci/multibox/build_map_rebuild.md b/ci/acceptance-test/multibox/build_map_rebuild.md similarity index 100% rename from ci/multibox/build_map_rebuild.md rename to ci/acceptance-test/multibox/build_map_rebuild.md diff --git a/ci/multibox/config.source b/ci/acceptance-test/multibox/config.source similarity index 83% rename from ci/multibox/config.source rename to ci/acceptance-test/multibox/config.source index 54536826..94fdf1ee 100644 --- a/ci/multibox/config.source +++ b/ci/acceptance-test/multibox/config.source @@ -16,5 +16,5 @@ BOXES=( "minimal-7.2.1511-x86_64.kvm.box" ) -BOXES_DIR="/data2/openvdc-ci/boxes" -CACHE_DIR="/data2/openvdc-ci/branches" +BOXES_DIR="/data/openvdc-ci/boxes" +CACHE_DIR="/data/openvdc-ci/branches" diff --git a/ci/multibox/destroy_leaving_cache.sh b/ci/acceptance-test/multibox/destroy_leaving_cache.sh similarity index 100% rename from ci/multibox/destroy_leaving_cache.sh rename to ci/acceptance-test/multibox/destroy_leaving_cache.sh diff --git a/ci/multibox/destroy_with_cache.sh b/ci/acceptance-test/multibox/destroy_with_cache.sh similarity index 100% rename from ci/multibox/destroy_with_cache.sh rename to ci/acceptance-test/multibox/destroy_with_cache.sh diff --git a/ci/multibox/external_libraries/README.md b/ci/acceptance-test/multibox/external_libraries/README.md similarity index 100% rename from ci/multibox/external_libraries/README.md rename to ci/acceptance-test/multibox/external_libraries/README.md diff --git a/ci/multibox/external_libraries/bashsteps/README.md b/ci/acceptance-test/multibox/external_libraries/bashsteps/README.md similarity index 100% rename from ci/multibox/external_libraries/bashsteps/README.md rename to ci/acceptance-test/multibox/external_libraries/bashsteps/README.md diff --git a/ci/multibox/external_libraries/bashsteps/bashctrl.sh b/ci/acceptance-test/multibox/external_libraries/bashsteps/bashctrl.sh similarity index 100% rename from ci/multibox/external_libraries/bashsteps/bashctrl.sh rename to ci/acceptance-test/multibox/external_libraries/bashsteps/bashctrl.sh diff --git a/ci/multibox/external_libraries/bashsteps/doc/intro-to-core.md b/ci/acceptance-test/multibox/external_libraries/bashsteps/doc/intro-to-core.md similarity index 100% rename from ci/multibox/external_libraries/bashsteps/doc/intro-to-core.md rename to ci/acceptance-test/multibox/external_libraries/bashsteps/doc/intro-to-core.md diff --git a/ci/multibox/external_libraries/bashsteps/examples/new/new-duped-substep.sh b/ci/acceptance-test/multibox/external_libraries/bashsteps/examples/new/new-duped-substep.sh similarity index 100% rename from ci/multibox/external_libraries/bashsteps/examples/new/new-duped-substep.sh rename to ci/acceptance-test/multibox/external_libraries/bashsteps/examples/new/new-duped-substep.sh diff --git a/ci/multibox/external_libraries/bashsteps/examples/new/simple-defaults-for-bashsteps.source b/ci/acceptance-test/multibox/external_libraries/bashsteps/examples/new/simple-defaults-for-bashsteps.source similarity index 100% rename from ci/multibox/external_libraries/bashsteps/examples/new/simple-defaults-for-bashsteps.source rename to ci/acceptance-test/multibox/external_libraries/bashsteps/examples/new/simple-defaults-for-bashsteps.source diff --git a/ci/multibox/external_libraries/bashsteps/examples/new/with-temporary-state.sh b/ci/acceptance-test/multibox/external_libraries/bashsteps/examples/new/with-temporary-state.sh similarity index 100% rename from ci/multibox/external_libraries/bashsteps/examples/new/with-temporary-state.sh rename to ci/acceptance-test/multibox/external_libraries/bashsteps/examples/new/with-temporary-state.sh diff --git a/ci/multibox/external_libraries/bashsteps/examples/old/duped-substep.sh b/ci/acceptance-test/multibox/external_libraries/bashsteps/examples/old/duped-substep.sh similarity index 100% rename from ci/multibox/external_libraries/bashsteps/examples/old/duped-substep.sh rename to ci/acceptance-test/multibox/external_libraries/bashsteps/examples/old/duped-substep.sh diff --git a/ci/multibox/external_libraries/bashsteps/examples/old/simple-defaults-for-bashsteps.source b/ci/acceptance-test/multibox/external_libraries/bashsteps/examples/old/simple-defaults-for-bashsteps.source similarity index 100% rename from ci/multibox/external_libraries/bashsteps/examples/old/simple-defaults-for-bashsteps.source rename to ci/acceptance-test/multibox/external_libraries/bashsteps/examples/old/simple-defaults-for-bashsteps.source diff --git a/ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/kvm-setup.sh b/ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/kvm-setup.sh similarity index 100% rename from ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/kvm-setup.sh rename to ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/kvm-setup.sh diff --git a/ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/monitor-process.sh b/ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/monitor-process.sh similarity index 100% rename from ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/monitor-process.sh rename to ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/monitor-process.sh diff --git a/ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/simple-defaults-for-bashsteps.source b/ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/simple-defaults-for-bashsteps.source similarity index 100% rename from ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/simple-defaults-for-bashsteps.source rename to ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/simple-defaults-for-bashsteps.source diff --git a/ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/kvm-boot.sh b/ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/kvm-boot.sh similarity index 100% rename from ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/kvm-boot.sh rename to ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/kvm-boot.sh diff --git a/ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/kvm-kill.sh b/ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/kvm-kill.sh similarity index 100% rename from ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/kvm-kill.sh rename to ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/kvm-kill.sh diff --git a/ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/kvm-shutdown-via-ssh.sh b/ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/kvm-shutdown-via-ssh.sh similarity index 100% rename from ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/kvm-shutdown-via-ssh.sh rename to ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/kvm-shutdown-via-ssh.sh diff --git a/ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/ssh-to-kvm.sh b/ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/ssh-to-kvm.sh similarity index 100% rename from ci/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/ssh-to-kvm.sh rename to ci/acceptance-test/multibox/external_libraries/bashsteps/ind-steps/kvmsteps/vmdir-scripts/ssh-to-kvm.sh diff --git a/ci/multibox/external_libraries/bashsteps/simple-defaults-for-bashsteps.source b/ci/acceptance-test/multibox/external_libraries/bashsteps/simple-defaults-for-bashsteps.source similarity index 100% rename from ci/multibox/external_libraries/bashsteps/simple-defaults-for-bashsteps.source rename to ci/acceptance-test/multibox/external_libraries/bashsteps/simple-defaults-for-bashsteps.source diff --git a/ci/multibox/external_libraries/mount-partition/mount-partition.sh b/ci/acceptance-test/multibox/external_libraries/mount-partition/mount-partition.sh similarity index 100% rename from ci/multibox/external_libraries/mount-partition/mount-partition.sh rename to ci/acceptance-test/multibox/external_libraries/mount-partition/mount-partition.sh diff --git a/ci/multibox/ind-steps/common.source b/ci/acceptance-test/multibox/ind-steps/common.source similarity index 95% rename from ci/multibox/ind-steps/common.source rename to ci/acceptance-test/multibox/ind-steps/common.source index 382b0339..d16d6de3 100644 --- a/ci/multibox/ind-steps/common.source +++ b/ci/acceptance-test/multibox/ind-steps/common.source @@ -151,6 +151,13 @@ function require_rebuild_variable() { fi } +function require_release_suffix { + if [[ -z "${RELEASE_SUFFIX}" ]] ; then + echo "the RELEASE_SUFFIX variable needs to be set with the release suffix in the yum repo we're testing. Usually looks similar to: '20170111063228git2d0dc08'." + exit 1 + fi +} + function install_openvdc_yum_repo() { ( $starting_step "Install OpenVDC yum repository" diff --git a/ci/multibox/ind-steps/step-box/boot.sh b/ci/acceptance-test/multibox/ind-steps/step-box/boot.sh similarity index 100% rename from ci/multibox/ind-steps/step-box/boot.sh rename to ci/acceptance-test/multibox/ind-steps/step-box/boot.sh diff --git a/ci/multibox/ind-steps/step-box/common.source b/ci/acceptance-test/multibox/ind-steps/step-box/common.source similarity index 100% rename from ci/multibox/ind-steps/step-box/common.source rename to ci/acceptance-test/multibox/ind-steps/step-box/common.source diff --git a/ci/multibox/ind-steps/step-box/init.sh b/ci/acceptance-test/multibox/ind-steps/step-box/init.sh similarity index 100% rename from ci/multibox/ind-steps/step-box/init.sh rename to ci/acceptance-test/multibox/ind-steps/step-box/init.sh diff --git a/ci/multibox/ind-steps/step-box/postconfigure.sh b/ci/acceptance-test/multibox/ind-steps/step-box/postconfigure.sh similarity index 100% rename from ci/multibox/ind-steps/step-box/postconfigure.sh rename to ci/acceptance-test/multibox/ind-steps/step-box/postconfigure.sh diff --git a/ci/multibox/ind-steps/step-epel/install.sh b/ci/acceptance-test/multibox/ind-steps/step-epel/install.sh similarity index 100% rename from ci/multibox/ind-steps/step-epel/install.sh rename to ci/acceptance-test/multibox/ind-steps/step-epel/install.sh diff --git a/ci/multibox/ind-steps/step-lxc/install.sh b/ci/acceptance-test/multibox/ind-steps/step-lxc/install.sh similarity index 100% rename from ci/multibox/ind-steps/step-lxc/install.sh rename to ci/acceptance-test/multibox/ind-steps/step-lxc/install.sh diff --git a/ci/multibox/ind-steps/step-lxc/postconfigure.sh b/ci/acceptance-test/multibox/ind-steps/step-lxc/postconfigure.sh similarity index 100% rename from ci/multibox/ind-steps/step-lxc/postconfigure.sh rename to ci/acceptance-test/multibox/ind-steps/step-lxc/postconfigure.sh diff --git a/ci/multibox/ind-steps/step-mesos/common.source b/ci/acceptance-test/multibox/ind-steps/step-mesos/common.source similarity index 100% rename from ci/multibox/ind-steps/step-mesos/common.source rename to ci/acceptance-test/multibox/ind-steps/step-mesos/common.source diff --git a/ci/multibox/ind-steps/step-mesos/install.sh b/ci/acceptance-test/multibox/ind-steps/step-mesos/install.sh similarity index 100% rename from ci/multibox/ind-steps/step-mesos/install.sh rename to ci/acceptance-test/multibox/ind-steps/step-mesos/install.sh diff --git a/ci/multibox/ind-steps/step-mesos/postconfigure.sh b/ci/acceptance-test/multibox/ind-steps/step-mesos/postconfigure.sh similarity index 100% rename from ci/multibox/ind-steps/step-mesos/postconfigure.sh rename to ci/acceptance-test/multibox/ind-steps/step-mesos/postconfigure.sh diff --git a/ci/multibox/ind-steps/step-mesosphere/init.sh b/ci/acceptance-test/multibox/ind-steps/step-mesosphere/init.sh similarity index 100% rename from ci/multibox/ind-steps/step-mesosphere/init.sh rename to ci/acceptance-test/multibox/ind-steps/step-mesosphere/init.sh diff --git a/ci/multibox/ind-steps/step-ssh/boot.sh b/ci/acceptance-test/multibox/ind-steps/step-ssh/boot.sh similarity index 100% rename from ci/multibox/ind-steps/step-ssh/boot.sh rename to ci/acceptance-test/multibox/ind-steps/step-ssh/boot.sh diff --git a/ci/multibox/ind-steps/step-ssh/common.source b/ci/acceptance-test/multibox/ind-steps/step-ssh/common.source similarity index 100% rename from ci/multibox/ind-steps/step-ssh/common.source rename to ci/acceptance-test/multibox/ind-steps/step-ssh/common.source diff --git a/ci/multibox/ind-steps/step-ssh/install.sh b/ci/acceptance-test/multibox/ind-steps/step-ssh/install.sh similarity index 100% rename from ci/multibox/ind-steps/step-ssh/install.sh rename to ci/acceptance-test/multibox/ind-steps/step-ssh/install.sh diff --git a/ci/multibox/ind-steps/step-zookeeper/common.source b/ci/acceptance-test/multibox/ind-steps/step-zookeeper/common.source similarity index 100% rename from ci/multibox/ind-steps/step-zookeeper/common.source rename to ci/acceptance-test/multibox/ind-steps/step-zookeeper/common.source diff --git a/ci/multibox/ind-steps/step-zookeeper/install.sh b/ci/acceptance-test/multibox/ind-steps/step-zookeeper/install.sh similarity index 100% rename from ci/multibox/ind-steps/step-zookeeper/install.sh rename to ci/acceptance-test/multibox/ind-steps/step-zookeeper/install.sh diff --git a/ci/multibox/ind-steps/step-zookeeper/postconfigure.sh b/ci/acceptance-test/multibox/ind-steps/step-zookeeper/postconfigure.sh similarity index 100% rename from ci/multibox/ind-steps/step-zookeeper/postconfigure.sh rename to ci/acceptance-test/multibox/ind-steps/step-zookeeper/postconfigure.sh diff --git a/ci/multibox/login.sh b/ci/acceptance-test/multibox/login.sh similarity index 100% rename from ci/multibox/login.sh rename to ci/acceptance-test/multibox/login.sh diff --git a/ci/acceptance-test/run_tests.sh b/ci/acceptance-test/run_tests.sh new file mode 100755 index 00000000..9cc71813 --- /dev/null +++ b/ci/acceptance-test/run_tests.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +if [[ "$1" != "RUN" ]]; then + echo "This script is designed to be run inside of the Docker container provided"\ + "by the Dockerfile in this directory. You most probably don't want to be running"\ + "this manually. Use the 'build_and_run_in_docker.sh' script instead." + + exit 1 +fi + +set -xe + +cat | sudo tee /etc/yum.repos.d/openvdc.repo << EOS +[openvdc] +name=OpenVDC +failovermethod=priority +baseurl=https://ci.openvdc.org/repos/${BRANCH}/${RELEASE_SUFFIX} +enabled=1 +gpgcheck=0 +EOS + +sudo yum install -y openvdc-acceptance-test + +/multibox/build.sh + +# Run the actual tests as axsh user. Root should never be required to run the openvdc command +su axsh -c "/opt/axsh/openvdc/bin/openvdc-acceptance-test -test.v" diff --git a/ci/acceptance-test/tests/01_cmd_in_path_test.go b/ci/acceptance-test/tests/01_cmd_in_path_test.go new file mode 100644 index 00000000..01fecb54 --- /dev/null +++ b/ci/acceptance-test/tests/01_cmd_in_path_test.go @@ -0,0 +1,26 @@ +// +build acceptance + +package tests + +import ( + "bytes" + "os/exec" + "strings" + "testing" +) + +func TestOpenVDCCmdInPath(t *testing.T) { + var out bytes.Buffer + + cmd := exec.Command("openvdc") + cmd.Stdout = &out + + err := cmd.Run() + if err != nil { + t.Fatal("Unable to run openvdc command: " + err.Error()) + } + + if !strings.HasPrefix(out.String(), "Usage:") { + t.Fatal("Running openvdc without arguments didn't print usage. Instead got: " + out.String()) + } +} diff --git a/ci/tests/README.md b/ci/acceptance-test/tests/README.md similarity index 79% rename from ci/tests/README.md rename to ci/acceptance-test/tests/README.md index db669bcb..88fffa5e 100644 --- a/ci/tests/README.md +++ b/ci/acceptance-test/tests/README.md @@ -1,8 +1,8 @@ -Running acceptance/CI tests under ``ci/tests``: +Running acceptance/CI tests under ``ci/acceptance-test/tests``: ``` -cd ci/tests +cd ci/acceptance-test/tests go test -tags=acceptance ./... ``` diff --git a/ci/multibox/ind-steps/step-openvdc/common.source b/ci/multibox/ind-steps/step-openvdc/common.source deleted file mode 100644 index 398cb72a..00000000 --- a/ci/multibox/ind-steps/step-openvdc/common.source +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -scheduler=${scheduler:-false} -mesos_master="${mesos_master:-10.0.100.11}" -zk="${zk:-10.0.100.10}" diff --git a/ci/multibox/ind-steps/step-openvdc/init.sh b/ci/multibox/ind-steps/step-openvdc/init.sh deleted file mode 100644 index 05ea86f2..00000000 --- a/ci/multibox/ind-steps/step-openvdc/init.sh +++ /dev/null @@ -1,17 +0,0 @@ - -( - $starting_step "Prepare openvdc repo" - [[ -f "${TMP_ROOT}/etc/yum.repos.d/openvdc.repo" ]] - $skip_step__if_already_done ; set -ex - sudo chroot ${TMP_ROOT} /bin/bash -e <> /etc/yum.repos.d/openvdc.repo -[openvdc] -name=OpenVDc Repo - devrepo -baseurl=http://ci.openvdc.org/repos/${REVISION}/ -enabled=1 -gpgcheck=0 -EOF -EOS -) ; prev_cmd_failed - - diff --git a/ci/multibox/ind-steps/step-openvdc/install.sh b/ci/multibox/ind-steps/step-openvdc/install.sh deleted file mode 100644 index 9c39dc37..00000000 --- a/ci/multibox/ind-steps/step-openvdc/install.sh +++ /dev/null @@ -1,6 +0,0 @@ -( - $starting_step "Install openvdc on ${vm_name}" - [[ -f "${TMP_ROOT}/opt/axsh/openvdc/bin/openvdc" ]] - $skip_step_if_already_done; set -ex - sudo chroot ${TMP_ROOT} /bin/bash -c "yum install -y openvdc" -) ; prev_cmd_failed diff --git a/ci/multibox/ind-steps/step-openvdc/postconfigure.sh b/ci/multibox/ind-steps/step-openvdc/postconfigure.sh deleted file mode 100644 index 15cd5366..00000000 --- a/ci/multibox/ind-steps/step-openvdc/postconfigure.sh +++ /dev/null @@ -1,3 +0,0 @@ -$one_box || { - disable_service "zookeeper" -} diff --git a/ci/multibox/ind-steps/step-openvdc/provide.sh b/ci/multibox/ind-steps/step-openvdc/provide.sh deleted file mode 100644 index 88a8c542..00000000 --- a/ci/multibox/ind-steps/step-openvdc/provide.sh +++ /dev/null @@ -1,9 +0,0 @@ - -$scheduler && { - ( - $starting_step "Starting scheduler on ${vm_name}" - ssh root@${IP_ADDR} "systemctl status openvdc-scheduler | grep -q running" - $skip_step_if_already_done ; set -ex - ssh root@${IP_ADDR} "systemctl start openvdc-scheduler" - ) ; prev_cmd_failed -} diff --git a/ci/tests/acceptance1_test.go b/ci/tests/acceptance1_test.go deleted file mode 100644 index 224ad60f..00000000 --- a/ci/tests/acceptance1_test.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build acceptance - -package tests - -import "testing" - -func TestScenario1(t *testing.T) { - t.Log("TestScenario1") -} diff --git a/pkg/rhel/openvdc.spec b/pkg/rhel/openvdc.spec index 189e5e46..a63e32e0 100644 --- a/pkg/rhel/openvdc.spec +++ b/pkg/rhel/openvdc.spec @@ -28,7 +28,7 @@ Requires: openvdc-scheduler #Suggests: mesosphere-zookeeper mesos %description -This is an empty metapackage that depends on all OpenVNet services and the vnctl client. Just a conventient way to install everything at once on a single machine. +An empty metapackage that depends on all OpenVDC services. Just a conventient way to install everything at once on a single machine. %files # Metapackage, so no files! @@ -41,33 +41,39 @@ cd "${GOPATH}/src/github.com/axsh/openvdc" ( VERSION=%{version} ./build.sh ) +cd "${GOPATH}/src/github.com/axsh/openvdc/ci/acceptance-test/tests" +go test -tags=acceptance -c -o openvdc-acceptance-test %install cd "${GOPATH}/src/github.com/axsh/openvdc" mkdir -p "$RPM_BUILD_ROOT"/opt/axsh/openvdc/bin mkdir -p "$RPM_BUILD_ROOT"%{_unitdir} +mkdir -p "$RPM_BUILD_ROOT"/usr/bin +ln -sf /opt/axsh/openvdc/bin/openvdc "$RPM_BUILD_ROOT"/usr/bin cp openvdc "$RPM_BUILD_ROOT"/opt/axsh/openvdc/bin cp openvdc-executor "$RPM_BUILD_ROOT"/opt/axsh/openvdc/bin cp openvdc-scheduler "$RPM_BUILD_ROOT"/opt/axsh/openvdc/bin +cp ci/acceptance-test/tests/openvdc-acceptance-test "$RPM_BUILD_ROOT"/opt/axsh/openvdc/bin cp pkg/rhel/openvdc-scheduler.service "$RPM_BUILD_ROOT"%{_unitdir} mkdir -p "$RPM_BUILD_ROOT"/etc/sysconfig cp pkg/rhel/sysconfig-openvdc "$RPM_BUILD_ROOT"/etc/sysconfig/openvdc %package cli -Summary: openvdc cli +Summary: OpenVDC cli %description cli -This is an empty message to fulfill the requirement that this file has a "%description" header. +The OpenVDC commandline interface. %files cli %dir /opt/axsh/openvdc %dir /opt/axsh/openvdc/bin +/usr/bin/openvdc /opt/axsh/openvdc/bin/openvdc %config(noreplace) /etc/sysconfig/openvdc %package executor -Summary: openvdc executor +Summary: OpenVDC executor Requires: lxc %description executor @@ -79,8 +85,7 @@ This is a 'stub'. An appropriate message must be substituted at some point. /opt/axsh/openvdc/bin/openvdc-executor %package scheduler -Summary: openvdc scheduler - +Summary: OpenVDC scheduler %description scheduler This is a 'stub'. An appropriate message must be substituted at some point. @@ -100,3 +105,15 @@ This is a 'stub'. An appropriate message must be substituted at some point. %preun %{systemd_preun openvdc-scheduler.service} + +%package acceptance-test +Summary: The OpenVDC acceptance test used in its CI process. +Requires: openvdc-cli + +%description acceptance-test +An acceptance test designed to run on a specifically designed environment. The environment building scripts can be found in the OpenVDC source code repository. The average OpenVDC user will not need to install this. + +%files acceptance-test +%dir /opt/axsh/openvdc +%dir /opt/axsh/openvdc/bin +/opt/axsh/openvdc/bin/openvdc-acceptance-test