diff options
author | Paul Joseph Davis <davisp@apache.org> | 2009-10-24 21:53:02 +0000 |
---|---|---|
committer | Paul Joseph Davis <davisp@apache.org> | 2009-10-24 21:53:02 +0000 |
commit | 0f575441b4938e75068b88c7e32698de3e3af9df (patch) | |
tree | 8f7b8d96ad1c1cfeb13322c1149427cf8043450e | |
parent | 944dbcd5af0f47363499c55effb85170357b77db (diff) |
Fixed the test for couch_stats_aggregator.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@829456 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/couchdb/couch_httpd_show.erl | 2 | ||||
-rw-r--r-- | src/couchdb/couch_stats_aggregator.erl | 13 | ||||
-rw-r--r-- | test/etap/121-stats-aggregates.cfg | 19 | ||||
-rw-r--r-- | test/etap/121-stats-aggregates.ini | 5 | ||||
-rwxr-xr-x | test/etap/121-stats-aggregates.t | 2 |
5 files changed, 29 insertions, 12 deletions
diff --git a/src/couchdb/couch_httpd_show.erl b/src/couchdb/couch_httpd_show.erl index 19785f5d..896c833e 100644 --- a/src/couchdb/couch_httpd_show.erl +++ b/src/couchdb/couch_httpd_show.erl @@ -40,7 +40,7 @@ handle_doc_show_req(Req, _Db) -> send_method_not_allowed(Req, "GET,POST,HEAD"). -handle_doc_update_req(#httpd{method = 'GET'}=Req, Db) -> +handle_doc_update_req(#httpd{method = 'GET'}=Req, _Db) -> send_method_not_allowed(Req, "POST,PUT,DELETE,ETC"); handle_doc_update_req(#httpd{ diff --git a/src/couchdb/couch_stats_aggregator.erl b/src/couchdb/couch_stats_aggregator.erl index 01e0f62a..3292e5f0 100644 --- a/src/couchdb/couch_stats_aggregator.erl +++ b/src/couchdb/couch_stats_aggregator.erl @@ -13,7 +13,7 @@ -module(couch_stats_aggregator). -behaviour(gen_server). --export([start/0, stop/0]). +-export([start/0, start/1, stop/0]). -export([all/0, all/1, get/1, get/2, get_json/1, get_json/2, collect_sample/0]). -export([init/1, terminate/2, code_change/3]). @@ -35,7 +35,11 @@ start() -> - gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). + PrivDir = couch_util:priv_dir(), + start(filename:join(PrivDir, "stat_descriptions.cfg")). + +start(FileName) -> + gen_server:start_link({local, ?MODULE}, ?MODULE, [FileName], []). stop() -> gen_server:cast(?MODULE, stop). @@ -85,13 +89,12 @@ collect_sample() -> gen_server:call(?MODULE, collect_sample). -init(_) -> +init(StatDescsFileName) -> % Create an aggregate entry for each {description, rate} pair. ets:new(?MODULE, [named_table, set, protected]), SampleStr = couch_config:get("stats", "samples", "[0]"), {ok, Samples} = couch_util:parse_term(SampleStr), - PrivDir = couch_util:priv_dir(), - {ok, Descs} = file:consult(filename:join(PrivDir, "stat_descriptions.cfg")), + {ok, Descs} = file:consult(StatDescsFileName), lists:foreach(fun({Sect, Key, Value}) -> lists:foreach(fun(Secs) -> Agg = #aggregate{ diff --git a/test/etap/121-stats-aggregates.cfg b/test/etap/121-stats-aggregates.cfg new file mode 100644 index 00000000..30e475da --- /dev/null +++ b/test/etap/121-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"}. diff --git a/test/etap/121-stats-aggregates.ini b/test/etap/121-stats-aggregates.ini index 824bf163..cc5cd218 100644 --- a/test/etap/121-stats-aggregates.ini +++ b/test/etap/121-stats-aggregates.ini @@ -18,8 +18,3 @@ [stats] rate = 10000000 ; We call collect_sample in testing samples = [0, 1] - -[stats_descriptions] -{testing, stuff} = yay description -{number, '11'} = randomosity - diff --git a/test/etap/121-stats-aggregates.t b/test/etap/121-stats-aggregates.t index cb2c2bb2..0e5a6111 100755 --- a/test/etap/121-stats-aggregates.t +++ b/test/etap/121-stats-aggregates.t @@ -29,7 +29,7 @@ main(_) -> test() -> couch_config:start_link(["test/etap/121-stats-aggregates.ini"]), couch_stats_collector:start(), - couch_stats_aggregator:start(), + couch_stats_aggregator:start("test/etap/121-stats-aggregates.cfg"), ok = test_all_empty(), ok = test_get_empty(), ok = test_count_stats(), |