couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [25/48] couch commit: updated refs/heads/master to 7776921
Date Sat, 04 Apr 2015 23:29:20 GMT
Enable couchdb_attachments_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/5e95b1a4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/5e95b1a4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/5e95b1a4

Branch: refs/heads/master
Commit: 5e95b1a4cafd8e807467b5a1ce8947c5e79352ff
Parents: c2d3d45
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Tue Feb 3 09:39:53 2015 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Tue Feb 10 11:04:44 2015 -0800

----------------------------------------------------------------------
 include/couch_eunit.hrl            |  5 +++++
 test/couchdb_attachments_tests.erl | 18 +++++++-----------
 2 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/5e95b1a4/include/couch_eunit.hrl
----------------------------------------------------------------------
diff --git a/include/couch_eunit.hrl b/include/couch_eunit.hrl
index 41957e8..c48442a 100644
--- a/include/couch_eunit.hrl
+++ b/include/couch_eunit.hrl
@@ -31,6 +31,11 @@
     filename:join([?BUILDDIR(), "src", "couch", "test", "fixtures"])).
 -define(TEMPDIR,
     filename:join([?BUILDDIR(), "tmp", "tmp_data"])).
+-define(ABS_PATH(File),
+    filename:join([
+        filename:dirname(
+            filename:dirname(
+                filename:dirname(filename:absname(File)))), File])).
 
 -define(tempfile,
     fun() ->

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/5e95b1a4/test/couchdb_attachments_tests.erl
----------------------------------------------------------------------
diff --git a/test/couchdb_attachments_tests.erl b/test/couchdb_attachments_tests.erl
index 083efc7..4822987 100644
--- a/test/couchdb_attachments_tests.erl
+++ b/test/couchdb_attachments_tests.erl
@@ -19,15 +19,13 @@
 -define(ATT_BIN_NAME, <<"logo.png">>).
 -define(ATT_TXT_NAME, <<"file.erl">>).
 -define(FIXTURE_PNG, filename:join([?FIXTURESDIR, "logo.png"])).
--define(FIXTURE_TXT, ?FILE).
+-define(FIXTURE_TXT, ?ABS_PATH(?FILE)).
 -define(TIMEOUT, 1000).
 -define(TIMEOUT_EUNIT, 10).
 -define(TIMEWAIT, 100).
 -define(i2l(I), integer_to_list(I)).
 
 
--ifdef(run_broken_tests).
-
 start() ->
     Ctx = test_util:start_couch(),
     % ensure in default compression settings for attachments_compression_tests
@@ -191,7 +189,7 @@ should_upload_attachment_by_chunks_without_md5({Host, DbName}) ->
         AttUrl = string:join(["", DbName, ?docid(), "readme.txt"], "/"),
         AttData = <<"We all live in a yellow submarine!">>,
         <<Part1:21/binary, Part2:13/binary>> = AttData,
-        Body = chunked_body([Part1, Part2]),
+        Body = [chunked_body([Part1, Part2]), "\r\n"],
         Headers = [
             {"Content-Type", "text/plain"},
             {"Transfer-Encoding", "chunked"},
@@ -222,7 +220,7 @@ should_upload_attachment_by_chunks_with_valid_md5_header({Host, DbName})
->
         AttUrl = string:join(["", DbName, ?docid(), "readme.txt"], "/"),
         AttData = <<"We all live in a yellow submarine!">>,
         <<Part1:21/binary, Part2:13/binary>> = AttData,
-        Body = chunked_body([Part1, Part2]),
+        Body = [chunked_body([Part1, Part2]), "\r\n"],
         Headers = [
             {"Content-Type", "text/plain"},
             {"Content-MD5", ?b2l(base64:encode(couch_util:md5(AttData)))},
@@ -241,7 +239,7 @@ should_upload_attachment_by_chunks_with_valid_md5_trailer({Host, DbName})
->
         <<Part1:21/binary, Part2:13/binary>> = AttData,
         Body = [chunked_body([Part1, Part2]),
                 "Content-MD5: ", base64:encode(couch_util:md5(AttData)),
-                "\r\n"],
+                "\r\n\r\n"],
         Headers = [
             {"Content-Type", "text/plain"},
             {"Host", Host},
@@ -275,7 +273,7 @@ should_reject_chunked_attachment_with_invalid_md5({Host, DbName}) ->
         AttUrl = string:join(["", DbName, ?docid(), "readme.txt"], "/"),
         AttData = <<"We all live in a yellow submarine!">>,
         <<Part1:21/binary, Part2:13/binary>> = AttData,
-        Body = chunked_body([Part1, Part2]),
+        Body = [chunked_body([Part1, Part2]), "\r\n"],
         Headers = [
             {"Content-Type", "text/plain"},
             {"Content-MD5", ?b2l(base64:encode(<<"foobar!">>))},
@@ -295,7 +293,7 @@ should_reject_chunked_attachment_with_invalid_md5_trailer({Host, DbName})
->
         <<Part1:21/binary, Part2:13/binary>> = AttData,
         Body = [chunked_body([Part1, Part2]),
                 "Content-MD5: ", base64:encode(<<"foobar!">>),
-                "\r\n"],
+                "\r\n\r\n"],
         Headers = [
             {"Content-Type", "text/plain"},
             {"Host", Host},
@@ -556,7 +554,7 @@ request(Method, Url, Headers, Body) ->
     RequestHead = [Method, " ", Url, " HTTP/1.1"],
     RequestHeaders = [[string:join([Key, Value], ": "), "\r\n"]
                       || {Key, Value} <- Headers],
-    Request = [RequestHead, "\r\n", RequestHeaders, "\r\n", Body, "\r\n"],
+    Request = [RequestHead, "\r\n", RequestHeaders, "\r\n", Body],
     Sock = get_socket(),
     gen_tcp:send(Sock, list_to_binary(lists:flatten(Request))),
     timer:sleep(?TIMEWAIT),  % must wait to receive complete response
@@ -633,5 +631,3 @@ gzip(Data) ->
     ok = zlib:deflateEnd(Z),
     ok = zlib:close(Z),
     Last.
-
--endif.


Mime
View raw message