Repository: aurora Updated Branches: refs/heads/master 8b9a3649a -> 084a62258
Add an end-to-end test for HTTP basic auth. Testing Done: src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh Bugs closed: AURORA-810 Reviewed at https://reviews.apache.org/r/33048/ Project: http://git-wip-us.apache.org/repos/asf/aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/084a6225 Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/084a6225 Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/084a6225 Branch: refs/heads/master Commit: 084a622586b06227c8741db4a91f05c15e3a1573 Parents: 8b9a364 Author: Kevin Sweeney <[email protected]> Authored: Fri Apr 10 15:29:31 2015 -0700 Committer: Kevin Sweeney <[email protected]> Committed: Fri Apr 10 15:29:31 2015 -0700 ---------------------------------------------------------------------- examples/vagrant/aurorabuild.sh | 5 ++--- examples/vagrant/provision-dev-cluster.sh | 16 ++++++++++++-- examples/vagrant/upstart/aurora-scheduler.conf | 12 ++++++----- src/dist/etc/shiro.example.ini | 22 ++++++++++++++++++++ .../sh/org/apache/aurora/e2e/test_end_to_end.sh | 13 +++++++++++- 5 files changed, 57 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora/blob/084a6225/examples/vagrant/aurorabuild.sh ---------------------------------------------------------------------- diff --git a/examples/vagrant/aurorabuild.sh b/examples/vagrant/aurorabuild.sh index 47baa4e..f11488a 100755 --- a/examples/vagrant/aurorabuild.sh +++ b/examples/vagrant/aurorabuild.sh @@ -22,7 +22,6 @@ set -o nounset REPO_DIR=/home/vagrant/aurora DIST_DIR=$REPO_DIR/dist -AURORA_HOME=/usr/local/aurora function upstart_update { # Stop and start is necessary to update a the configuration of @@ -47,8 +46,8 @@ function build_scheduler { ./gradlew installDist export LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server - sudo mkdir -p $AURORA_HOME/scheduler - if sudo mesos-log initialize --path="$AURORA_HOME/scheduler/db" + sudo mkdir -p /var/db/aurora + if sudo mesos-log initialize --path="/var/db/aurora" then echo "Replicated log initialized." else http://git-wip-us.apache.org/repos/asf/aurora/blob/084a6225/examples/vagrant/provision-dev-cluster.sh ---------------------------------------------------------------------- diff --git a/examples/vagrant/provision-dev-cluster.sh b/examples/vagrant/provision-dev-cluster.sh index e88efc3..73cd7d7 100755 --- a/examples/vagrant/provision-dev-cluster.sh +++ b/examples/vagrant/provision-dev-cluster.sh @@ -32,11 +32,13 @@ apt-get -y install \ # Ensure java 7 is the default java. update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java +readonly IP_ADDRESS=192.168.33.7 + # Set the hostname to the IP address. This simplifies things for components # that want to advertise the hostname to the user, or other components. -hostname 192.168.33.7 +hostname $IP_ADDRESS -MESOS_VERSION=0.21.1 +readonly MESOS_VERSION=0.21.1 function prepare_extras() { pushd aurora @@ -90,6 +92,15 @@ EOF chown vagrant:vagrant /home/vagrant/.gradle/gradle.properties } +function configure_netrc { + cat > /home/vagrant/.netrc <<EOF +machine $IP_ADDRESS +login aurora +password secret +EOF + chown vagrant:vagrant /home/vagrant/.netrc +} + function start_services { #Executing true on failure to please bash -e in case services are already running start zookeeper || true @@ -116,4 +127,5 @@ install_cluster_config install_ssh_config start_services enable_gradle_daemon +configure_netrc su vagrant -c "aurorabuild all" http://git-wip-us.apache.org/repos/asf/aurora/blob/084a6225/examples/vagrant/upstart/aurora-scheduler.conf ---------------------------------------------------------------------- diff --git a/examples/vagrant/upstart/aurora-scheduler.conf b/examples/vagrant/upstart/aurora-scheduler.conf index 1090bd8..82ad42f 100644 --- a/examples/vagrant/upstart/aurora-scheduler.conf +++ b/examples/vagrant/upstart/aurora-scheduler.conf @@ -19,13 +19,13 @@ post-stop exec sleep 5 env GLOG_v=0 env LIBPROCESS_PORT=8083 env LIBPROCESS_IP=192.168.33.7 -env AURORA_HOME=/usr/local/aurora env DIST_DIR=/home/vagrant/aurora/dist # Flags that control the behavior of the JVM. env JAVA_OPTS='-Djava.library.path=/usr/lib -Dlog4j.configuration="file:///etc/zookeeper/conf/log4j.properties"' -exec $DIST_DIR/install/aurora-scheduler/bin/aurora-scheduler \ +chdir /home/vagrant/aurora/dist/install/aurora-scheduler +exec bin/aurora-scheduler \ -cluster_name=example \ -http_port=8081 \ -native_log_quorum_size=1 \ @@ -33,11 +33,13 @@ exec $DIST_DIR/install/aurora-scheduler/bin/aurora-scheduler \ -mesos_master_address=zk://localhost:2181/mesos/master \ -serverset_path=/aurora/scheduler \ -native_log_zk_group_path=/aurora/replicated-log \ - -native_log_file_path=$AURORA_HOME/scheduler/db \ - -backup_dir=$AURORA_HOME/scheduler/backups \ + -native_log_file_path=/var/db/aurora \ + -backup_dir=/var/lib/aurora/backups \ -thermos_executor_path=$DIST_DIR/thermos_executor.pex \ -thermos_executor_flags="--announcer-enable --announcer-ensemble localhost:2181" \ -gc_executor_path=$DIST_DIR/gc_executor.pex \ -vlog=INFO \ -logtostderr \ - -allowed_container_types=MESOS,DOCKER + -allowed_container_types=MESOS,DOCKER \ + -enable_api_security=true \ + -shiro_ini_path=etc/shiro.example.ini http://git-wip-us.apache.org/repos/asf/aurora/blob/084a6225/src/dist/etc/shiro.example.ini ---------------------------------------------------------------------- diff --git a/src/dist/etc/shiro.example.ini b/src/dist/etc/shiro.example.ini new file mode 100644 index 0000000..40de36f --- /dev/null +++ b/src/dist/etc/shiro.example.ini @@ -0,0 +1,22 @@ +# 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. +# +# Example shiro.ini. +# For a reference on how to configure this, see +# http://shiro.apache.org/configuration.html#Configuration-INISections +# Note that only the [users] and [roles] sections are supported, configuration of protected urls +# and the objects Shiro uses is done via command-line flags or deliberately left unconfigurable. +[users] +aurora = secret, admin + +[roles] +admin = * http://git-wip-us.apache.org/repos/asf/aurora/blob/084a6225/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 f3c9d82..cc7cdee 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 @@ -26,7 +26,7 @@ fi set -u -e -x set -o pipefail -TEST_SCHEDULER_IP=192.168.33.7 +readonly TEST_SCHEDULER_IP=192.168.33.7 _curl() { curl --silent --fail --retry 4 --retry-delay 10 "$@" ; } @@ -271,6 +271,16 @@ test_admin() { aurora_admin get_scheduler $_cluster | grep ":8081" } +readonly RPC_DATA="[1,\"snapshot\",1,0,{}]" +test_basic_auth_unauthenticated() { + # TODO(ksweeney): Replace this with a call to the client removing the .netrc when AURORA-1248 is + # fixed. + [[ 401 == $(curl -w '%{http_code}\n' \ + -o /dev/null \ + -s 'http://localhost:8081/api' \ + --data-binary "$RPC_DATA") ]] +} + RETCODE=1 # Set up shorthands for test export TEST_ROOT=/vagrant/src/test/sh/org/apache/aurora/e2e @@ -314,6 +324,7 @@ sudo docker build -t http_example ${TEST_ROOT} test_http_example "${TEST_DOCKER_ARGS[@]}" test_admin "${TEST_ADMIN_ARGS[@]}" +test_basic_auth_unauthenticated /vagrant/src/test/sh/org/apache/aurora/e2e/test_kerberos_end_to_end.sh RETCODE=0
