Repository: aurora Updated Branches: refs/heads/master 8fca74501 -> 87ae96802
Update e2e tests to verify running a docker image via the unified containerizer. Reviewed at https://reviews.apache.org/r/51746/ Project: http://git-wip-us.apache.org/repos/asf/aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/87ae9680 Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/87ae9680 Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/87ae9680 Branch: refs/heads/master Commit: 87ae968029c37d35381507d85b8a236b1c030a6d Parents: 8fca745 Author: Joshua Cohen <jco...@apache.org> Authored: Thu Sep 8 17:21:40 2016 -0500 Committer: Joshua Cohen <jco...@apache.org> Committed: Thu Sep 8 17:21:40 2016 -0500 ---------------------------------------------------------------------- .../etc_mesos-slave/docker_registry | 1 + .../etc_mesos-slave/image_providers | 2 +- .../mesos_config/etc_mesos-slave/isolation | 2 +- .../apache/aurora/e2e/http/http_example.aurora | 7 +++- .../http/http_example_bad_healthcheck.aurora | 7 +++- .../aurora/e2e/http/http_example_updated.aurora | 7 +++- .../sh/org/apache/aurora/e2e/test_end_to_end.sh | 35 ++++++++++++++++---- 7 files changed, 50 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora/blob/87ae9680/examples/vagrant/mesos_config/etc_mesos-slave/docker_registry ---------------------------------------------------------------------- diff --git a/examples/vagrant/mesos_config/etc_mesos-slave/docker_registry b/examples/vagrant/mesos_config/etc_mesos-slave/docker_registry new file mode 100644 index 0000000..964ba30 --- /dev/null +++ b/examples/vagrant/mesos_config/etc_mesos-slave/docker_registry @@ -0,0 +1 @@ +/tmp/mesos/images/docker http://git-wip-us.apache.org/repos/asf/aurora/blob/87ae9680/examples/vagrant/mesos_config/etc_mesos-slave/image_providers ---------------------------------------------------------------------- diff --git a/examples/vagrant/mesos_config/etc_mesos-slave/image_providers b/examples/vagrant/mesos_config/etc_mesos-slave/image_providers index 7168c0c..4da2f0d 100644 --- a/examples/vagrant/mesos_config/etc_mesos-slave/image_providers +++ b/examples/vagrant/mesos_config/etc_mesos-slave/image_providers @@ -1 +1 @@ -appc +appc,docker http://git-wip-us.apache.org/repos/asf/aurora/blob/87ae9680/examples/vagrant/mesos_config/etc_mesos-slave/isolation ---------------------------------------------------------------------- diff --git a/examples/vagrant/mesos_config/etc_mesos-slave/isolation b/examples/vagrant/mesos_config/etc_mesos-slave/isolation index c362230..1a7028f 100644 --- a/examples/vagrant/mesos_config/etc_mesos-slave/isolation +++ b/examples/vagrant/mesos_config/etc_mesos-slave/isolation @@ -1 +1 @@ -filesystem/linux +filesystem/linux,docker/runtime http://git-wip-us.apache.org/repos/asf/aurora/blob/87ae9680/src/test/sh/org/apache/aurora/e2e/http/http_example.aurora ---------------------------------------------------------------------- diff --git a/src/test/sh/org/apache/aurora/e2e/http/http_example.aurora b/src/test/sh/org/apache/aurora/e2e/http/http_example.aurora index 042424d..290627f 100644 --- a/src/test/sh/org/apache/aurora/e2e/http/http_example.aurora +++ b/src/test/sh/org/apache/aurora/e2e/http/http_example.aurora @@ -104,8 +104,13 @@ jobs = [ name = 'http_example_gpu' ).bind(profile=GpuProfile), job( - name = 'http_example_appc', + name = 'http_example_unified_appc', container = Mesos(image=AppcImage(name='http_example_netcat', image_id='{{appc_image_id}}')), task = no_python_task + ).bind(profile=DefaultProfile()), + job( + name = 'http_example_unified_docker', + container = Mesos(image=DockerImage(name='http_example_netcat', tag='latest')), + task = no_python_task ).bind(profile=DefaultProfile()) ] http://git-wip-us.apache.org/repos/asf/aurora/blob/87ae9680/src/test/sh/org/apache/aurora/e2e/http/http_example_bad_healthcheck.aurora ---------------------------------------------------------------------- diff --git a/src/test/sh/org/apache/aurora/e2e/http/http_example_bad_healthcheck.aurora b/src/test/sh/org/apache/aurora/e2e/http/http_example_bad_healthcheck.aurora index f80f2b1..4fa387d 100644 --- a/src/test/sh/org/apache/aurora/e2e/http/http_example_bad_healthcheck.aurora +++ b/src/test/sh/org/apache/aurora/e2e/http/http_example_bad_healthcheck.aurora @@ -92,8 +92,13 @@ jobs = [ name = 'http_example_gpu' ).bind(profile=GpuProfile), job( - name = 'http_example_appc', + name = 'http_example_unified_appc', container = Mesos(image=AppcImage(name='http_example_netcat', image_id='{{appc_image_id}}')), task = no_python_task + ).bind(profile=DefaultProfile()), + job( + name = 'http_example_unified_docker', + container = Mesos(image=DockerImage(name='http_example_netcat', tag='latest')), + task = no_python_task ).bind(profile=DefaultProfile()) ] http://git-wip-us.apache.org/repos/asf/aurora/blob/87ae9680/src/test/sh/org/apache/aurora/e2e/http/http_example_updated.aurora ---------------------------------------------------------------------- diff --git a/src/test/sh/org/apache/aurora/e2e/http/http_example_updated.aurora b/src/test/sh/org/apache/aurora/e2e/http/http_example_updated.aurora index 4a95bc3..b279b4f 100644 --- a/src/test/sh/org/apache/aurora/e2e/http/http_example_updated.aurora +++ b/src/test/sh/org/apache/aurora/e2e/http/http_example_updated.aurora @@ -78,8 +78,13 @@ jobs = [ name = 'http_example_gpu' ).bind(profile=GpuProfile), job( - name = 'http_example_appc', + name = 'http_example_unified_appc', container = Mesos(image=AppcImage(name='http_example_netcat', image_id='{{appc_image_id}}')), task = no_python_task + ).bind(profile=DefaultProfile()), + job( + name = 'http_example_unified_docker', + container = Mesos(image=DockerImage(name='http_example_netcat', tag='latest')), + task = no_python_task ).bind(profile=DefaultProfile()) ] http://git-wip-us.apache.org/repos/asf/aurora/blob/87ae9680/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 d81abe1..97677f2 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 @@ -33,7 +33,7 @@ _curl() { curl --silent --fail --retry 4 --retry-delay 10 "$@" ; } tear_down() { set +x # Disable command echo, as this makes it more difficult see which command failed. - for job in http_example http_example_revocable http_example_docker; do + for job in http_example http_example_revocable http_example_docker http_example_unified_appc http_example_unified_docker; do aurora 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 @@ -408,16 +408,23 @@ test_basic_auth_unauthenticated() { restore_netrc } -test_appc() { +setup_image_stores() { TEMP_PATH=$(mktemp -d) pushd "$TEMP_PATH" - # build the appc image from the docker image + # build the docker image and save it as a tarball. sudo docker build -t http_example_netcat -f "${TEST_ROOT}/Dockerfile.netcat" ${TEST_ROOT} docker save -o http_example_netcat-latest.tar http_example_netcat + + DOCKER_IMAGE_DIRECTORY="/tmp/mesos/images/docker" + sudo mkdir -p "$DOCKER_IMAGE_DIRECTORY" + sudo cp http_example_netcat-latest.tar "$DOCKER_IMAGE_DIRECTORY/http_example_netcat:latest.tar" + + # build the appc image from the docker image docker2aci http_example_netcat-latest.tar APPC_IMAGE_ID="sha512-$(sha512sum http_example_netcat-latest.aci | awk '{print $1}')" + export APPC_IMAGE_ID APPC_IMAGE_DIRECTORY="/tmp/mesos/images/appc/images/$APPC_IMAGE_ID" sudo mkdir -p "$APPC_IMAGE_DIRECTORY" @@ -427,10 +434,12 @@ test_appc() { popd rm -rf "$TEMP_PATH" +} +test_appc_unified() { num_mounts_before=$(mount |wc -l |tr -d '\n') - TEST_JOB_APPC_ARGS=("${BASE_ARGS[@]}" "$TEST_JOB_APPC" "--bind appc_image_id=$APPC_IMAGE_ID") + TEST_JOB_APPC_ARGS=("${BASE_ARGS[@]}" "$TEST_JOB_UNIFIED_APPC" "--bind appc_image_id=$APPC_IMAGE_ID") test_http_example "${TEST_JOB_APPC_ARGS[@]}" num_mounts_after=$(mount |wc -l |tr -d '\n') @@ -438,6 +447,17 @@ test_appc() { [[ "$num_mounts_before" = "$num_mounts_after" ]] } +test_docker_unified() { + num_mounts_before=$(mount |wc -l |tr -d '\n') + + TEST_JOB_DOCKER_ARGS=("${BASE_ARGS[@]}" "$TEST_JOB_UNIFIED_DOCKER") + test_http_example "${TEST_JOB_DOCKER_ARGS[@]}" + + num_mounts_after=$(mount |wc -l |tr -d '\n') + # We want to be sure that running the isolated task did not leak any mounts. + [[ "$num_mounts_before" = "$num_mounts_after" ]] +} + RETCODE=1 # Set up shorthands for test export TEST_ROOT=/vagrant/src/test/sh/org/apache/aurora/e2e @@ -450,7 +470,8 @@ TEST_JOB=http_example TEST_JOB_REVOCABLE=http_example_revocable TEST_JOB_GPU=http_example_gpu TEST_JOB_DOCKER=http_example_docker -TEST_JOB_APPC=http_example_appc +TEST_JOB_UNIFIED_APPC=http_example_unified_appc +TEST_JOB_UNIFIED_DOCKER=http_example_unified_docker TEST_CONFIG_FILE=$EXAMPLE_DIR/http_example.aurora TEST_CONFIG_UPDATED_FILE=$EXAMPLE_DIR/http_example_updated.aurora TEST_BAD_HEALTHCHECK_CONFIG_UPDATED_FILE=$EXAMPLE_DIR/http_example_bad_healthcheck.aurora @@ -501,7 +522,9 @@ test_http_example_basic "${TEST_JOB_GPU_ARGS[@]}" sudo docker build -t http_example -f "${TEST_ROOT}/Dockerfile.python" ${TEST_ROOT} test_http_example "${TEST_JOB_DOCKER_ARGS[@]}" -test_appc +setup_image_stores +test_appc_unified +test_docker_unified test_admin "${TEST_ADMIN_ARGS[@]}" test_basic_auth_unauthenticated "${TEST_JOB_ARGS[@]}"