You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2014/06/17 00:52:45 UTC
[04/50] couchdb commit: updated refs/heads/1963-eunit to bfb7eb9
Port 121-stats-aggregates.t etap test suite to eunit
Merged into couch_stats_tests suite.
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/19c54023
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/19c54023
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/19c54023
Branch: refs/heads/1963-eunit
Commit: 19c5402311dde98a79f870d6fc3814de5503498d
Parents: 8bc52a1
Author: Alexander Shorin <kx...@apache.org>
Authored: Tue May 27 18:27:53 2014 +0400
Committer: Alexander Shorin <kx...@apache.org>
Committed: Mon Jun 16 00:51:18 2014 +0400
----------------------------------------------------------------------
test/couchdb/Makefile.am | 4 +-
test/couchdb/couch_stats_tests.erl | 225 ++++++++++++++++++-
.../couchdb/fixtures/couch_stats_aggregates.cfg | 19 ++
.../couchdb/fixtures/couch_stats_aggregates.ini | 20 ++
test/etap/121-stats-aggregates.cfg | 19 --
test/etap/121-stats-aggregates.ini | 20 --
test/etap/121-stats-aggregates.t | 171 --------------
test/etap/Makefile.am | 3 -
8 files changed, 264 insertions(+), 217 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/19c54023/test/couchdb/Makefile.am
----------------------------------------------------------------------
diff --git a/test/couchdb/Makefile.am b/test/couchdb/Makefile.am
index 25e4639..912e638 100644
--- a/test/couchdb/Makefile.am
+++ b/test/couchdb/Makefile.am
@@ -43,7 +43,9 @@ eunit_files = \
fixture_files = \
fixtures/couch_config_tests_1.ini \
- fixtures/couch_config_tests_2.ini
+ fixtures/couch_config_tests_2.ini \
+ fixtures/couch_stats_aggregates.cfg \
+ fixtures/couch_stats_aggregates.ini
EXTRA_DIST = \
run.in \
http://git-wip-us.apache.org/repos/asf/couchdb/blob/19c54023/test/couchdb/couch_stats_tests.erl
----------------------------------------------------------------------
diff --git a/test/couchdb/couch_stats_tests.erl b/test/couchdb/couch_stats_tests.erl
index aaaa687..d156449 100644
--- a/test/couchdb/couch_stats_tests.erl
+++ b/test/couchdb/couch_stats_tests.erl
@@ -15,18 +15,41 @@
-include("couch_eunit.hrl").
-include_lib("couchdb/couch_db.hrl").
+-define(STATS_CFG_FIXTURE,
+ filename:join([?FIXTURESDIR, "couch_stats_aggregates.cfg"])).
+-define(STATS_INI_FIXTURE,
+ filename:join([?FIXTURESDIR, "couch_stats_aggregates.ini"])).
-define(TIMEOUT, 1000).
--define(SLEEPTIME, 100).
+-define(TIMEWAIT, 500).
setup_collector() ->
couch_stats_collector:start(),
ok.
+setup_aggregator(_) ->
+ {ok, Pid} = couch_config:start_link([?STATS_INI_FIXTURE]),
+ {ok, _} = couch_stats_collector:start(),
+ {ok, _} = couch_stats_aggregator:start(?STATS_CFG_FIXTURE),
+ Pid.
+
teardown_collector(_) ->
couch_stats_collector:stop(),
ok.
+teardown_aggregator(_, Pid) ->
+ couch_stats_aggregator:stop(),
+ couch_stats_collector:stop(),
+ erlang:monitor(process, Pid),
+ couch_config:stop(),
+ receive
+ {'DOWN', _, _, Pid, _} ->
+ ok
+ after ?TIMEOUT ->
+ throw({timeout, config_stop})
+ end,
+ ok.
+
couch_stats_collector_test_() ->
{
@@ -51,6 +74,39 @@ couch_stats_collector_test_() ->
}
}.
+couch_stats_aggregator_test_() ->
+ Funs = [
+ fun should_init_empty_aggregate/2,
+ fun should_get_empty_aggregate/2,
+ fun should_change_stats_on_values_add/2,
+ fun should_change_stats_for_all_times_on_values_add/2,
+ fun should_change_stats_on_values_change/2,
+ fun should_change_stats_for_all_times_on_values_change/2,
+ fun should_not_remove_data_after_some_time_for_0_sample/2,
+ fun should_remove_data_after_some_time_for_other_samples/2
+ ],
+ {
+ "CouchDB stats aggregator tests",
+ [
+ {
+ "Absolute values",
+ {
+ foreachx,
+ fun setup_aggregator/1, fun teardown_aggregator/2,
+ [{absolute, Fun} || Fun <- Funs]
+ }
+ },
+ {
+ "Counters",
+ {
+ foreachx,
+ fun setup_aggregator/1, fun teardown_aggregator/2,
+ [{counter, Fun} || Fun <- Funs]
+ }
+ }
+ ]
+ }.
+
should_increment_counter() ->
?_assertEqual(100,
@@ -122,7 +178,7 @@ should_decrement_counter_on_process_exit() ->
end,
% sleep for awhile to let collector handle the updates
% suddenly, it couldn't notice process death instantly
- timer:sleep(?SLEEPTIME),
+ timer:sleep(?TIMEWAIT),
couch_stats_collector:get(hoopla)
end).
@@ -138,7 +194,7 @@ should_decrement_for_each_track_process_count_call_on_exit() ->
after ?TIMEOUT ->
throw(timeout)
end,
- timer:sleep(?SLEEPTIME),
+ timer:sleep(?TIMEWAIT),
couch_stats_collector:get(hoopla)
end).
@@ -170,6 +226,158 @@ should_return_absolute_values() ->
lists:sort(couch_stats_collector:all(absolute))
end).
+should_init_empty_aggregate(absolute, _) ->
+ {Aggs} = couch_stats_aggregator:all(),
+ ?_assertEqual({[{'11', make_agg(<<"randomosity">>,
+ null, null, null, null, null)}]},
+ couch_util:get_value(number, Aggs));
+should_init_empty_aggregate(counter, _) ->
+ {Aggs} = couch_stats_aggregator:all(),
+ ?_assertEqual({[{stuff, make_agg(<<"yay description">>,
+ null, null, null, null, null)}]},
+ couch_util:get_value(testing, Aggs)).
+
+should_get_empty_aggregate(absolute, _) ->
+ ?_assertEqual(make_agg(<<"randomosity">>, null, null, null, null, null),
+ couch_stats_aggregator:get_json({number, '11'}));
+should_get_empty_aggregate(counter, _) ->
+ ?_assertEqual(make_agg(<<"yay description">>, null, null, null, null, null),
+ couch_stats_aggregator:get_json({testing, stuff})).
+
+should_change_stats_on_values_add(absolute, _) ->
+ lists:foreach(fun(X) ->
+ couch_stats_collector:record({number, 11}, X)
+ end, lists:seq(0, 10)),
+ couch_stats_aggregator:collect_sample(),
+ ?_assertEqual(make_agg(<<"randomosity">>, 5.0, 5.0, null, 5.0, 5.0),
+ couch_stats_aggregator:get_json({number, 11}));
+should_change_stats_on_values_add(counter, _) ->
+ lists:foreach(fun(_) ->
+ couch_stats_collector:increment({testing, stuff})
+ end, lists:seq(1, 100)),
+ couch_stats_aggregator:collect_sample(),
+ ?_assertEqual(make_agg(<<"yay description">>, 100.0, 100.0, null, 100, 100),
+ couch_stats_aggregator:get_json({testing, stuff})).
+
+should_change_stats_for_all_times_on_values_add(absolute, _) ->
+ lists:foreach(fun(X) ->
+ couch_stats_collector:record({number, 11}, X)
+ end, lists:seq(0, 10)),
+ couch_stats_aggregator:collect_sample(),
+ ?_assertEqual(make_agg(<<"randomosity">>, 5.0, 5.0, null, 5.0, 5.0),
+ couch_stats_aggregator:get_json({number, 11}, 1));
+should_change_stats_for_all_times_on_values_add(counter, _) ->
+ lists:foreach(fun(_) ->
+ couch_stats_collector:increment({testing, stuff})
+ end, lists:seq(1, 100)),
+ couch_stats_aggregator:collect_sample(),
+ ?_assertEqual(make_agg(<<"yay description">>, 100.0, 100.0, null, 100, 100),
+ couch_stats_aggregator:get_json({testing, stuff}, 1)).
+
+should_change_stats_on_values_change(absolute, _) ->
+ ?_assertEqual(make_agg(<<"randomosity">>, 20.0, 10.0, 7.071, 5.0, 15.0),
+ begin
+ lists:foreach(fun(X) ->
+ couch_stats_collector:record({number, 11}, X)
+ end, lists:seq(0, 10)),
+ couch_stats_aggregator:collect_sample(),
+ timer:sleep(?TIMEWAIT),
+ couch_stats_collector:record({number, 11}, 15),
+ couch_stats_aggregator:collect_sample(),
+ couch_stats_aggregator:get_json({number, 11})
+ end);
+should_change_stats_on_values_change(counter, _) ->
+ ?_assertEqual(make_agg(<<"yay description">>, 100.0, 50.0, 70.711, 0, 100),
+ begin
+ lists:foreach(fun(_) ->
+ couch_stats_collector:increment({testing, stuff})
+ end, lists:seq(1, 100)),
+ couch_stats_aggregator:collect_sample(),
+ timer:sleep(?TIMEWAIT),
+ couch_stats_aggregator:collect_sample(),
+ couch_stats_aggregator:get_json({testing, stuff})
+ end).
+
+should_change_stats_for_all_times_on_values_change(absolute, _) ->
+ ?_assertEqual(make_agg(<<"randomosity">>, 20.0, 10.0, 7.071, 5.0, 15.0),
+ begin
+ lists:foreach(fun(X) ->
+ couch_stats_collector:record({number, 11}, X)
+ end, lists:seq(0, 10)),
+ couch_stats_aggregator:collect_sample(),
+ timer:sleep(?TIMEWAIT),
+ couch_stats_collector:record({number, 11}, 15),
+ couch_stats_aggregator:collect_sample(),
+ couch_stats_aggregator:get_json({number, 11}, 1)
+ end);
+should_change_stats_for_all_times_on_values_change(counter, _) ->
+ ?_assertEqual(make_agg(<<"yay description">>, 100.0, 50.0, 70.711, 0, 100),
+ begin
+ lists:foreach(fun(_) ->
+ couch_stats_collector:increment({testing, stuff})
+ end, lists:seq(1, 100)),
+ couch_stats_aggregator:collect_sample(),
+ timer:sleep(?TIMEWAIT),
+ couch_stats_aggregator:collect_sample(),
+ couch_stats_aggregator:get_json({testing, stuff}, 1)
+ end).
+
+should_not_remove_data_after_some_time_for_0_sample(absolute, _) ->
+ ?_assertEqual(make_agg(<<"randomosity">>, 20.0, 10.0, 7.071, 5.0, 15.0),
+ begin
+ lists:foreach(fun(X) ->
+ couch_stats_collector:record({number, 11}, X)
+ end, lists:seq(0, 10)),
+ couch_stats_aggregator:collect_sample(),
+ timer:sleep(?TIMEWAIT),
+ couch_stats_collector:record({number, 11}, 15),
+ couch_stats_aggregator:collect_sample(),
+ timer:sleep(?TIMEWAIT),
+ couch_stats_aggregator:collect_sample(),
+ couch_stats_aggregator:get_json({number, 11})
+ end);
+should_not_remove_data_after_some_time_for_0_sample(counter, _) ->
+ ?_assertEqual(make_agg(<<"yay description">>, 100.0, 33.333, 57.735, 0, 100),
+ begin
+ lists:foreach(fun(_) ->
+ couch_stats_collector:increment({testing, stuff})
+ end, lists:seq(1, 100)),
+ couch_stats_aggregator:collect_sample(),
+ timer:sleep(?TIMEWAIT),
+ couch_stats_aggregator:collect_sample(),
+ timer:sleep(?TIMEWAIT),
+ couch_stats_aggregator:collect_sample(),
+ couch_stats_aggregator:get_json({testing, stuff})
+ end).
+
+should_remove_data_after_some_time_for_other_samples(absolute, _) ->
+ ?_assertEqual(make_agg(<<"randomosity">>, 15.0, 15.0, null, 15.0, 15.0),
+ begin
+ lists:foreach(fun(X) ->
+ couch_stats_collector:record({number, 11}, X)
+ end, lists:seq(0, 10)),
+ couch_stats_aggregator:collect_sample(),
+ timer:sleep(?TIMEWAIT),
+ couch_stats_collector:record({number, 11}, 15),
+ couch_stats_aggregator:collect_sample(),
+ timer:sleep(?TIMEWAIT),
+ couch_stats_aggregator:collect_sample(),
+ couch_stats_aggregator:get_json({number, 11}, 1)
+ end);
+should_remove_data_after_some_time_for_other_samples(counter, _) ->
+ ?_assertEqual(make_agg(<<"yay description">>, 0, 0.0, 0.0, 0, 0),
+ begin
+ lists:foreach(fun(_) ->
+ couch_stats_collector:increment({testing, stuff})
+ end, lists:seq(1, 100)),
+ couch_stats_aggregator:collect_sample(),
+ timer:sleep(?TIMEWAIT),
+ couch_stats_aggregator:collect_sample(),
+ timer:sleep(?TIMEWAIT),
+ couch_stats_aggregator:collect_sample(),
+ couch_stats_aggregator:get_json({testing, stuff}, 1)
+ end).
+
spawn_and_count(N) ->
Self = self(),
@@ -191,3 +399,14 @@ repeat(_, 0) ->
repeat(Fun, Count) ->
Fun(),
repeat(Fun, Count-1).
+
+make_agg(Desc, Sum, Mean, StdDev, Min, Max) ->
+ {[
+ {description, Desc},
+ {current, Sum},
+ {sum, Sum},
+ {mean, Mean},
+ {stddev, StdDev},
+ {min, Min},
+ {max, Max}
+ ]}.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/19c54023/test/couchdb/fixtures/couch_stats_aggregates.cfg
----------------------------------------------------------------------
diff --git a/test/couchdb/fixtures/couch_stats_aggregates.cfg b/test/couchdb/fixtures/couch_stats_aggregates.cfg
new file mode 100644
index 0000000..30e475d
--- /dev/null
+++ b/test/couchdb/fixtures/couch_stats_aggregates.cfg
@@ -0,0 +1,19 @@
+% Licensed to the Apache Software Foundation (ASF) under one
+% or more contributor license agreements. See the NOTICE file
+% distributed with this work for additional information
+% regarding copyright ownership. The ASF licenses this file
+% 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.
+
+{testing, stuff, "yay description"}.
+{number, '11', "randomosity"}.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/19c54023/test/couchdb/fixtures/couch_stats_aggregates.ini
----------------------------------------------------------------------
diff --git a/test/couchdb/fixtures/couch_stats_aggregates.ini b/test/couchdb/fixtures/couch_stats_aggregates.ini
new file mode 100644
index 0000000..cc5cd21
--- /dev/null
+++ b/test/couchdb/fixtures/couch_stats_aggregates.ini
@@ -0,0 +1,20 @@
+; Licensed to the Apache Software Foundation (ASF) under one
+; or more contributor license agreements. See the NOTICE file
+; distributed with this work for additional information
+; regarding copyright ownership. The ASF licenses this file
+; 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.
+
+[stats]
+rate = 10000000 ; We call collect_sample in testing
+samples = [0, 1]
http://git-wip-us.apache.org/repos/asf/couchdb/blob/19c54023/test/etap/121-stats-aggregates.cfg
----------------------------------------------------------------------
diff --git a/test/etap/121-stats-aggregates.cfg b/test/etap/121-stats-aggregates.cfg
deleted file mode 100644
index 30e475d..0000000
--- a/test/etap/121-stats-aggregates.cfg
+++ /dev/null
@@ -1,19 +0,0 @@
-% Licensed to the Apache Software Foundation (ASF) under one
-% or more contributor license agreements. See the NOTICE file
-% distributed with this work for additional information
-% regarding copyright ownership. The ASF licenses this file
-% 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.
-
-{testing, stuff, "yay description"}.
-{number, '11', "randomosity"}.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/19c54023/test/etap/121-stats-aggregates.ini
----------------------------------------------------------------------
diff --git a/test/etap/121-stats-aggregates.ini b/test/etap/121-stats-aggregates.ini
deleted file mode 100644
index cc5cd21..0000000
--- a/test/etap/121-stats-aggregates.ini
+++ /dev/null
@@ -1,20 +0,0 @@
-; Licensed to the Apache Software Foundation (ASF) under one
-; or more contributor license agreements. See the NOTICE file
-; distributed with this work for additional information
-; regarding copyright ownership. The ASF licenses this file
-; 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.
-
-[stats]
-rate = 10000000 ; We call collect_sample in testing
-samples = [0, 1]
http://git-wip-us.apache.org/repos/asf/couchdb/blob/19c54023/test/etap/121-stats-aggregates.t
----------------------------------------------------------------------
diff --git a/test/etap/121-stats-aggregates.t b/test/etap/121-stats-aggregates.t
deleted file mode 100755
index d678aa9..0000000
--- a/test/etap/121-stats-aggregates.t
+++ /dev/null
@@ -1,171 +0,0 @@
-#!/usr/bin/env escript
-%% -*- erlang -*-
-
-% 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.
-
-ini_file() ->
- test_util:source_file("test/etap/121-stats-aggregates.ini").
-
-cfg_file() ->
- test_util:source_file("test/etap/121-stats-aggregates.cfg").
-
-main(_) ->
- test_util:init_code_path(),
- etap:plan(17),
- case (catch test()) of
- ok ->
- etap:end_tests();
- Other ->
- etap:diag(io_lib:format("Test died abnormally: ~p", [Other])),
- etap:bail()
- end,
- ok.
-
-test() ->
- couch_config:start_link([ini_file()]),
- couch_stats_collector:start(),
- couch_stats_aggregator:start(cfg_file()),
- ok = test_all_empty(),
- ok = test_get_empty(),
- ok = test_count_stats(),
- ok = test_abs_stats(),
- ok.
-
-test_all_empty() ->
- {Aggs} = couch_stats_aggregator:all(),
-
- etap:is(length(Aggs), 2, "There are only two aggregate types in testing."),
- etap:is(
- couch_util:get_value(testing, Aggs),
- {[{stuff, make_agg(<<"yay description">>,
- null, null, null, null, null)}]},
- "{testing, stuff} is empty at start."
- ),
- etap:is(
- couch_util:get_value(number, Aggs),
- {[{'11', make_agg(<<"randomosity">>,
- null, null, null, null, null)}]},
- "{number, '11'} is empty at start."
- ),
- ok.
-
-test_get_empty() ->
- etap:is(
- couch_stats_aggregator:get_json({testing, stuff}),
- make_agg(<<"yay description">>, null, null, null, null, null),
- "Getting {testing, stuff} returns an empty aggregate."
- ),
- etap:is(
- couch_stats_aggregator:get_json({number, '11'}),
- make_agg(<<"randomosity">>, null, null, null, null, null),
- "Getting {number, '11'} returns an empty aggregate."
- ),
- ok.
-
-test_count_stats() ->
- lists:foreach(fun(_) ->
- couch_stats_collector:increment({testing, stuff})
- end, lists:seq(1, 100)),
- couch_stats_aggregator:collect_sample(),
- etap:is(
- couch_stats_aggregator:get_json({testing, stuff}),
- make_agg(<<"yay description">>, 100, 100, null, 100, 100),
- "COUNT: Adding values changes the stats."
- ),
- etap:is(
- couch_stats_aggregator:get_json({testing, stuff}, 1),
- make_agg(<<"yay description">>, 100, 100, null, 100, 100),
- "COUNT: Adding values changes stats for all times."
- ),
-
- timer:sleep(500),
- couch_stats_aggregator:collect_sample(),
- etap:is(
- couch_stats_aggregator:get_json({testing, stuff}),
- make_agg(<<"yay description">>, 100, 50, 70.711, 0, 100),
- "COUNT: Removing values changes stats."
- ),
- etap:is(
- couch_stats_aggregator:get_json({testing, stuff}, 1),
- make_agg(<<"yay description">>, 100, 50, 70.711, 0, 100),
- "COUNT: Removing values changes stats for all times."
- ),
-
- timer:sleep(600),
- couch_stats_aggregator:collect_sample(),
- etap:is(
- couch_stats_aggregator:get_json({testing, stuff}),
- make_agg(<<"yay description">>, 100, 33.333, 57.735, 0, 100),
- "COUNT: Letting time passes doesn't remove data from time 0 aggregates"
- ),
- etap:is(
- couch_stats_aggregator:get_json({testing, stuff}, 1),
- make_agg(<<"yay description">>, 0, 0, 0, 0, 0),
- "COUNT: Letting time pass removes data from other time aggregates."
- ),
- ok.
-
-test_abs_stats() ->
- lists:foreach(fun(X) ->
- couch_stats_collector:record({number, 11}, X)
- end, lists:seq(0, 10)),
- couch_stats_aggregator:collect_sample(),
- etap:is(
- couch_stats_aggregator:get_json({number, 11}),
- make_agg(<<"randomosity">>, 5, 5, null, 5, 5),
- "ABS: Adding values changes the stats."
- ),
- etap:is(
- couch_stats_aggregator:get_json({number, 11}, 1),
- make_agg(<<"randomosity">>, 5, 5, null, 5, 5),
- "ABS: Adding values changes stats for all times."
- ),
-
- timer:sleep(500),
- couch_stats_collector:record({number, 11}, 15),
- couch_stats_aggregator:collect_sample(),
- etap:is(
- couch_stats_aggregator:get_json({number, 11}),
- make_agg(<<"randomosity">>, 20, 10, 7.071, 5, 15),
- "ABS: New values changes stats"
- ),
- etap:is(
- couch_stats_aggregator:get_json({number, 11}, 1),
- make_agg(<<"randomosity">>, 20, 10, 7.071, 5, 15),
- "ABS: Removing values changes stats for all times."
- ),
-
- timer:sleep(600),
- couch_stats_aggregator:collect_sample(),
- etap:is(
- couch_stats_aggregator:get_json({number, 11}),
- make_agg(<<"randomosity">>, 20, 10, 7.071, 5, 15),
- "ABS: Letting time passes doesn't remove data from time 0 aggregates"
- ),
- etap:is(
- couch_stats_aggregator:get_json({number, 11}, 1),
- make_agg(<<"randomosity">>, 15, 15, null, 15, 15),
- "ABS: Letting time pass removes data from other time aggregates."
- ),
- ok.
-
-make_agg(Desc, Sum, Mean, StdDev, Min, Max) ->
- {[
- {description, Desc},
- {current, Sum},
- {sum, Sum},
- {mean, Mean},
- {stddev, StdDev},
- {min, Min},
- {max, Max}
- ]}.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/19c54023/test/etap/Makefile.am
----------------------------------------------------------------------
diff --git a/test/etap/Makefile.am b/test/etap/Makefile.am
index 216aa78..abe252d 100644
--- a/test/etap/Makefile.am
+++ b/test/etap/Makefile.am
@@ -36,9 +36,6 @@ fixture_files = \
fixtures/test.couch
tap_files = \
- 121-stats-aggregates.cfg \
- 121-stats-aggregates.ini \
- 121-stats-aggregates.t \
130-attachments-md5.t \
140-attachment-comp.t \
150-invalid-view-seq.t \