You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by wf...@apache.org on 2015/01/28 22:02:12 UTC
incubator-aurora git commit: End to end tests for docker in aurora
Repository: incubator-aurora
Updated Branches:
refs/heads/master 59025743b -> 51f0d8bbd
End to end tests for docker in aurora
Reviewed at https://reviews.apache.org/r/29827/
Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/51f0d8bb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/51f0d8bb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/51f0d8bb
Branch: refs/heads/master
Commit: 51f0d8bbd7c5b29caede830250fcd0e300b54ea6
Parents: 5902574
Author: Steve Niemitz <st...@tellapart.com>
Authored: Wed Jan 28 13:01:25 2015 -0800
Committer: Bill Farner <wf...@apache.org>
Committed: Wed Jan 28 13:01:25 2015 -0800
----------------------------------------------------------------------
src/test/sh/org/apache/aurora/e2e/Dockerfile | 3 ++
.../aurora/e2e/http/http_example_docker.aurora | 47 +++++++++++++++++
.../e2e/http/http_example_docker_updated.aurora | 53 ++++++++++++++++++++
.../sh/org/apache/aurora/e2e/test_end_to_end.sh | 21 +++++++-
4 files changed, 123 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/51f0d8bb/src/test/sh/org/apache/aurora/e2e/Dockerfile
----------------------------------------------------------------------
diff --git a/src/test/sh/org/apache/aurora/e2e/Dockerfile b/src/test/sh/org/apache/aurora/e2e/Dockerfile
new file mode 100644
index 0000000..d316b87
--- /dev/null
+++ b/src/test/sh/org/apache/aurora/e2e/Dockerfile
@@ -0,0 +1,3 @@
+FROM python:2.7
+
+COPY http_example.py /tmp/
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/51f0d8bb/src/test/sh/org/apache/aurora/e2e/http/http_example_docker.aurora
----------------------------------------------------------------------
diff --git a/src/test/sh/org/apache/aurora/e2e/http/http_example_docker.aurora b/src/test/sh/org/apache/aurora/e2e/http/http_example_docker.aurora
new file mode 100644
index 0000000..00fa2fb
--- /dev/null
+++ b/src/test/sh/org/apache/aurora/e2e/http/http_example_docker.aurora
@@ -0,0 +1,47 @@
+#
+# 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.
+#
+
+import getpass
+
+run_server = Process(
+ name = 'run_server',
+ cmdline = 'python http_example.py {{thermos.ports[http]}}')
+
+stage_server = Process(
+ name = 'stage_server',
+ cmdline = "cp /tmp/http_example.py ."
+)
+
+test_task = Task(
+ name = 'http_example',
+ resources = Resources(cpu=0.5, ram=32*MB, disk=64*MB),
+ processes = [stage_server, run_server],
+ constraints = order(stage_server, run_server))
+
+job = Job(
+ name = 'http_example_docker',
+ cluster = 'devcluster',
+ instances = 2,
+ task = test_task,
+ role = getpass.getuser(),
+ environment = 'test',
+ contact = '{{role}}@localhost',
+ # Since there is only one slave in devcluster allow all instances to run there.
+ constraints = {
+ 'host': 'limit:2',
+ },
+ container = Container(docker=Docker(image = 'http_example')),
+)
+
+jobs = [ job ]
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/51f0d8bb/src/test/sh/org/apache/aurora/e2e/http/http_example_docker_updated.aurora
----------------------------------------------------------------------
diff --git a/src/test/sh/org/apache/aurora/e2e/http/http_example_docker_updated.aurora b/src/test/sh/org/apache/aurora/e2e/http/http_example_docker_updated.aurora
new file mode 100644
index 0000000..20f604b
--- /dev/null
+++ b/src/test/sh/org/apache/aurora/e2e/http/http_example_docker_updated.aurora
@@ -0,0 +1,53 @@
+#
+# 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.
+#
+
+import getpass
+
+run_server = Process(
+ name = 'run_server',
+ cmdline = 'python http_example.py {{thermos.ports[http]}}')
+
+stage_server = Process(
+ name = 'stage_server',
+ cmdline = "cp /tmp/http_example.py ."
+)
+
+test_task = Task(
+ name = 'http_example',
+ resources = Resources(cpu=0.5, ram=34*MB, disk=64*MB),
+ processes = [stage_server, run_server],
+ constraints = order(stage_server, run_server))
+
+update_config = UpdateConfig(watch_secs=10, batch_size=2)
+health_check_config = HealthCheckConfig(initial_interval_secs=5, interval_secs=1)
+
+job = Job(
+ name = 'http_example_docker',
+ cluster = 'devcluster',
+ instances = 3,
+ update_config = update_config,
+ health_check_config = health_check_config,
+ task = test_task,
+ role = getpass.getuser(),
+ environment = 'test',
+ contact = '{{role}}@localhost',
+ # Since there is only one slave in devcluster allow all instances to run there.
+ constraints = {
+ 'host': 'limit:4',
+ },
+ announce = Announcer(),
+ container = Container(docker=Docker(image = 'http_example')),
+)
+
+jobs = [ job ]
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/51f0d8bb/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 45da754..7ef7a6b 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
@@ -98,11 +98,14 @@ test_admin() {
RETCODE=1
# Set up shorthands for test
-export EXAMPLE_DIR=/vagrant/src/test/sh/org/apache/aurora/e2e/http
+export TEST_ROOT=/vagrant/src/test/sh/org/apache/aurora/e2e
+export EXAMPLE_DIR=${TEST_ROOT}/http
+export DOCKER_DIR=${TEST_ROOT}/docker
TEST_CLUSTER=devcluster
TEST_ROLE=vagrant
TEST_ENV=test
TEST_JOB=http_example
+TEST_DOCKER_JOB=http_example_docker
TEST_SCHEDULER_IP=192.168.33.7
TEST_ARGS=(
$TEST_CLUSTER
@@ -119,6 +122,16 @@ TEST_ADMIN_ARGS=(
$TEST_SCHEDULER_IP
)
+TEST_DOCKER_ARGS=(
+ $TEST_CLUSTER
+ $TEST_ROLE
+ $TEST_ENV
+ $TEST_DOCKER_JOB
+ $TEST_SCHEDULER_IP
+ $EXAMPLE_DIR/http_example_docker.aurora
+ $EXAMPLE_DIR/http_example_docker_updated.aurora
+)
+
trap collect_result EXIT
vagrant up
vagrant ssh -c "aurorabuild all"
@@ -127,5 +140,11 @@ vagrant ssh -c "aurorabuild all"
# test runs clean.
test_version
test_http_example "${TEST_ARGS[@]}"
+
+# build the test docker image
+vagrant ssh -c "sudo docker build -t http_example ${TEST_ROOT}"
+
+test_http_example "${TEST_DOCKER_ARGS[@]}"
+
test_admin "${TEST_ADMIN_ARGS[@]}"
RETCODE=0