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 2015/04/05 01:29:29 UTC
[34/48] couch commit: updated refs/heads/master to 7776921
Enable couchdb_vhosts_tests
COUCHDB-2547
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/7cc94fa8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/7cc94fa8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/7cc94fa8
Branch: refs/heads/master
Commit: 7cc94fa8e261464e948aee440348c5b245a7ee72
Parents: 47ccf6e
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Wed Feb 4 14:32:26 2015 -0800
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Tue Feb 10 11:06:59 2015 -0800
----------------------------------------------------------------------
test/couchdb_vhosts_tests.erl | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/7cc94fa8/test/couchdb_vhosts_tests.erl
----------------------------------------------------------------------
diff --git a/test/couchdb_vhosts_tests.erl b/test/couchdb_vhosts_tests.erl
index aea00ec..13b69bb 100644
--- a/test/couchdb_vhosts_tests.erl
+++ b/test/couchdb_vhosts_tests.erl
@@ -19,8 +19,6 @@
-define(iofmt(S, A), lists:flatten(io_lib:format(S, A))).
--ifdef(run_broken_tests).
-
setup() ->
DbName = ?tempdb(),
{ok, Db} = couch_db:create(DbName, [?ADMIN_CTX]),
@@ -48,6 +46,14 @@ setup() ->
couch_db:ensure_full_commit(Db),
couch_db:close(Db),
+ test_util:with_process_restart(couch_httpd, fun() ->
+ config:set("httpd_global_handlers", "_utils",
+ "{couch_httpd_misc_handlers, handle_utils_dir_req, <<\""
+ ++ ?TEMPDIR
+ ++ "\">>}"
+ )
+ end),
+
Addr = config:get("httpd", "bind_address", "127.0.0.1"),
Port = integer_to_list(mochiweb_socket_server:get(couch_httpd, port)),
Url = "http://" ++ Addr ++ ":" ++ Port,
@@ -173,6 +179,7 @@ should_return_revs_info({Url, DbName}) ->
should_serve_utils_for_vhost({Url, DbName}) ->
?_test(begin
ok = config:set("vhosts", "example.com", "/" ++ DbName, false),
+ ensure_index_file(),
case test_request:get(Url ++ "/_utils/index.html", [],
[{host_header, "example.com"}]) of
{ok, _, _, Body} ->
@@ -427,4 +434,6 @@ should_fail_oauth_with_wrong_credentials({Url, _}) ->
end
end).
--endif.
+ensure_index_file() ->
+ Body = <<"<!DOCTYPE html>\n<html>\n<body>\nHello world\n</body>\n</html>">>,
+ file:write_file(filename:join([?TEMPDIR, "index.html"]), Body).