You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by mc...@apache.org on 2014/05/07 22:38:52 UTC
git commit: Add a clientv2 version of the e2e test.
Repository: incubator-aurora
Updated Branches:
refs/heads/master ed9cbb938 -> a2becf17f
Add a clientv2 version of the e2e test.
Bugs closed: aurora-266
Reviewed at https://reviews.apache.org/r/19788/
Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/a2becf17
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/a2becf17
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/a2becf17
Branch: refs/heads/master
Commit: a2becf17fad2a8beedc904179e4c44a4b081e6ef
Parents: ed9cbb9
Author: Mark Chu-Carroll <mc...@twopensource.com>
Authored: Wed May 7 16:38:42 2014 -0400
Committer: Mark Chu-Carroll <mc...@twitter.com>
Committed: Wed May 7 16:38:42 2014 -0400
----------------------------------------------------------------------
src/main/python/apache/aurora/client/BUILD | 2 +-
src/main/python/apache/aurora/client/cli/BUILD | 2 +-
src/test/python/apache/aurora/client/cli/BUILD | 14 +--
.../sh/org/apache/aurora/e2e/test_end_to_end.sh | 2 +-
.../org/apache/aurora/e2e/test_end_to_end_v2.sh | 118 +++++++++++++++++++
5 files changed, 128 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/a2becf17/src/main/python/apache/aurora/client/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/BUILD b/src/main/python/apache/aurora/client/BUILD
index 118c4a0..8acf029 100644
--- a/src/main/python/apache/aurora/client/BUILD
+++ b/src/main/python/apache/aurora/client/BUILD
@@ -104,7 +104,7 @@ python_library(
name = 'apache.aurora.clientv2',
version = open(os.path.join(get_buildroot(), '.auroraversion')).read().strip().upper(),
).with_binaries(
- aurora_client_v2 = pants('src/main/python/apache/aurora/client/cli:client'),
+ aurora2 = pants('src/main/python/apache/aurora/client/cli:aurora2'),
)
)
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/a2becf17/src/main/python/apache/aurora/client/cli/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/BUILD b/src/main/python/apache/aurora/client/cli/BUILD
index 8dac98e..0c5a8c5 100644
--- a/src/main/python/apache/aurora/client/cli/BUILD
+++ b/src/main/python/apache/aurora/client/cli/BUILD
@@ -15,7 +15,7 @@
#
python_binary(
- name='client',
+ name='aurora2',
entry_point = 'apache.aurora.client.cli.client:proxy_main',
dependencies = [
pants(':client_lib')
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/a2becf17/src/test/python/apache/aurora/client/cli/BUILD
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/BUILD b/src/test/python/apache/aurora/client/cli/BUILD
index 1504476..c0492cc 100644
--- a/src/test/python/apache/aurora/client/cli/BUILD
+++ b/src/test/python/apache/aurora/client/cli/BUILD
@@ -45,7 +45,7 @@ python_tests(
pants('3rdparty/python:mock'),
pants('3rdparty/python:twitter.common.contextutil'),
pants('src/main/python/apache/aurora/client/cli'),
- pants('src/main/python/apache/aurora/client/cli:client'),
+ pants('src/main/python/apache/aurora/client/cli:client_lib'),
]
)
@@ -70,7 +70,7 @@ python_tests(
pants('3rdparty/python:mock'),
pants('3rdparty/python:twitter.common.contextutil'),
pants('src/main/python/apache/aurora/client/cli'),
- pants('src/main/python/apache/aurora/client/cli:client'),
+ pants('src/main/python/apache/aurora/client/cli:client_lib'),
]
)
@@ -99,7 +99,7 @@ python_tests(
pants('3rdparty/python:mock'),
pants('3rdparty/python:twitter.common.contextutil'),
pants('src/main/python/apache/aurora/client/cli'),
- pants('src/main/python/apache/aurora/client/cli:client'),
+ pants('src/main/python/apache/aurora/client/cli:client_lib'),
pants('src/test/python/apache/aurora/client/commands:util')
]
)
@@ -112,7 +112,7 @@ python_tests(
pants('3rdparty/python:mock'),
pants('3rdparty/python:twitter.common.contextutil'),
pants('src/main/python/apache/aurora/client/cli'),
- pants('src/main/python/apache/aurora/client/cli:client'),
+ pants('src/main/python/apache/aurora/client/cli:client_lib'),
pants('src/test/python/apache/aurora/client/commands:util')
]
)
@@ -125,7 +125,7 @@ python_tests(
pants('3rdparty/python:mock'),
pants('3rdparty/python:twitter.common.contextutil'),
pants('src/main/python/apache/aurora/client/cli'),
- pants('src/main/python/apache/aurora/client/cli:client'),
+ pants('src/main/python/apache/aurora/client/cli:client_lib'),
pants('src/test/python/apache/aurora/client/commands:util')
]
)
@@ -138,7 +138,7 @@ python_tests(
pants('3rdparty/python:mock'),
pants('3rdparty/python:twitter.common.contextutil'),
pants('src/main/python/apache/aurora/client/cli'),
- pants('src/main/python/apache/aurora/client/cli:client'),
+ pants('src/main/python/apache/aurora/client/cli:client_lib'),
pants('src/test/python/apache/aurora/client/commands:util')
]
)
@@ -151,7 +151,7 @@ python_tests(
pants('3rdparty/python:mock'),
pants('3rdparty/python:twitter.common.contextutil'),
pants('src/main/python/apache/aurora/client/cli'),
- pants('src/main/python/apache/aurora/client/cli:client'),
+ pants('src/main/python/apache/aurora/client/cli:client_lib'),
pants('src/test/python/apache/aurora/client/commands:util')
]
)
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/a2becf17/src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh
----------------------------------------------------------------------
diff --git a/src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh b/src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh
index f89c801..c8fa07a 100755
--- a/src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh
+++ b/src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh
@@ -37,7 +37,7 @@ function run_sched() {
devtools_setup() {
local _testdir=$1
# grab the current branch name, and create a workspace using the same branch in vagrant.
- branch=$(git branch | grep '*' | cut -c 3-)
+ branch=$(git rev-parse --abbrev-ref HEAD)
run_dev "if [ ! -d ~/test_dev ]; then git clone /vagrant ~/test_dev; fi"
# Clean out any lingering build products; we want fresh.
run_dev "rm -rf ~/.pex"
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/a2becf17/src/test/sh/org/apache/aurora/e2e/test_end_to_end_v2.sh
----------------------------------------------------------------------
diff --git a/src/test/sh/org/apache/aurora/e2e/test_end_to_end_v2.sh b/src/test/sh/org/apache/aurora/e2e/test_end_to_end_v2.sh
new file mode 100755
index 0000000..3c4165c
--- /dev/null
+++ b/src/test/sh/org/apache/aurora/e2e/test_end_to_end_v2.sh
@@ -0,0 +1,118 @@
+#!/bin/bash
+#
+# Copyright 2014 Apache Software Foundation
+#
+# 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.
+#
+#
+# A simple integration test for the mesos client, intended to be run before checkin of major
+#client changes, and as a part of an integrated build process.
+#
+# This test uses the vagrant demonstration environment. It loads up a virtual cluster, and then
+# launches a job, verifies that it's running, updates it, verifies that the update succeeded,
+# and then kills the job.
+
+set -u -e -x
+
+. src/test/sh/org/apache/aurora/e2e/test_common.sh
+
+
+function run_dev() {
+ vagrant ssh devtools -c "$1"
+}
+
+function run_sched() {
+ vagrant ssh aurora-scheduler -c "$1"
+}
+
+function check_url_live() {
+ test $(curl -sL -w '%{http_code}' $1 -o /dev/null) == 200
+
+}
+
+devtools_setup() {
+ local _testdir=$1
+ # grab the current branch name, and create a workspace using the same branch in vagrant.
+ branch=$(git rev-parse --abbrev-ref HEAD)
+ run_dev "if [ ! -d ~/test_dev ]; then git clone /vagrant ~/test_dev; fi"
+ # Clean out any lingering build products; we want fresh.
+ run_dev "cd ~/test_dev; git reset --hard; git clean -fdx"
+ run_dev "cd ~/test_dev ; git checkout $branch; git pull"
+ run_dev "cd ~/test_dev; ./pants src/main/python/apache/aurora/client/cli:aurora2"
+ run_dev "cd ~/test_dev; ./pants src/test/sh/org/apache/aurora/e2e/flask:flask_example"
+ if [ ! -d $_testdir ]
+ then
+ mkdir $_testdir
+ fi
+ run_dev "cd ~/test_dev; cp dist/flask_example.pex /vagrant/$_testdir"
+ run_dev "cd ~/test_dev; cp dist/$CLIENT_NAME /vagrant/$_testdir"
+}
+
+test_flask_example() {
+ local _cluster=$1 _role=$2 _env=$3 _job=$4 _testdir=$5 _sched_ip=$6
+ local _base_config=$7 _updated_config=$8
+ jobkey="$_cluster/$_role/$_env/$_job"
+ echo '== Creating job'
+ run_sched "/vagrant/$_testdir/$CLIENT_NAME job create $jobkey $_base_config"
+
+ # Check that scheduler UI pages shown
+ base_url="http://$_sched_ip:8081"
+ check_url_live "$base_url/scheduler"
+ check_url_live "$base_url/scheduler/$_role"
+ check_url_live "$base_url/scheduler/$_role/$_env/$_job"
+
+ echo '== Updating test job'
+ run_sched "/vagrant/$_testdir/$CLIENT_NAME job update $jobkey $_updated_config"
+
+ # TODO(mchucarroll): Get "run" working: the vagrant configuration currently doesn't set up ssh
+ # to allow automatic logins to the slaves. "aurora run" therefore tries to prompt the user for
+ # a password, finds that it's not running in a TTY, and aborts.
+ runlen=$(run_sched "/vagrant/$_testdir/$CLIENT_NAME task run $jobkey 'pwd'" | wc -l)
+ test $runlen -eq 2
+
+ run_sched "/vagrant/$_testdir/$CLIENT_NAME quota get $_cluster/$_role"
+
+ run_sched "/vagrant/$_testdir/$CLIENT_NAME job killall $jobkey"
+}
+
+RETCODE=1
+# Set up shorthands for test
+export CLIENT_NAME=aurora2.pex
+export EXAMPLE_DIR=/vagrant/src/test/sh/org/apache/aurora/e2e/flask
+TEST_DIR=deploy_test
+TEST_CLUSTER=example
+TEST_ROLE=vagrant
+TEST_ENV=test
+TEST_JOB=flask_example
+TEST_SCHEDULER_IP=192.168.33.6
+TEST_ARGS=(
+ $TEST_CLUSTER
+ $TEST_ROLE
+ $TEST_ENV
+ $TEST_JOB
+ $TEST_DIR
+ $TEST_SCHEDULER_IP
+ $EXAMPLE_DIR/flask_example.aurora
+ $EXAMPLE_DIR/flask_example_updated.aurora
+ )
+
+trap collect_result EXIT
+vagrant up
+
+
+# wipe the pseudo-deploy dir, and then create it fresh, to guarantee that the
+# test runs clean.
+rm -rf $TEST_DIR
+devtools_setup $TEST_DIR
+test_flask_example "${TEST_ARGS[@]}"
+RETCODE=0