From 85221b542f438dc85faad7a6afcddd67d5984e6e Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sat, 30 Aug 2008 20:50:03 +0000 Subject: - Remove dependency on test/local.ini - Write out new variables in key = value format - Fix tests git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@690584 13f79535-47bb-0310-9956-ffa450edef68 --- test/couch_config_test.erl | 7 +++ test/couch_config_writer_test.erl | 126 +++++++++++++++++++------------------- 2 files changed, 70 insertions(+), 63 deletions(-) (limited to 'test') diff --git a/test/couch_config_test.erl b/test/couch_config_test.erl index 604a35d2..7db45bd7 100644 --- a/test/couch_config_test.erl +++ b/test/couch_config_test.erl @@ -30,6 +30,9 @@ store_tuple_key() -> store(Key2, Value2) -> + Filename = "local.ini", + file:write_file(Filename, ""), + Key = binary_to_list(term_to_binary(Key2)), Value = binary_to_list(term_to_binary(Value2)), @@ -40,4 +43,8 @@ store(Key2, Value2) -> couch_config:unset(Key), couch_config:terminate(end_of_test, ok), + + % clean up + file:delete(Filename), + Value = Result. \ No newline at end of file diff --git a/test/couch_config_writer_test.erl b/test/couch_config_writer_test.erl index e5daa211..fd050010 100644 --- a/test/couch_config_writer_test.erl +++ b/test/couch_config_writer_test.erl @@ -17,47 +17,47 @@ replace_existing_variable() -> Contents = "; etc/couchdb/couch.ini.tpl. Generated from couch.ini.tpl.in by configure. [CouchDB] -RootDirectory=/Users/jan/Work/runcouch/conf9/var/lib/couchdb -UtilDriverDir=/Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib -MaximumDocumentSize=4294967296 ; 4 GB +RootDirectory = /Users/jan/Work/runcouch/conf9/var/lib/couchdb +UtilDriverDir = /Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib +MaximumDocumentSize = 4294967296 ; 4 GB [HTTPd] -Port=5984 -BindAddress=127.0.0.1 -DocumentRoot=/Users/jan/Work/runcouch/conf9/share/couchdb/www +Port = 5984 +BindAddress = 127.0.0.1 +DocumentRoot = /Users/jan/Work/runcouch/conf9/share/couchdb/www [Log] -File=/Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log -Level=info +File = /Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log +Level = info [CouchDB Query Servers] -javascript=/Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js +javascript = /Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js [CouchDB Query Server Options] -QueryTimeout=5000 ; 5 seconds +QueryTimeout = 5000 ; 5 seconds ", Expect = "; etc/couchdb/couch.ini.tpl. Generated from couch.ini.tpl.in by configure. [CouchDB] -RootDirectory=/Users/jan/Work/runcouch/conf9/var/lib/couchdb -UtilDriverDir=/Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib -MaximumDocumentSize=4294967296 ; 4 GB +RootDirectory = /Users/jan/Work/runcouch/conf9/var/lib/couchdb +UtilDriverDir = /Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib +MaximumDocumentSize = 4294967296 ; 4 GB [HTTPd] -Port=5985 -BindAddress=127.0.0.1 -DocumentRoot=/Users/jan/Work/runcouch/conf9/share/couchdb/www +Port = 5985 +BindAddress = 127.0.0.1 +DocumentRoot = /Users/jan/Work/runcouch/conf9/share/couchdb/www [Log] -File=/Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log -Level=info +File = /Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log +Level = info [CouchDB Query Servers] -javascript=/Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js +javascript = /Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js [CouchDB Query Server Options] -QueryTimeout=5000 ; 5 seconds +QueryTimeout = 5000 ; 5 seconds ", run_operation_and_compare_results(Contents, Expect, {{"HTTPd", "Port"}, "5985"}). @@ -67,48 +67,48 @@ append_new_variable() -> Contents = "; etc/couchdb/couch.ini.tpl. Generated from couch.ini.tpl.in by configure. [CouchDB] -RootDirectory=/Users/jan/Work/runcouch/conf9/var/lib/couchdb -UtilDriverDir=/Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib -MaximumDocumentSize=4294967296 ; 4 GB +RootDirectory = /Users/jan/Work/runcouch/conf9/var/lib/couchdb +UtilDriverDir = /Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib +MaximumDocumentSize = 4294967296 ; 4 GB [HTTPd] -Port=5984 -BindAddress=127.0.0.1 -DocumentRoot=/Users/jan/Work/runcouch/conf9/share/couchdb/www +Port = 5984 +BindAddress = 127.0.0.1 +DocumentRoot = /Users/jan/Work/runcouch/conf9/share/couchdb/www [Log] -File=/Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log -Level=info +File = /Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log +Level = info [CouchDB Query Servers] -javascript=/Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js +javascript = /Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js [CouchDB Query Server Options] -QueryTimeout=5000 ; 5 seconds +QueryTimeout = 5000 ; 5 seconds ", Expect = "; etc/couchdb/couch.ini.tpl. Generated from couch.ini.tpl.in by configure. [CouchDB] -RootDirectory=/Users/jan/Work/runcouch/conf9/var/lib/couchdb -UtilDriverDir=/Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib -MaximumDocumentSize=4294967296 ; 4 GB +RootDirectory = /Users/jan/Work/runcouch/conf9/var/lib/couchdb +UtilDriverDir = /Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib +MaximumDocumentSize = 4294967296 ; 4 GB [HTTPd] -Port=5984 -BindAddress=127.0.0.1 -DocumentRoot=/Users/jan/Work/runcouch/conf9/share/couchdb/www +Port = 5984 +BindAddress = 127.0.0.1 +DocumentRoot = /Users/jan/Work/runcouch/conf9/share/couchdb/www -FantasyConfiguration=Citation Needed +FantasyConfiguration = Citation Needed [Log] -File=/Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log -Level=info +File = /Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log +Level = info [CouchDB Query Servers] -javascript=/Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js +javascript = /Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js [CouchDB Query Server Options] -QueryTimeout=5000 ; 5 seconds +QueryTimeout = 5000 ; 5 seconds ", run_operation_and_compare_results(Contents, Expect, {{"HTTPd", "FantasyConfiguration"}, "Citation Needed"}). @@ -118,49 +118,49 @@ append_new_module() -> Contents = "; etc/couchdb/couch.ini.tpl. Generated from couch.ini.tpl.in by configure. [CouchDB] -RootDirectory=/Users/jan/Work/runcouch/conf9/var/lib/couchdb -UtilDriverDir=/Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib -MaximumDocumentSize=4294967296 ; 4 GB +RootDirectory = /Users/jan/Work/runcouch/conf9/var/lib/couchdb +UtilDriverDir = /Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib +MaximumDocumentSize = 4294967296 ; 4 GB [HTTPd] -Port=5984 -BindAddress=127.0.0.1 -DocumentRoot=/Users/jan/Work/runcouch/conf9/share/couchdb/www +Port = 5984 +BindAddress = 127.0.0.1 +DocumentRoot = /Users/jan/Work/runcouch/conf9/share/couchdb/www [Log] -File=/Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log -Level=info +File = /Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log +Level = info [CouchDB Query Servers] -javascript=/Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js +javascript = /Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js [CouchDB Query Server Options] -QueryTimeout=5000 ; 5 seconds", +QueryTimeout = 5000 ; 5 seconds", Expect = "; etc/couchdb/couch.ini.tpl. Generated from couch.ini.tpl.in by configure. [CouchDB] -RootDirectory=/Users/jan/Work/runcouch/conf9/var/lib/couchdb -UtilDriverDir=/Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib -MaximumDocumentSize=4294967296 ; 4 GB +RootDirectory = /Users/jan/Work/runcouch/conf9/var/lib/couchdb +UtilDriverDir = /Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib +MaximumDocumentSize = 4294967296 ; 4 GB [HTTPd] -Port=5984 -BindAddress=127.0.0.1 -DocumentRoot=/Users/jan/Work/runcouch/conf9/share/couchdb/www +Port = 5984 +BindAddress = 127.0.0.1 +DocumentRoot = /Users/jan/Work/runcouch/conf9/share/couchdb/www [Log] -File=/Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log -Level=info +File = /Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log +Level = info [CouchDB Query Servers] -javascript=/Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js +javascript = /Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js [CouchDB Query Server Options] -QueryTimeout=5000 ; 5 seconds +QueryTimeout = 5000 ; 5 seconds [Erlang] -Option=Value +Option = Value ", run_operation_and_compare_results(Contents, Expect, {{"Erlang", "Option"}, "Value"}). @@ -176,6 +176,6 @@ run_operation_and_compare_results(Contents, Expect, Config) -> Result = binary_to_list(Result_), % clean up - % file:delete(Filename), + file:delete(Filename), Result = Expect. -- cgit v1.2.3