Author: davisp
Date: Sat Oct 24 21:53:02 2009
New Revision: 829456
URL: http://svn.apache.org/viewvc?rev=829456&view=rev
Log:
Fixed the test for couch_stats_aggregator.
Added:
couchdb/trunk/test/etap/121-stats-aggregates.cfg
Modified:
couchdb/trunk/src/couchdb/couch_httpd_show.erl
couchdb/trunk/src/couchdb/couch_stats_aggregator.erl
couchdb/trunk/test/etap/121-stats-aggregates.ini
couchdb/trunk/test/etap/121-stats-aggregates.t
Modified: couchdb/trunk/src/couchdb/couch_httpd_show.erl
URL:
http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_show.erl?rev=829456&r1=829455&r2=829456&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_show.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_show.erl Sat Oct 24 21:53:02 2009
@@ -40,7 +40,7 @@
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{
Modified: couchdb/trunk/src/couchdb/couch_stats_aggregator.erl
URL:
http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_stats_aggregator.erl?rev=829456&r1=829455&r2=829456&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_stats_aggregator.erl (original)
+++ couchdb/trunk/src/couchdb/couch_stats_aggregator.erl Sat Oct 24 21:53:02
2009
@@ -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 @@
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{
Added: couchdb/trunk/test/etap/121-stats-aggregates.cfg
URL:
http://svn.apache.org/viewvc/couchdb/trunk/test/etap/121-stats-aggregates.cfg?rev=829456&view=auto
==============================================================================
--- couchdb/trunk/test/etap/121-stats-aggregates.cfg (added)
+++ couchdb/trunk/test/etap/121-stats-aggregates.cfg Sat Oct 24 21:53:02 2009
@@ -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"}.
Modified: couchdb/trunk/test/etap/121-stats-aggregates.ini
URL:
http://svn.apache.org/viewvc/couchdb/trunk/test/etap/121-stats-aggregates.ini?rev=829456&r1=829455&r2=829456&view=diff
==============================================================================
--- couchdb/trunk/test/etap/121-stats-aggregates.ini (original)
+++ couchdb/trunk/test/etap/121-stats-aggregates.ini Sat Oct 24 21:53:02 2009
@@ -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
-
Modified: couchdb/trunk/test/etap/121-stats-aggregates.t
URL:
http://svn.apache.org/viewvc/couchdb/trunk/test/etap/121-stats-aggregates.t?rev=829456&r1=829455&r2=829456&view=diff
==============================================================================
--- couchdb/trunk/test/etap/121-stats-aggregates.t (original)
+++ couchdb/trunk/test/etap/121-stats-aggregates.t Sat Oct 24 21:53:02 2009
@@ -29,7 +29,7 @@
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(),