Skip to content

Commit

Permalink
merge complete, compiles, but pre-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
evanmcc committed Apr 1, 2014
2 parents c86e153 + 1b7a65d commit 9c5df56
Show file tree
Hide file tree
Showing 76 changed files with 6,056 additions and 1,143 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ deps
ebin
log
riak_test
smoke_test
.eunit
.DS_Store
out
Expand All @@ -13,4 +14,5 @@ doc/
!doc/overview.edoc
*.jar
coverage

tags
riak-*
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PLT = $(HOME)/.riak-test_dialyzer_plt

all: deps compile
./rebar skip_deps=true escriptize
SMOKE_TEST=1 ./rebar skip_deps=true escriptize

deps:
./rebar get-deps
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ them with. The example above would result in all calls to

To add the `dropped_put` intercept manually you would do the following.

`rt_intercept:add(Node, {riak_kv_vnode, [{{put,7}, dropped_put}]})`
rt_intercept:add(Node, {riak_kv_vnode, [{{put,7}, dropped_put}]})

### How Does it Work?

Expand Down Expand Up @@ -374,3 +374,15 @@ the config survive restarts and are essentially always in play. A
user can also manually add an intercept by making an `rpc` call from
the test code to the remote node. This method is ephemeral and the
intercept will not survive restarts.


#### Shell Completion

##### Bash

To have bash shell complete test names, source the `utils/riak_test.bash` file.

##### Zsh

put `utils/riak_test.zsh` somewhere on `$fpath`.

30 changes: 21 additions & 9 deletions bin/rtdev-setup-releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,31 @@ echo " - Creating $RT_DEST_DIR"

rm -rf $RT_DEST_DIR
mkdir -p $RT_DEST_DIR
for rel in */dev; do
vsn=$(dirname "$rel")
echo " - Initializing $RT_DEST_DIR/$vsn"
mkdir -p "$RT_DEST_DIR/$vsn"
cp -p -P -R "$rel" "$RT_DEST_DIR/$vsn"
done

count=$(ls */dev 2> /dev/null | wc -l)
if [ "$count" -ne "0" ]
then
for rel in */dev; do
vsn=$(dirname "$rel")
echo " - Initializing $RT_DEST_DIR/$vsn"
mkdir -p "$RT_DEST_DIR/$vsn"
cp -p -P -R "$rel" "$RT_DEST_DIR/$vsn"
done
else
# This is useful when only testing with 'current'
# The repo still needs to be initialized for current
# and we don't want to bomb out if */dev doesn't exist
touch $RT_DEST_DIR/.current_init
echo "No devdirs found. Not copying any releases."
fi

cd $RT_DEST_DIR
echo " - Creating the git repository"
git init > /dev/null 2>&1
git init

## Some versions of git and/or OS require these fields
git config user.name "Riak Test"
git config user.email "[email protected]"

git add .
git commit -a -m "riak_test init" > /dev/null 2>&1
git commit -a -m "riak_test init" > /dev/null
echo " - Successfully completed initial git commit of $RT_DEST_DIR"
242 changes: 242 additions & 0 deletions intercepts/riak_core_console_intercepts.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
%% -------------------------------------------------------------------
%%
%% Copyright (c) 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(riak_core_console_intercepts).
-compile(export_all).
-include("intercept.hrl").

%% See tests/riak_admin_console_tests.erl for more info

-define(M, riak_core_console_orig).


-define(PASS, io:format("pass", [])).
-define(FAIL, io:format("fail", [])).

verify_console_stage_leave(Val) ->
case Val of
[] -> ?PASS;
["[email protected]"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_stage_remove(Val) ->
case Val of
["[email protected]"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_stage_replace(Val) ->
case Val of
["[email protected]","[email protected]"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_stage_force_replace(Val) ->
case Val of
["[email protected]","[email protected]"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_stage_resize_ring(Val) ->
case Val of
["abort"] -> ?PASS;
["42"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_print_staged(Val) ->
case Val of
[] -> ?PASS;
_ -> ?FAIL
end.

verify_console_commit_staged(Val) ->
case Val of
[] -> ?PASS;
_ -> ?FAIL
end.

verify_console_clear_staged(Val) ->
case Val of
[] -> ?PASS;
_ -> ?FAIL
end.

verify_console_add_user(Val) ->
case Val of
["foo"] -> ?PASS;
["foo", "x1=y1", "x2=y2"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_alter_user(Val) ->
case Val of
["foo", "x1=y1"] -> ?PASS;
["foo", "x1=y1", "x2=y2"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_del_user(Val) ->
case Val of
["foo"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_add_group(Val) ->
case Val of
["group"] -> ?PASS;
["group", "x1=y1", "x2=y2"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_alter_group(Val) ->
case Val of
["group", "x1=y1", "x2=y2"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_del_group(Val) ->
case Val of
["group"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_add_source(Val) ->
case Val of
["all","192.168.100.0/22","x","x1=y1"] -> ?PASS;
["all","192.168.100.0/22","y"] -> ?PASS;
["foo,bar","192.168.100.0/22","x","x1=y1"] -> ?PASS;
["foo,bar,baz","192.168.100.0/22","x","x1=y1","x2=y2"] -> ?PASS;
_ -> ?FAIL
end.


verify_console_del_source(Val) ->
case Val of
["all","192.168.100.0/22"] -> ?PASS;
["x","192.168.100.0/22"] -> ?PASS;
["x,y,z","192.168.100.0/22"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_grant(Val) ->
case Val of
["foo","on","any","my_bucket","to","x"] -> ?PASS;
["foo,bar","on","any","my_bucket","to","x"] -> ?PASS;
["foo","on","any","my_bucket","to","x,y,z"] -> ?PASS;
["foo,bar,baz","on","any","my_bucket","to","y"] -> ?PASS;
["foo,bar,baz","on","foo","my_bucket","to","y"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_revoke(Val) ->
case Val of
["foo","on","any","my_bucket","from","x"] -> ?PASS;
["foo,bar","on","any","my_bucket","from","x"] -> ?PASS;
["foo","on","any","my_bucket","from","x,y,z"] -> ?PASS;
["foo,bar,baz","on","any","my_bucket","from","y"] -> ?PASS;
["foo,bar,baz","on","foo","my_bucket","from","y"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_print_user(Val) ->
case Val of
["foo"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_print_users(Val) ->
case Val of
[] -> ?PASS;
_ -> ?FAIL
end.

verify_console_print_group(Val) ->
case Val of
["group"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_print_groups(Val) ->
case Val of
[] -> ?PASS;
_ -> ?FAIL
end.

verify_console_print_grants(Val) ->
case Val of
["foo"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_print_sources(Val) ->
case Val of
[] -> ?PASS;
_ -> ?FAIL
end.

verify_console_security_enable(Val) ->
case Val of
[] -> ?PASS;
_ -> ?FAIL
end.

verify_console_security_disable(Val) ->
case Val of
[] -> ?PASS;
_ -> ?FAIL
end.

verify_console_security_stats(Val) ->
case Val of
[] -> ?PASS;
_ -> ?FAIL
end.

verify_console_ciphers(Val) ->
case Val of
["foo"] -> ?PASS;
_ -> ?FAIL
end.

verify_console_transfers(Val) ->
case Val of
[] -> ?PASS;
_ -> ?FAIL
end.

verify_console_member_status(Val) ->
case Val of
[] -> ?PASS;
_ -> ?FAIL
end.

verify_console_ring_status(Val) ->
case Val of
[] -> ?PASS;
_ -> ?FAIL
end.

verify_console_transfer_limit(Val) ->
case Val of
["1"] -> ?PASS;
["[email protected]", "1"] -> ?PASS;
_ -> ?FAIL
end.
Loading

0 comments on commit 9c5df56

Please sign in to comment.