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/03/04 21:05:39 UTC

incubator-aurora git commit: Add an end-to-end test for scheduler-driven job updates.

Repository: incubator-aurora
Updated Branches:
  refs/heads/master 9791efc0a -> 99d7aa7de


Add an end-to-end test for scheduler-driven job updates.

Bugs closed: AURORA-1157

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


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

Branch: refs/heads/master
Commit: 99d7aa7def8b52752e6fcab7fa614f018a1e83df
Parents: 9791efc
Author: Bill Farner <wf...@apache.org>
Authored: Wed Mar 4 12:04:11 2015 -0800
Committer: Bill Farner <wf...@apache.org>
Committed: Wed Mar 4 12:04:39 2015 -0800

----------------------------------------------------------------------
 .../sh/org/apache/aurora/e2e/test_end_to_end.sh | 56 +++++++++++++++++++-
 1 file changed, 54 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/99d7aa7d/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 6a75528..2168491 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
@@ -35,6 +35,7 @@ tear_down() {
 
   for job in http_example http_example_docker; do
     aurora job cancel-update devcluster/vagrant/test/$job >/dev/null 2>&1
+    aurora beta-update abort devcluster/vagrant/test/$job || true >/dev/null 2>&1
     aurora job killall --no-batching devcluster/vagrant/test/$job >/dev/null 2>&1
   done
 }
@@ -129,12 +130,62 @@ test_restart() {
   aurora job restart --batch-size=2 $_jobkey
 }
 
-test_update() {
+test_legacy_update() {
   local _jobkey=$1 _config=$2
 
   aurora job update $_jobkey $_config
 }
 
+assert_update_state() {
+  local _jobkey=$1 _expected_state=$2
+
+  local _state=$(aurora beta-update status $_jobkey | grep 'Current status' | awk '{print $NF}')
+  if [ $_state != $_expected_state ]; then
+    echo "Expected update to be in state $_expected_state, but found $_state"
+    exit 1
+  fi
+}
+
+await_update_finished() {
+  local _jobkey=$1
+
+  local _matched=0
+  for i in $(seq 1 120); do
+    if [ $(aurora beta-update status $_jobkey | grep 'Current status' | wc -l) -eq 0 ]; then
+      _matched=1
+      break
+    else
+      sleep 1
+    fi
+  done
+
+  if [ $_matched -ne 1 ]; then
+    echo "Timed out while waiting for update $_jobkey"
+    exit 1
+  fi
+}
+
+test_update() {
+  local _jobkey=$1 _config=$2 _cluster=$3
+
+  aurora beta-update start $_jobkey $_config
+  assert_update_state $_jobkey 'ROLLING_FORWARD'
+  aurora beta-update pause $_jobkey
+  assert_update_state $_jobkey 'ROLL_FORWARD_PAUSED'
+  aurora beta-update resume $_jobkey
+  assert_update_state $_jobkey 'ROLLING_FORWARD'
+
+  await_update_finished $_jobkey
+
+  # Check that the update ended in ROLLED_FORWARD state.  Assumes the status is the last column.
+  local status=$(aurora beta-update list --job $_jobkey $_cluster | grep -m 1 Status \
+      | awk '{print $NF}')
+  if [ $status != "ROLLED_FORWARD" ]; then
+    echo "Update should have completed in ROLLED_FORWARD state"
+    exit 1
+  fi
+}
+
 test_announce() {
   local _role=$1 _env=$2 _job=$3
 
@@ -202,9 +253,10 @@ test_http_example() {
   test_scheduler_ui $_role $_env $_job
   test_observer_ui $_cluster $_role $_job
   test_restart $_jobkey
-  test_update $_jobkey $_updated_config
+  test_update $_jobkey $_updated_config $_cluster
   test_announce $_role $_env $_job
   test_run $_jobkey
+  test_legacy_update $_jobkey $_base_config
   test_kill $_jobkey
   test_quota $_cluster $_role
 }