diff --git a/bin/reset-current-env.sh b/bin/reset-current-env.sh index 817a761f5..cc7a95b64 100755 --- a/bin/reset-current-env.sh +++ b/bin/reset-current-env.sh @@ -19,27 +19,33 @@ RT_BIN_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" RT_HOME="$( dirname "$RT_BIN_DIR" )" FULL_CLEAN=false VERSION="2.0" +NUM_NODES=5 usage() { echo "Resets the current riak_test environment by rebuilding riak and riak_test using rtdev-current.sh" echo " -c: Perform a devclean on the riak and clean on riak_test projects (default: $FULL_CLEAN)" + echo " -n: Number of nodes on which to test (default: $NUM_NODES)" echo " -v: The Riak version to test. The Riak home is calculated as $RT_HOME/riak- (default: $VERSION)" echo " -h: This help message" } -while getopts chv: opt; do +while getopts chn:v: opt; do case $opt in c) FULL_CLEAN=true ;; v) VERSION=$OPTARG ;; + n) echo "parsing num nodes" + NUM_NODES=$OPTARG + ;; h) usage exit 0 ;; esac - shift done +shift $(($OPTIND-1)) + RIAK_HOME=$RT_HOME/riak-$VERSION if ! [[ -d $RIAK_HOME || -h $RIAK_HOME ]]; then @@ -47,28 +53,33 @@ if ! [[ -d $RIAK_HOME || -h $RIAK_HOME ]]; then exit 1 fi -cd $RIAK_HOME +echo "Reseting the riak_test environment using RIAK_HOME=$RIAK_HOME, RT_HOME=$RT_HOME, NUM_NODES=$NUM_NODES, VERSION=$VERSION, and FULL_CLEAN=$FULL_CLEAN" -echo "Removing previous stagedevrel instance from $RIAK_HOME and rebuilding ..." +cd $RIAK_HOME # Clean out previous devrel build ... if [ "$FULL_CLEAN" = true ] ; then + echo "Cleaning Riak in $RIAK_HOME ..." make devclean else + echo "Removing previous stagedevrel instance from $RIAK_HOME and rebuilding ..." rm -rf dev fi # Rebuild Riak ... -make stagedevrel +echo "Building Riak stagedevrel with $NUM_NODES nodes in $RIAK_HOME ..." +make stagedevrel DEVNODES=$NUM_NODES $RT_HOME/bin/rtdev-current.sh -echo "Rebuilding riak_test in $RT_HOME ..." cd $RT_HOME if [ "$FULL_CLEAN" = true ] ; then + echo "Cleaning riak_test in $RT_HOME ..." make clean fi + +echo "Rebuilding riak_test in $RT_HOME ..." make # Return back to where we started ... diff --git a/tests/ensemble_start_without_aae.erl b/tests/ensemble_start_without_aae.erl new file mode 100644 index 000000000..8a6ad042d --- /dev/null +++ b/tests/ensemble_start_without_aae.erl @@ -0,0 +1,34 @@ +%% ------------------------------------------------------------------- +%% +%% Copyright (c) 2013-2014 Basho Technologies, Inc. +%% +%% This file is provided to you 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. +%% +%% ------------------------------------------------------------------- + +-module(ensemble_start_without_aae). +-export([confirm/0]). +-include_lib("eunit/include/eunit.hrl"). + +confirm() -> + + NumNodes = 5, + NVal = 5, + + Config = ensemble_util:fast_config(NVal, false), + lager:info("Building cluster with consensus enabled and AAE disabled. Waiting for ensemble to stablize ..."), + + _ = ensemble_util:build_cluster_without_quorum(NumNodes, Config), + pass. diff --git a/tests/ensemble_util.erl b/tests/ensemble_util.erl index e7b7c4737..1c5dfc632 100644 --- a/tests/ensemble_util.erl +++ b/tests/ensemble_util.erl @@ -21,6 +21,8 @@ -module(ensemble_util). -compile(export_all). +-define(DEFAULT_RING_SIZE, 16). + -include_lib("eunit/include/eunit.hrl"). build_cluster(Num, Config, NVal) -> @@ -32,21 +34,45 @@ build_cluster(Num, Config, NVal) -> ensemble_util:wait_until_stable(Node, NVal), Nodes. +build_cluster_without_quorum(Num, Config) -> + Nodes = rt:deploy_nodes(Num, Config), + SetupLogCaptureFun = fun(Node) -> + rt:setup_log_capture(Node) + end, + lists:map(SetupLogCaptureFun, Nodes), + Node = hd(Nodes), + ok = rpc:call(Node, riak_ensemble_manager, enable, []), + _ = rpc:call(Node, riak_core_ring_manager, force_update, []), + rt:join_cluster(Nodes), + ensemble_util:wait_until_cluster(Nodes), + ensemble_util:wait_for_membership(Node), + Nodes. + fast_config(NVal) -> - fast_config(NVal, 16). - -fast_config(NVal, RingSize) -> - [{riak_kv, [{anti_entropy_build_limit, {100, 1000}}, - {anti_entropy_concurrency, 100}, - {anti_entropy_tick, 100}, - {anti_entropy, {on, []}}, - {anti_entropy_timeout, 5000}, - {storage_backend, riak_kv_memory_backend}]}, + fast_config(NVal, ?DEFAULT_RING_SIZE). + +fast_config(Nval, RingSize) when is_integer(RingSize) -> + fast_config(Nval, RingSize, true); +fast_config(Nval, EnableAAE) when is_boolean(EnableAAE) -> + fast_config(Nval, ?DEFAULT_RING_SIZE, EnableAAE). + +fast_config(NVal, RingSize, EnableAAE) -> + [config_aae(EnableAAE), {riak_core, [{default_bucket_props, [{n_val, NVal}]}, {vnode_management_timer, 1000}, {ring_creation_size, RingSize}, {enable_consensus, true}]}]. +config_aae(true) -> + {riak_kv, [{anti_entropy_build_limit, {100, 1000}}, + {anti_entropy_concurrency, 100}, + {anti_entropy_tick, 100}, + {anti_entropy, {on, []}}, + {anti_entropy_timeout, 5000}, + {storage_backend, riak_kv_memory_backend}]}; +config_aae(false) -> + {riak_kv, [{anti_entropy, {off, []}}]}. + ensembles(Node) -> rpc:call(Node, riak_kv_ensembles, ensembles, []).