Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tests for acls run :)

fixes #1782
  • Loading branch information...
commit 3574e1df462aa63a60dd16416a3e86871790f93e 1 parent 915e5c5
Marco authored
View
19 port.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+case $1 in
+open)
+ echo "Opening port $2"
+ sudo iptables -A INPUT -p tcp --dport $2 -j ACCEPT
+ ;;
+close)
+ echo "Closing port $2"
+ sudo iptables -A INPUT -p tcp --dport $2 -j DROP
+ ;;
+openall)
+ echo "Delete all Rules"
+ sudo iptables -F
+ ;;
+*)
+ echo "port.sh open <portnumber> \nport.sh close <portnumber> \nport.sh openall"
+esac
+
View
2  test/epheremal_ detection_SUITE.erl
@@ -37,7 +37,7 @@ groups() ->
[].
all() ->
- %%{skip, test}.
+ %% {skip, test}.
[epheremal_monitoring].
epheremal_monitoring(_Config) ->
View
6 test/ezk_highlander_SUITE.erl
@@ -39,8 +39,8 @@
-define(HIGH_SERVER, 20).
-define(HIGH_RANDOM_RANGE, 100).
--define(HIGH2_SERVER, 100).
--define(HIGH2_NUMBER,20).
+-define(HIGH2_SERVER, 70).
+-define(HIGH2_NUMBER,30).
-define(HIGH2_SLEEP_SEND_THRESHOLD,60000).
-define(HIGH2_RANDOM_RANGE, 100000).
@@ -76,7 +76,7 @@ groups() ->
[].
all() ->
- %%{skip, test}.
+ %% {skip, test}.
[high_test
, high2_test
].
View
85 test/ezk_other_functions.erl
@@ -1,85 +0,0 @@
-%%%-------------------------------------------------------------------
-%%% @author Marco <marco@gauss.gi.net>
-%%% @copyright (C) 2011, Marco
-%%% @doc
-%%%
-%%% @end
-%%% Created : 14 Apr 2011 by Marco <marco@gauss.gi.net>
-%%%-------------------------------------------------------------------
--module(ezk_other_functions).
-
--compile(export_all).
-
--include_lib("common_test/include/ct.hrl").
-
-suite() ->
- [{timetrap,{seconds,30}}].
-
-init_per_suite(Config) ->
- application:start(ezk),
- application:start(sasl),
- {ok, ConnectionPId} = ezk:start_connection(),
- [{connection_pid, ConnectionPId} | Config].
-
-end_per_suite(Config) ->
- {connection_pid, ConnectionPId} = lists:keyfind(connection_pid, 1, Config),
- ezk:end_connection(ConnectionPId, "Test finished"),
- application:stop(ezk),
- application:stop(sasl),
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, _Config) ->
- ok.
-
-init_per_testcase(_TestCase, Config) ->
- Config.
-
-end_per_testcase(_TestCase, _Config) ->
- ok.
-
-groups() ->
- [].
-
-all() ->
- {skip, test}.
- %% [help_test, acl_test].
-
-help_test(_Config) ->
- ezk:help().
-
-acl_test(Config) ->
- {connection_pid, ConPId} = lists:keyfind(connection_pid, 1, Config),
- {ok, Node} = ezk:create(ConPId, "test", "data", es,
- [{"r", "r", [r]}, {"w", "w", [w]}]),
- true = test_an_acl(ConPId, Node, "r", r),
- true = test_an_acl(ConPId, Node, "w", w),
- false = test_an_acl(ConPId, Node, "a", a),
- {ok, _I} = ezk:set_acl(ConPId, Node, [{"a","a", [a]}]),
- true = test_an_acl(ConPId, Node, "r", r),
- true = test_an_acl(ConPId, Node, "w", w),
- true = test_an_acl(ConPId, Node, "a", a).
-
-test_an_acl(ConPId, Node, String, Atom) ->
- Bin = list_to_binary(String),
- {ok, {ACLS, _I}} = ezk:get_acl(ConPId, Node),
- {Permissions, Bin, Bin} = lists:keyfind(Bin, 2, ACLS),
- is_elem(Atom, Permissions).
-
-is_elem(_Elem, []) ->
- false;
-is_elem(Elem, [First | Tail]) ->
- if
- Elem == First ->
- true;
- true ->
- is_elem(Elem, Tail)
- end.
-
-
-
-
-
-
View
120 test/ezk_other_functions_SUITE.erl
@@ -0,0 +1,120 @@
+%%%-------------------------------------------------------------------
+%%% @author Marco <marco@gauss.gi.net>
+%%% @copyright (C) 2011, Marco
+%%% @doc
+%%%
+%%% @end
+%%% Created : 14 Apr 2011 by Marco <marco@gauss.gi.net>
+%%%-------------------------------------------------------------------
+-module(ezk_other_functions_SUITE).
+
+-compile(export_all).
+
+-include_lib("common_test/include/ct.hrl").
+
+suite() ->
+ [{timetrap,{seconds,30}}].
+
+init_per_suite(Config) ->
+ application:start(ezk),
+ application:start(sasl),
+ {ok, ConnectionPId} = ezk:start_connection(),
+ [{connection_pid, ConnectionPId} | Config].
+
+end_per_suite(Config) ->
+ {connection_pid, ConnectionPId} = lists:keyfind(connection_pid, 1, Config),
+ ezk:end_connection(ConnectionPId, "Test finished"),
+ application:stop(ezk),
+ application:stop(sasl),
+ ok.
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, _Config) ->
+ ok.
+
+init_per_testcase(_TestCase, Config) ->
+ Config.
+
+end_per_testcase(_TestCase, _Config) ->
+ ok.
+
+groups() ->
+ [].
+
+all() ->
+ %% {skip, test}.
+ [help_test, acl_test].
+
+help_test(_Config) ->
+ ezk:help().
+
+acl_test(Config) ->
+ {connection_pid, ConPId} = lists:keyfind(connection_pid, 1, Config),
+ {ok, Node} = ezk:create(ConPId, "/test", "data", es,
+ [
+ {[a], "world", "anyone"}, {[w,r], "world", "anyone"}
+ ]),
+ true = test_an_acl(ConPId, Node, a),
+ true = test_an_acl(ConPId, Node, w),
+ true = test_an_acl(ConPId, Node, r),
+ false = test_an_acl(ConPId, Node, c),
+ false = test_an_acl(ConPId, Node, d),
+ {ok, {OldACLSBin, _I}} = ezk:get_acl(ConPId, Node),
+ OldACLS = make_acls_to_lists(OldACLSBin),
+ NewACLS = [ {[d], "world","anyone"} | OldACLS],
+ io:format("Setting new acls: ~w",[NewACLS]),
+ {ok, _I1} = ezk:set_acl(ConPId, Node, NewACLS),
+ io:format("ACLS set."),
+ true = test_an_acl(ConPId, Node, a),
+ true = test_an_acl(ConPId, Node, w),
+ true = test_an_acl(ConPId, Node, r),
+ false = test_an_acl(ConPId, Node, c),
+ true = test_an_acl(ConPId, Node, d).
+
+make_acls_to_lists([]) ->
+ [];
+make_acls_to_lists([{Permissions, Scheme, Id} | List]) ->
+ NewScheme = binary_to_list(Scheme),
+ NewId = binary_to_list(Id),
+ [{Permissions, NewScheme, NewId} | make_acls_to_lists(List)].
+
+test_an_acl(ConPId, Node, Atom) ->
+ {ok, {ACLS, _I}} = ezk:get_acl(ConPId, Node),
+ io:format("outer: testing for ~w in list: ~w",[Atom, ACLS]),
+ test_an_acl_list(Atom, ACLS).
+
+test_an_acl_list(_Atom, []) ->
+ false;
+test_an_acl_list(Atom, [{Permissions, Scheme, Id} | List]) ->
+ io:format("inner: testing for ~w in ~w",[Atom, Permissions]),
+ Any = list_to_binary("anyone"),
+ Wor = list_to_binary("world"),
+ case {Scheme, Id} of
+ {Wor, Any} ->
+ case is_elem(Atom, Permissions) of
+ true ->
+ true;
+ false ->
+ test_an_acl_list(Atom , List)
+ end;
+ _Else ->
+ test_an_acl_list(Atom, List)
+ end.
+
+is_elem(_Elem, []) ->
+ false;
+is_elem(Elem, [First | Tail]) ->
+ if
+ Elem == First ->
+ true;
+ true ->
+ is_elem(Elem, Tail)
+ end.
+
+
+
+
+
+
View
4 test/ezk_run_SUITE.erl
@@ -30,7 +30,7 @@
-define(RUN_ROUNDS,25).
-define(DATALENGTH, 8).
-define(PAR_RUNS, 900).
--define(MULTIRUN_RUNS, 450).
+-define(MULTIRUN_RUNS, 350).
suite() ->
@@ -67,7 +67,7 @@ groups() ->
all() ->
[rt1, rt5, rt10, rt50, rt75, rt100,
multirun_test].
- %%{skip, test}.
+ %% {skip, test}.
rt1(Config) ->
{connection_pid, ConPId} = lists:keyfind(connection_pid, 1, Config),
Please sign in to comment.
Something went wrong with that request. Please try again.