diff options
| author | kjnilsson <knilsson@pivotal.io> | 2016-09-06 16:10:43 +0100 |
|---|---|---|
| committer | kjnilsson <knilsson@pivotal.io> | 2016-09-06 16:10:43 +0100 |
| commit | f1fd9731c638f1217e7e4eb10c39ecb17ba2e360 (patch) | |
| tree | ebab168b4c5c7f09c12779c6c954210a98172903 /test | |
| parent | c9feeffc94d87f80b3060db1a087a47abbbecb35 (diff) | |
| download | rabbitmq-server-git-f1fd9731c638f1217e7e4eb10c39ecb17ba2e360.tar.gz | |
ensure properties validate the number of things created
Diffstat (limited to 'test')
| -rw-r--r-- | test/metrics_SUITE.erl | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/test/metrics_SUITE.erl b/test/metrics_SUITE.erl index faea55f7aa..7771d91240 100644 --- a/test/metrics_SUITE.erl +++ b/test/metrics_SUITE.erl @@ -88,17 +88,11 @@ read_table(Table) -> % node_stats tests are in the management_agent repo properties(Config) -> - PropErConf = [{numtests, 25}, - {on_output, fun(".", _) -> ok; % don't print the '.'s on new lines - (F, A) -> - ct:pal(?LOW_IMPORTANCE, F, A) - end}], - true = proper:quickcheck(prop_connection_metric_count(Config), PropErConf), - true = proper:quickcheck(prop_channel_metric_count(Config), PropErConf), - true = proper:quickcheck(prop_queue_metric_count(Config), - lists:keyreplace(numtests, 1, PropErConf, {numtests, 5})), - true = proper:quickcheck(prop_queue_metric_count_channel_per_queue(Config), - lists:keyreplace(numtests, 1, PropErConf, {numtests, 5})). + rabbit_proper_helpers:run_proper(fun prop_connection_metric_count/1, [Config], 25), + rabbit_proper_helpers:run_proper(fun prop_channel_metric_count/1, [Config], 25), + rabbit_proper_helpers:run_proper(fun prop_queue_metric_count/1, [Config], 5), + rabbit_proper_helpers:run_proper(fun prop_queue_metric_count_channel_per_queue/1, + [Config], 5). prop_connection_metric_count(Config) -> ?FORALL(N, {integer(1, 25), oneof([add, remove]), integer(0, 9)}, @@ -183,18 +177,18 @@ queue_metric_count_channel_per_queue(Config, X) -> add_rem_counter(Config, {Num, AddRem, Change}, {AddFun, RemFun}, Tables) -> Things = [ AddFun(Config) || _ <- lists:seq(1, Num) ], % either add or remove some things - Things1 = + {FinalLen, Things1} = case AddRem of add -> - Things ++ [ AddFun(Config) || _ <- lists:seq(1, Change) ]; + {Num + Change, Things ++ [ AddFun(Config) || _ <- lists:seq(1, Change) ]}; remove -> Sub = lists:sublist(Things, Change), [ RemFun(Thing) || Thing <- Sub ], - Things -- Sub + {max(Num - Change, 0), Things -- Sub} end, TabLens = lists:map(fun(T) -> length(read_table_rpc(Config, T)) end, Tables), [ RemFun(Thing) || Thing <- Things1 ], - 1 == length(lists:usort(TabLens)). + [FinalLen] == lists:usort(TabLens). connection(Config) -> |
