aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevi...@apache.org
Subject git commit: Fix aurora run in end to end tests.
Date Wed, 03 Sep 2014 23:09:53 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 467bc5604 -> 7d6b246c5


Fix aurora run in end to end tests.

Testing Done:
$ bash src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh

Unfortunately the v2 client end to end tests are currently broken
(filed https://issues.apache.org/jira/browse/AURORA-677), but I
verified that the test for aurora task run works in that script
as well.

Bugs closed: AURORA-676

Reviewed at https://reviews.apache.org/r/25206/


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/7d6b246c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/7d6b246c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/7d6b246c

Branch: refs/heads/master
Commit: 7d6b246c5181ea2f1e9d2d8422d437235f231965
Parents: 467bc56
Author: Joshua Cohen <jcohen@twitter.com>
Authored: Wed Sep 3 16:08:23 2014 -0700
Committer: Kevin Sweeney <kevints@apache.org>
Committed: Wed Sep 3 16:09:48 2014 -0700

----------------------------------------------------------------------
 examples/vagrant/provision-dev-cluster.sh       | 11 +++++++
 examples/vagrant/upstart/mesos-slave.conf       |  6 +++-
 .../sh/org/apache/aurora/e2e/test_end_to_end.sh | 14 +++++----
 .../org/apache/aurora/e2e/test_end_to_end_v2.sh | 12 ++++----
 src/test/sh/org/apache/aurora/e2e/test_run.sh   | 30 ++++++++++++++++++++
 5 files changed, 61 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/7d6b246c/examples/vagrant/provision-dev-cluster.sh
----------------------------------------------------------------------
diff --git a/examples/vagrant/provision-dev-cluster.sh b/examples/vagrant/provision-dev-cluster.sh
index 0b46e31..4883df2 100755
--- a/examples/vagrant/provision-dev-cluster.sh
+++ b/examples/vagrant/provision-dev-cluster.sh
@@ -76,6 +76,16 @@ function install_cluster_config {
 EOF
 }
 
+function install_ssh_config {
+  cat >> /etc/ssh/ssh_config <<EOF
+
+# Allow local ssh w/out strict host checking
+Host $(hostname)
+    StrictHostKeyChecking no
+    UserKnownHostsFile /dev/null
+EOF
+}
+
 function start_services {
   start zookeeper
   start mesos-master
@@ -98,5 +108,6 @@ prepare_sources
 install_mesos
 prepare_extras
 install_cluster_config
+install_ssh_config
 start_services
 aurorabuild client client2 admin_client executor observer scheduler

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/7d6b246c/examples/vagrant/upstart/mesos-slave.conf
----------------------------------------------------------------------
diff --git a/examples/vagrant/upstart/mesos-slave.conf b/examples/vagrant/upstart/mesos-slave.conf
index e53d545..512ce7e 100644
--- a/examples/vagrant/upstart/mesos-slave.conf
+++ b/examples/vagrant/upstart/mesos-slave.conf
@@ -20,8 +20,12 @@ env MY_HOST=192.168.33.7
 env ZK_HOST=192.168.33.7
 
 # TODO(ksweeney): Scheduler assumes 'rack' and 'host' are present. Make them optional.
+# N.B. The value for --work_dir must match the value configured for the slave_root in
+# examples/vagrant/provision-dev-cluster.sh. C.f. AURORA-680 for the client fix to
+# obviate that need.
 exec /usr/local/sbin/mesos-slave --master=zk://$ZK_HOST:2181/mesos/master \
   --ip=$MY_HOST \
   --hostname=$MY_HOST \
   --attributes="host:$MY_HOST;rack:a" \
-  --resources="cpus:4;mem:1024;disk:20000"
+  --resources="cpus:4;mem:1024;disk:20000" \
+  --work_dir="/var/lib/mesos"

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/7d6b246c/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 fa5568e..989801c 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
@@ -43,12 +43,14 @@ test_http_example() {
   echo '== Validating announce'
   validate_serverset "/aurora/$_role/$_env/$_job"
 
-  #echo "== Probing job via 'aurora run'"
-  # 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=$(vagrant ssh -c "aurora run $jobkey 'pwd'" | wc -l)
-  test $runlen -eq 4
+  echo "== Probing job via 'aurora run'"
+  # In order for `aurora run` to work, the VM needs to be forwarded a local ssh identity.
To avoid
+  # polluting the global ssh-agent with this identity, we run this test in the context of
a local
+  # agent. A slightly cleaner solution would be to use a here doc (ssh-agent sh <<EOF
...), but
+  # due to a strange confluence of issues, this required some unpalatable hacks. Simply putting
+  # the meat of this test in a separate file seems preferable.
+  ssh-agent src/test/sh/org/apache/aurora/e2e/test_run.sh $jobkey $_sched_ip "aurora run"
+  test $? -eq 0
 
   vagrant ssh -c "aurora get_quota --cluster=$_cluster $_role"
   vagrant ssh -c "aurora killall  $jobkey"

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/7d6b246c/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
index 6dff70e..0965b5c 100755
--- 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
@@ -61,11 +61,13 @@ test_http_example() {
   echo '== Validating announce'
   validate_serverset "/aurora/$_role/$_env/$_job"
 
-  # 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=$(vagrant ssh -c "aurora2 task run $jobkey 'pwd'" | wc -l)
-  test $runlen -eq 4
+  # In order for `aurora task run` to work, the VM needs to be forwarded a local ssh identity.
To avoid
+  # polluting the global ssh-agent with this identity, we run this test in the context of
a local
+  # agent. A slightly cleaner solution would be to use a here doc (ssh-agent sh <<EOF
...), but
+  # due to a strange confluence of issues, this required some unpalatable hacks. Simply putting
+  # the meat of this test in a separate file seems preferable.
+  ssh-agent src/test/sh/org/apache/aurora/e2e/test_run.sh $jobkey $_sched_ip
+  test $? -eq 0
 
   # Run a kill without specifying instances, and verify that it gets an error, and the job
   # isn't affected. (TODO(mchucarroll): the failed kill should return non-zero!)

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/7d6b246c/src/test/sh/org/apache/aurora/e2e/test_run.sh
----------------------------------------------------------------------
diff --git a/src/test/sh/org/apache/aurora/e2e/test_run.sh b/src/test/sh/org/apache/aurora/e2e/test_run.sh
new file mode 100755
index 0000000..c3822ad
--- /dev/null
+++ b/src/test/sh/org/apache/aurora/e2e/test_run.sh
@@ -0,0 +1,30 @@
+#!/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.
+#
+#
+# Test aurora run/aurora2 task run. This script is meant to be run within an ssh-agent to
+# avoid polluting the global ssh-agent w/ the vagrant private key.
+
+set -u -e -x
+
+jobkey=$1
+scheduler_ip=$2
+aurora_command=${3:-"aurora2 task run"}
+
+ssh-add $HOME/.vagrant.d/insecure_private_key
+vagrant ssh -c "$aurora_command $jobkey 'pwd'" -- -A -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
\
+  | grep "^$scheduler_ip" | awk '{print $2}' | cut -c 1-14 \
+  | while read line; do
+    test "$line" = "/var/lib/mesos"
+  done


Mime
View raw message