Repository: aurora-packaging Updated Branches: refs/heads/master 2b19410bf -> b904b5f1c
Add basic test scripts for RPM and DEB packages This reduces some of the manual effort for verifying the binary packages. Testing Done: See the distribution specific README.md. Reviewed at https://reviews.apache.org/r/56577/ Project: http://git-wip-us.apache.org/repos/asf/aurora-packaging/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora-packaging/commit/b904b5f1 Tree: http://git-wip-us.apache.org/repos/asf/aurora-packaging/tree/b904b5f1 Diff: http://git-wip-us.apache.org/repos/asf/aurora-packaging/diff/b904b5f1 Branch: refs/heads/master Commit: b904b5f1c8db211a1d4d01a4a482eb3e42482b3d Parents: 2b19410 Author: Stephan Erb <[email protected]> Authored: Tue Feb 14 23:33:41 2017 +0100 Committer: Stephan Erb <[email protected]> Committed: Tue Feb 14 23:33:41 2017 +0100 ---------------------------------------------------------------------- .gitignore | 1 + build-artifact.sh | 2 +- test/deb/debian-jessie/README.md | 50 +++-------- test/deb/debian-jessie/Vagrantfile | 5 +- test/deb/debian-jessie/install-aurora.sh | 17 ++++ test/deb/debian-jessie/provision.sh | 11 +-- test/deb/ubuntu-trusty/README.md | 48 +++------- test/deb/ubuntu-trusty/Vagrantfile | 3 + test/deb/ubuntu-trusty/install-aurora.sh | 17 ++++ test/deb/ubuntu-trusty/provision.sh | 10 +-- test/deb/ubuntu-xenial/README.md | 51 +++-------- test/deb/ubuntu-xenial/Vagrantfile | 3 + test/deb/ubuntu-xenial/install-aurora.sh | 20 +++++ test/deb/ubuntu-xenial/provision.sh | 2 +- test/rpm/centos-7/README.md | 47 +++------- test/rpm/centos-7/Vagrantfile | 3 + test/rpm/centos-7/install-aurora.sh | 20 +++++ test/test-artifact.sh | 50 +++++++++++ test/test-aurora.sh | 122 ++++++++++++++++++++++++++ 19 files changed, 317 insertions(+), 165 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index 2d30051..a60a052 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ dist/ +artifacts/ .vagrant /build-support/*.venv /build-support/virtualenv-* http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/build-artifact.sh ---------------------------------------------------------------------- diff --git a/build-artifact.sh b/build-artifact.sh index e4efe5f..61edcaf 100755 --- a/build-artifact.sh +++ b/build-artifact.sh @@ -30,7 +30,7 @@ run_build() { IMAGE_NAME="aurora-$(basename $BUILDER_DIR)" echo "Using docker image $IMAGE_NAME" - docker build -t "$IMAGE_NAME" "$BUILDER_DIR" + docker build --pull -t "$IMAGE_NAME" "$BUILDER_DIR" docker run \ -e AURORA_VERSION=$AURORA_VERSION \ http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/deb/debian-jessie/README.md ---------------------------------------------------------------------- diff --git a/test/deb/debian-jessie/README.md b/test/deb/debian-jessie/README.md index 2e9bcb7..0a7ea3d 100644 --- a/test/deb/debian-jessie/README.md +++ b/test/deb/debian-jessie/README.md @@ -1,62 +1,34 @@ # Installing Aurora -## Install packages +## Testing packages Two methods are described, one for installing locally built packages, the other for installing released packages or release candidate packages. + ### Locally built - # Install vagrant scp - vagrant plugin install vagrant-scp +Run this from the toplevel repository: - # Scp over the newly built packages - for deb in ../../../artifacts/aurora-debian-jessie/dist/*.deb; do - vagrant scp $deb :$(basename $deb) - done + ./test/test-artifact.sh test/deb/debian-jessie /repo/artifacts/aurora-debian-jessie/dist - # Install each rpm - vagrant ssh -- -L8081:localhost:8081 -L1338:localhost:1338 - sudo dpkg -i *.deb ### Released - vagrant ssh -- -L8081:localhost:8081 -L1338:localhost:1338 - version=0.15.0 +Run this from the toplevel repository: + + version=0.17.0 pkg_root="https://apache.bintray.com/aurora/debian-jessie/" + for deb in \ aurora-scheduler_${version}_amd64.deb \ aurora-executor_${version}_amd64.deb \ aurora-tools_${version}_amd64.deb; do - wget $pkg_root/$deb - sudo dpkg -i $deb - done - -## Initialize and start -The scheduler and observer will automatically start when installed. However, the replicated log -has to be initialized manually: - - sudo systemctl stop aurora-scheduler - sudo -u aurora mkdir -p /var/lib/aurora/scheduler/db - sudo -u aurora mesos-log initialize --path=/var/lib/aurora/scheduler/db - sudo systemctl start aurora-scheduler - -To make the Thermos observer work, you will have to follow the instructions of our -[Install Guide](https://github.com/apache/aurora/blob/master/docs/operations/installation.md#configuration). - -## Create a job - -``` -echo " -task = SequentialTask( - processes = [Process(name = 'hello', cmdline = 'echo hello')], - resources = Resources(cpu = 0.5, ram = 128*MB, disk = 128*MB)) -jobs = [Service( - task = task, cluster = 'example', role = 'vagrant', environment = 'prod', name = 'hello')]" > hello_world.aurora + wget $pkg_root/$deb -P artifacts/aurora-debian-jessie/${version} + done -aurora job create example/vagrant/prod/hello hello_world.aurora -``` + ./test/test-artifact.sh test/deb/debian-jessie /repo/artifacts/aurora-debian-jessie/${version} ## Troubleshooting http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/deb/debian-jessie/Vagrantfile ---------------------------------------------------------------------- diff --git a/test/deb/debian-jessie/Vagrantfile b/test/deb/debian-jessie/Vagrantfile index f79c337..66fe79a 100644 --- a/test/deb/debian-jessie/Vagrantfile +++ b/test/deb/debian-jessie/Vagrantfile @@ -2,10 +2,13 @@ Vagrant.require_version ">= 1.5.0" Vagrant.configure(2) do |config| config.vm.define "aurora_jessie" - config.vm.box = "debian/jessie64" + config.vm.box = "debian/contrib-jessie64" # contrib contains the vboxsf module config.vm.hostname = "localhost" + # Mount the entire aurora-packaging folder at /repo + config.vm.synced_folder "../../../", "/repo" + config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", "4096"] vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/deb/debian-jessie/install-aurora.sh ---------------------------------------------------------------------- diff --git a/test/deb/debian-jessie/install-aurora.sh b/test/deb/debian-jessie/install-aurora.sh new file mode 100755 index 0000000..8781a90 --- /dev/null +++ b/test/deb/debian-jessie/install-aurora.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +DIST_DIR=$1 +PACKAGES=$(ls $DIST_DIR/*.deb) + +if [ -z "$PACKAGES" ] + then + echo "No packages found to be installed. Aborting." + exit 1 +fi + +sudo dpkg -i $PACKAGES + +sudo systemctl stop aurora-scheduler +sudo -u aurora mkdir -p /var/lib/aurora/scheduler/db +sudo -u aurora mesos-log initialize --path=/var/lib/aurora/scheduler/db || true +sudo systemctl start aurora-scheduler http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/deb/debian-jessie/provision.sh ---------------------------------------------------------------------- diff --git a/test/deb/debian-jessie/provision.sh b/test/deb/debian-jessie/provision.sh index 175f1ba..62e6489 100644 --- a/test/deb/debian-jessie/provision.sh +++ b/test/deb/debian-jessie/provision.sh @@ -2,17 +2,18 @@ echo "deb http://http.debian.net/debian jessie-backports main" | sudo tee -a /etc/apt/sources.list apt-get update -apt-get install -y openjdk-8-jre libcurl4-nss-dev libcurl3 libevent-dev libsvn1 zookeeperd +apt-get install -y openjdk-8-jre-headless -t jessie-backports +apt-get install -y zookeeperd curl update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java +# NOTE: This appears to be a missing dependency of the mesos deb package and is needed +# for the python mesos native bindings. +aptitude -y install libcurl4-nss-dev libcurl3 libevent-dev libsvn1 + package=mesos_1.1.0-2.0.107.debian81_amd64.deb wget -c http://repos.mesosphere.com/debian/pool/main/m/mesos/$package dpkg -i $package -# NOTE: This appears to be a missing dependency of the mesos deb package and is needed -# for the python mesos native bindings. -sudo apt-get -y install libcurl4-nss-dev - systemctl start mesos-master systemctl start mesos-slave http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/deb/ubuntu-trusty/README.md ---------------------------------------------------------------------- diff --git a/test/deb/ubuntu-trusty/README.md b/test/deb/ubuntu-trusty/README.md index 116ae8e..61cfeda 100644 --- a/test/deb/ubuntu-trusty/README.md +++ b/test/deb/ubuntu-trusty/README.md @@ -1,62 +1,36 @@ # Installing Aurora -## Install packages +## Testing packages Two methods are described, one for installing locally built packages, the other for installing released packages or release candidate packages. + ### Locally built - # Install vagrant scp - vagrant plugin install vagrant-scp +Run this from the toplevel repository: - # Scp over the newly built packages - for deb in ../../../artifacts/aurora-ubuntu-trusty/dist/*.deb; do - vagrant scp $deb :$(basename $deb) - done + ./test/test-artifact.sh test/deb/ubuntu-trusty /repo/artifacts/aurora-ubuntu-trusty/dist - # Install each rpm - vagrant ssh -- -L8081:localhost:8081 -L1338:localhost:1338 - sudo dpkg -i *.deb ### Released - vagrant ssh -- -L8081:localhost:8081 -L1338:localhost:1338 - version=0.15.0 +Run this from the toplevel repository: + + version=0.17.0 pkg_root="https://apache.bintray.com/aurora/ubuntu-trusty/" + for deb in \ aurora-scheduler_${version}_amd64.deb \ aurora-executor_${version}_amd64.deb \ aurora-tools_${version}_amd64.deb; do - wget $pkg_root/$deb - sudo dpkg -i $deb - done -## Initialize and start - -The scheduler and observer will automatically start when installed. However, the replicated log -has to be initialized manually: - - sudo stop aurora-scheduler - sudo -u aurora mkdir -p /var/lib/aurora/scheduler/db - sudo -u aurora mesos-log initialize --path=/var/lib/aurora/scheduler/db - sudo start aurora-scheduler - -To make the Thermos observer work, you will have to follow the instructions of our -[Install Guide](https://github.com/apache/aurora/blob/master/docs/operations/installation.md#configuration). + wget $pkg_root/$deb -P artifacts/aurora-ubuntu-trusty/${version} + done -## Create a job + ./test/test-artifact.sh test/deb/ubuntu-trusty /repo/artifacts/aurora-ubuntu-trusty/${version} -``` -echo " -task = SequentialTask( - processes = [Process(name = 'hello', cmdline = 'echo hello')], - resources = Resources(cpu = 0.5, ram = 128*MB, disk = 128*MB)) -jobs = [Service( - task = task, cluster = 'example', role = 'vagrant', environment = 'prod', name = 'hello')]" > hello_world.aurora -aurora job create example/vagrant/prod/hello hello_world.aurora -``` ## Troubleshooting * Mesos: `/var/log/mesos` http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/deb/ubuntu-trusty/Vagrantfile ---------------------------------------------------------------------- diff --git a/test/deb/ubuntu-trusty/Vagrantfile b/test/deb/ubuntu-trusty/Vagrantfile index ed5ec8e..f050ef2 100644 --- a/test/deb/ubuntu-trusty/Vagrantfile +++ b/test/deb/ubuntu-trusty/Vagrantfile @@ -6,6 +6,9 @@ Vagrant.configure(2) do |config| config.vm.hostname = "localhost" + # Mount the entire aurora-packaging folder at /repo + config.vm.synced_folder "../../../", "/repo" + config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", "4096"] vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/deb/ubuntu-trusty/install-aurora.sh ---------------------------------------------------------------------- diff --git a/test/deb/ubuntu-trusty/install-aurora.sh b/test/deb/ubuntu-trusty/install-aurora.sh new file mode 100755 index 0000000..ecff474 --- /dev/null +++ b/test/deb/ubuntu-trusty/install-aurora.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +DIST_DIR=$1 +PACKAGES=$(ls $DIST_DIR/*.deb) + +if [ -z "$PACKAGES" ] + then + echo "No packages found to be installed. Aborting." + exit 1 +fi + +sudo dpkg -i $PACKAGES + +sudo stop aurora-scheduler +sudo -u aurora mkdir -p /var/lib/aurora/scheduler/db +sudo -u aurora mesos-log initialize --path=/var/lib/aurora/scheduler/db || true +sudo start aurora-scheduler http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/deb/ubuntu-trusty/provision.sh ---------------------------------------------------------------------- diff --git a/test/deb/ubuntu-trusty/provision.sh b/test/deb/ubuntu-trusty/provision.sh index 123590e..1d48e49 100644 --- a/test/deb/ubuntu-trusty/provision.sh +++ b/test/deb/ubuntu-trusty/provision.sh @@ -2,17 +2,17 @@ add-apt-repository ppa:openjdk-r/ppa -y apt-get update -apt-get install -y openjdk-8-jre libcurl4-nss-dev libevent-dev libsvn1 zookeeperd +apt-get install -y openjdk-8-jre zookeeperd update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java +# NOTE: This appears to be a missing dependency of the mesos deb package and is needed +# for the python mesos native bindings. +sudo apt-get -y install libcurl4-nss-dev libevent-dev libsvn1 + package=mesos_1.1.0-2.0.107.ubuntu1404_amd64.deb wget -c http://repos.mesosphere.com/ubuntu/pool/main/m/mesos/$package dpkg -i $package -# NOTE: This appears to be a missing dependency of the mesos deb package and is needed -# for the python mesos native bindings. -sudo apt-get -y install libcurl4-nss-dev - start mesos-master start mesos-slave http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/deb/ubuntu-xenial/README.md ---------------------------------------------------------------------- diff --git a/test/deb/ubuntu-xenial/README.md b/test/deb/ubuntu-xenial/README.md index a5284ec..91c81f6 100644 --- a/test/deb/ubuntu-xenial/README.md +++ b/test/deb/ubuntu-xenial/README.md @@ -1,65 +1,36 @@ # Installing Aurora -## Install packages +## Testing packages Two methods are described, one for installing locally built packages, the other for installing released packages or release candidate packages. + ### Locally built - # Install vagrant scp - vagrant plugin install vagrant-scp +Run this from the toplevel repository: - # Scp over the newly built packages - for deb in ../../../artifacts/aurora-ubuntu-xenial/dist/*.deb; do - vagrant scp $deb :$(basename $deb); - done + ./test/test-artifact.sh test/deb/ubuntu-xenial /repo/artifacts/aurora-ubuntu-xenial/dist - # Install each deb - vagrant ssh -- -L8081:localhost:8081 -L1338:localhost:1338 - sudo dpkg -i aurora*.deb thermos*.deb ### Released - vagrant ssh -- -L8081:localhost:8081 -L1338:localhost:1338 - version=0.15.0 +Run this from the toplevel repository: + + version=0.17.0 pkg_root="https://apache.bintray.com/aurora/ubuntu-xenial/" + for deb in \ aurora-scheduler_${version}_amd64.deb \ aurora-executor_${version}_amd64.deb \ aurora-tools_${version}_amd64.deb; do - wget $pkg_root/$deb - sudo dpkg -i $deb - done -## Initialize and start - -The replicated log has to be initialized manually: - - # Stop services first - sudo systemctl stop aurora-scheduler - sudo systemctl stop thermos - - sudo -u aurora mkdir -p /var/lib/aurora/scheduler/db - sudo -u aurora mesos-log initialize --path=/var/lib/aurora/scheduler/db - sudo systemctl start aurora-scheduler - sudo systemctl start thermos - -To make the Thermos observer work, you will have to follow the instructions of our -[Install Guide](https://github.com/apache/aurora/blob/master/docs/operations/installation.md#configuration). + wget $pkg_root/$deb -P artifacts/aurora-ubuntu-xenial/${version} + done -## Create a job + ./test/test-artifact.sh test/deb/ubuntu-xenial /repo/artifacts/aurora-ubuntu-xenial/${version} -``` -echo " -task = SequentialTask( - processes = [Process(name = 'hello', cmdline = 'echo hello')], - resources = Resources(cpu = 0.5, ram = 128*MB, disk = 128*MB)) -jobs = [Service( - task = task, cluster = 'example', role = 'vagrant', environment = 'prod', name = 'hello')]" > hello_world.aurora -aurora job create example/vagrant/prod/hello hello_world.aurora -``` ## Troubleshooting * Mesos: `/var/log/mesos` http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/deb/ubuntu-xenial/Vagrantfile ---------------------------------------------------------------------- diff --git a/test/deb/ubuntu-xenial/Vagrantfile b/test/deb/ubuntu-xenial/Vagrantfile index 3ce6209..e8fa9ed 100644 --- a/test/deb/ubuntu-xenial/Vagrantfile +++ b/test/deb/ubuntu-xenial/Vagrantfile @@ -6,6 +6,9 @@ Vagrant.configure(2) do |config| config.vm.hostname = "localhost" + # Mount the entire aurora-packaging folder at /repo + config.vm.synced_folder "../../../", "/repo" + config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", "4096"] vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/deb/ubuntu-xenial/install-aurora.sh ---------------------------------------------------------------------- diff --git a/test/deb/ubuntu-xenial/install-aurora.sh b/test/deb/ubuntu-xenial/install-aurora.sh new file mode 100755 index 0000000..b8ff606 --- /dev/null +++ b/test/deb/ubuntu-xenial/install-aurora.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +DIST_DIR=$1 +PACKAGES=$(ls $DIST_DIR/*.deb) + +if [ -z "$PACKAGES" ] + then + echo "No packages found to be installed. Aborting." + exit 1 +fi + +sudo dpkg -i $PACKAGES + +sudo systemctl stop aurora-scheduler +sudo systemctl stop thermos + +sudo -u aurora mkdir -p /var/lib/aurora/scheduler/db +sudo -u aurora mesos-log initialize --path=/var/lib/aurora/scheduler/db || true +sudo systemctl start aurora-scheduler +sudo systemctl start thermos http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/deb/ubuntu-xenial/provision.sh ---------------------------------------------------------------------- diff --git a/test/deb/ubuntu-xenial/provision.sh b/test/deb/ubuntu-xenial/provision.sh index eda79f6..ecdc0bd 100644 --- a/test/deb/ubuntu-xenial/provision.sh +++ b/test/deb/ubuntu-xenial/provision.sh @@ -9,7 +9,7 @@ update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java # Mesos dependencies apt-get -y install libcurl3 libevent-dev libsvn1 libcurl4-nss-dev -package=mesos_1.0.0-2.0.86.ubuntu1604_amd64.deb +package=mesos_1.1.0-2.0.107.ubuntu1604_amd64.deb wget -c http://repos.mesosphere.com/ubuntu/pool/main/m/mesos/$package dpkg -i $package http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/rpm/centos-7/README.md ---------------------------------------------------------------------- diff --git a/test/rpm/centos-7/README.md b/test/rpm/centos-7/README.md index 7fcd5a0..3f33d69 100644 --- a/test/rpm/centos-7/README.md +++ b/test/rpm/centos-7/README.md @@ -1,60 +1,35 @@ # Installing Aurora -## Install packages +## Testing packages Two methods are described, one for installing locally built packages, the other for installing released packages or release candidate packages. + ### Locally built - # Install vagrant scp - vagrant plugin install vagrant-scp +Run this from the toplevel repository: - # Scp over the newly built packages - for rpm in ../../../artifacts/aurora-centos-7/dist/rpmbuild/RPMS/x86_64/*.rpm; do - vagrant scp $rpm :$(basename $rpm) - done + ./test/test-artifact.sh test/rpm/centos-7 /repo/artifacts/aurora-centos-7/dist/rpmbuild/RPMS/x86_64 - # Install each rpm - vagrant ssh -- -L8081:localhost:8081 -L1338:localhost:1338 - sudo yum install -y *.rpm ### Released - vagrant ssh -- -L8081:localhost:8081 -L1338:localhost:1338 - version=0.15.0 +Run this from the toplevel repository: + + version=0.17.0 pkg_root="https://apache.bintray.com/aurora/centos-7/" + for rpm in \ aurora-scheduler-${version}-1.el7.centos.aurora.x86_64.rpm \ aurora-executor-${version}-1.el7.centos.aurora.x86_64.rpm \ aurora-tools-${version}-1.el7.centos.aurora.x86_64.rpm; do - wget $pkg_root/$rpm - sudo yum install -y $rpm - done -## Initialize and start - - sudo -u aurora mkdir -p /var/lib/aurora/scheduler/db - sudo -u aurora mesos-log initialize --path=/var/lib/aurora/scheduler/db - sudo systemctl start aurora-scheduler - sudo systemctl start thermos - -To make the Thermos observer work, you will have to follow the instructions of our -[Install Guide](https://github.com/apache/aurora/blob/master/docs/operations/installation.md#configuration). - - -## Create a job + wget $pkg_root/$rpm -P artifacts/aurora-centos-7/${version} + done -``` -echo " -task = SequentialTask( - processes = [Process(name = 'hello', cmdline = 'echo hello')], - resources = Resources(cpu = 0.5, ram = 128*MB, disk = 128*MB)) -jobs = [Service( - task = task, cluster = 'example', role = 'vagrant', environment = 'prod', name = 'hello')]" > hello_world.aurora + ./test/test-artifact.sh test/rpm/centos-7 /repo/artifacts/aurora-centos-7/${version} -aurora job create example/vagrant/prod/hello hello_world.aurora -``` ## Troubleshooting http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/rpm/centos-7/Vagrantfile ---------------------------------------------------------------------- diff --git a/test/rpm/centos-7/Vagrantfile b/test/rpm/centos-7/Vagrantfile index 5059b84..8342b09 100644 --- a/test/rpm/centos-7/Vagrantfile +++ b/test/rpm/centos-7/Vagrantfile @@ -6,6 +6,9 @@ Vagrant.configure(2) do |config| config.vm.hostname = "localhost" + # Mount the entire aurora-packaging folder at /repo + config.vm.synced_folder "../../../", "/repo" + config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", "4096"] vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/rpm/centos-7/install-aurora.sh ---------------------------------------------------------------------- diff --git a/test/rpm/centos-7/install-aurora.sh b/test/rpm/centos-7/install-aurora.sh new file mode 100755 index 0000000..b056ec5 --- /dev/null +++ b/test/rpm/centos-7/install-aurora.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +DIST_DIR=$1 +PACKAGES=$(ls $DIST_DIR/*.rpm) + +if [ -z "$PACKAGES" ] + then + echo "No packages found to be installed. Aborting." + exit 1 +fi + +sudo yum install -y $PACKAGES + +sudo -u aurora mkdir -p /var/lib/aurora/scheduler/db +sudo -u aurora mesos-log initialize --path=/var/lib/aurora/scheduler/db || true +sudo systemctl start aurora-scheduler +sudo systemctl start thermos + +# Ensure compatibility so that our test-aurora.sh script works on all distributions. +sudo ln -sf /usr/bin/aurora_admin /usr/bin/aurora-admin http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/test-artifact.sh ---------------------------------------------------------------------- diff --git a/test/test-artifact.sh b/test/test-artifact.sh new file mode 100755 index 0000000..6b527c9 --- /dev/null +++ b/test/test-artifact.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +run_test() { + TEST_DIR=$1 + DIST_DIR=$2 + + pushd $TEST_DIR + vagrant up --provision + + # Install Aurora using the distribution specific install script + vagrant ssh -c "/vagrant/install-aurora.sh $DIST_DIR" + + # Verify Aurora using the generic test script + vagrant ssh -c "/repo/test/test-aurora.sh" -- -L8081:localhost:8081 -L1338:localhost:1338 + + vagrant halt --force + popd +} + +case $# in + 2) + run_test "$@" + ;; + + *) + echo 'Usage to test a specific artifact:' + echo " $0 TEST_DIR DIST_DIR" + echo + echo 'Where TEST_DIR is any distribution subfolder with a Vagrantfile' + echo ' and where DIST_DIR is location within the Vagrant box where packages should be installed from.' + echo + echo 'Example:' + echo ' ./test/test-artifact.sh test/deb/ubuntu-trusty/ /repo/artifacts/aurora-ubuntu-trusty/dist' + exit 1 + ;; +esac http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/b904b5f1/test/test-aurora.sh ---------------------------------------------------------------------- diff --git a/test/test-aurora.sh b/test/test-aurora.sh new file mode 100755 index 0000000..465d149 --- /dev/null +++ b/test/test-aurora.sh @@ -0,0 +1,122 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +if [[ "$USER" != "vagrant" ]]; then + echo "This script is supposed to run within Vagrant in order to verify an Aurora installation." + exit 1 +fi + +set -u -e -x +set -o pipefail + +readonly TEST_SLAVE_IP=127.0.0.1 + +_curl() { curl --silent --fail --retry 4 --retry-delay 10 "$@" ; } + + +tear_down() { + aurora job killall --no-batching example/vagrant/test/hello_world >/dev/null 2>&1 +} + + +collect_result() { + set +x # Disable command echo, as this makes it more difficult see which command failed. + if [[ $RETCODE = 0 ]] + then + echo "OK (all tests passed)" + else + echo "!!! FAIL (something returned non-zero) for $BASH_COMMAND" + fi + # Attempt to clean up any state we left behind. + tear_down + exit $RETCODE +} + + +check_url_live() { + [[ $(curl -sL -w '%{http_code}' $1 -o /dev/null) == 200 ]] +} + + +test_create_job() { + echo " +task = SequentialTask( + processes = [Process(name = 'hello', cmdline = 'echo hello; sleep 120')], + resources = Resources(cpu = 0.5, ram = 128*MB, disk = 128*MB)) +jobs = [Service( + task = task, cluster = 'example', role = 'vagrant', environment = 'test', name = 'hello_world')]" > hello_world.aurora + + aurora job create example/vagrant/test/hello_world hello_world.aurora +} + + +test_job_status() { + local _cluster=$1 _role=$2 _env=$3 _job=$4 + local _jobkey="$_cluster/$_role/$_env/$_job" + + echo "== Checking job status" + aurora job list $_cluster/$_role/$_env | grep "$_jobkey" + aurora job status $_jobkey +} + + +test_scheduler_ui() { + local _role=$1 _env=$2 _job=$3 + + # Check that scheduler UI pages shown + base_url="$TEST_SLAVE_IP:8081" + check_url_live "$base_url/leaderhealth" + check_url_live "$base_url/scheduler" + check_url_live "$base_url/scheduler/$_role" + check_url_live "$base_url/scheduler/$_role/$_env/$_job" +} + + +test_observer_ui() { + local _cluster=$1 _role=$2 _job=$3 + + # Check the observer page + observer_url="$TEST_SLAVE_IP:1338" + check_url_live "$observer_url" + + # Poll the observer, waiting for it to receive and show information about the task. + local _success=0 + for i in $(seq 1 120); do + task_id=$(aurora-admin query -l '%taskId%' --shards=0 --states=RUNNING $_cluster $_role $_job) + if check_url_live "$observer_url/task/$task_id"; then + _success=1 + break + else + sleep 1 + fi + done + + if [[ "$_success" -ne "1" ]]; then + echo "Observer task detail page is not available." + exit 1 + fi +} + + +RETCODE=1 +trap collect_result EXIT + +test_create_job +test_job_status example vagrant test hello_world +test_scheduler_ui vagrant test hello_world +test_observer_ui example vagrant hello_world + +RETCODE=0
