What Randall said, gzipping the same thing twice gives different answers, which makes comparing these numbers across test suite runs impossible.
B. On 16 January 2012 21:11, Randall Leeds <[email protected]> wrote: > On Mon, Jan 16, 2012 at 06:56, Benoit Chesneau <[email protected]> wrote: >> On Sun, Jan 15, 2012 at 2:45 PM, <[email protected]> wrote: >>> Updated Branches: >>> refs/heads/1.2.x e8688ac20 -> 8d83b39a0 >>> >>> >>> Use non-compressed Content-Type in attachments test suites >>> >>> MD5-Digests of attachments are calculated on the compressed data if the >>> attachment MIME type is compressible, as defined in default.ini >>> [attachments] compressible_types >>> >>> Windows uses a different gzip implementation, and therefore generates >>> different MD5-Digests than other platforms. Using binary Content-Type >>> resolves this. >>> >>> >>> Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo >>> Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/8d83b39a >>> Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/8d83b39a >>> Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/8d83b39a >>> >>> Branch: refs/heads/1.2.x >>> Commit: 8d83b39a061eb12956aa9574b27044a423bbcb93 >>> Parents: e8688ac >>> Author: Dave Cottlehuber <[email protected]> >>> Authored: Sun Jan 15 23:38:13 2012 +0100 >>> Committer: Dave Cottlehuber <[email protected]> >>> Committed: Sun Jan 15 23:38:13 2012 +0100 >>> >>> ---------------------------------------------------------------------- >>> share/www/script/test/attachment_names.js | 6 +++--- >>> share/www/script/test/attachments.js | 10 +++++++--- >>> 2 files changed, 10 insertions(+), 6 deletions(-) >>> ---------------------------------------------------------------------- >>> >>> >>> http://git-wip-us.apache.org/repos/asf/couchdb/blob/8d83b39a/share/www/script/test/attachment_names.js >>> ---------------------------------------------------------------------- >>> diff --git a/share/www/script/test/attachment_names.js >>> b/share/www/script/test/attachment_names.js >>> index 78c95de..334350c 100644 >>> --- a/share/www/script/test/attachment_names.js >>> +++ b/share/www/script/test/attachment_names.js >>> @@ -20,7 +20,7 @@ couchTests.attachment_names = function(debug) { >>> _id: "good_doc", >>> _attachments: { >>> "Колян.txt": { >>> - content_type:"text/plain", >>> + content_type:"application/octet-stream", >>> data: "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ=" >>> } >>> } >>> @@ -31,8 +31,8 @@ couchTests.attachment_names = function(debug) { >>> >>> var xhr = CouchDB.request("GET", "/test_suite_db/good_doc/Колян.txt"); >>> T(xhr.responseText == "This is a base64 encoded text"); >>> - T(xhr.getResponseHeader("Content-Type") == "text/plain"); >>> - TEquals("\"qUUYqS41RhwF0TrCsTAxFg==\"", xhr.getResponseHeader("Etag")); >>> + T(xhr.getResponseHeader("Content-Type") == "application/octet-stream"); >>> + TEquals("\"aEI7pOYCRBLTRQvvqYrrJQ==\"", xhr.getResponseHeader("Etag")); >>> >>> var binAttDoc = { >>> _id: "bin_doc", >>> >>> http://git-wip-us.apache.org/repos/asf/couchdb/blob/8d83b39a/share/www/script/test/attachments.js >>> ---------------------------------------------------------------------- >>> diff --git a/share/www/script/test/attachments.js >>> b/share/www/script/test/attachments.js >>> index a409f82..db4524a 100644 >>> --- a/share/www/script/test/attachments.js >>> +++ b/share/www/script/test/attachments.js >>> @@ -16,11 +16,15 @@ couchTests.attachments= function(debug) { >>> db.createDb(); >>> if (debug) debugger; >>> >>> + >>> + // MD5 Digests of compressible attachments and therefore Etags >>> + // will vary depending on platform gzip implementation. >>> + // These MIME types are defined in [attachments] compressible_types >>> var binAttDoc = { >>> _id: "bin_doc", >>> _attachments:{ >>> "foo.txt": { >>> - content_type:"text/plain", >>> + content_type:"application/octet-stream", >>> data: "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ=" >>> } >>> } >>> @@ -31,8 +35,8 @@ couchTests.attachments= function(debug) { >>> >>> var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc/foo.txt"); >>> T(xhr.responseText == "This is a base64 encoded text"); >>> - T(xhr.getResponseHeader("Content-Type") == "text/plain"); >>> - TEquals("\"qUUYqS41RhwF0TrCsTAxFg==\"", xhr.getResponseHeader("Etag")); >>> + T(xhr.getResponseHeader("Content-Type") == "application/octet-stream"); >>> + TEquals("\"aEI7pOYCRBLTRQvvqYrrJQ==\"", xhr.getResponseHeader("Etag")); >>> >>> // empty attachment >>> var binAttDoc2 = { >>> >> >> Hum tests are fixed but what about general usage? Should people always >> use binary ct ? > > No. People should use the most accurate content type. I think this is > just a fix for the tests, which cannot assume that every > implementation of the compression algorithms will generate the same > compressed data wherever the test suite is run, so it's hard to check > that it worked. Instead, using the binary type avoids the compression > so the digest is what we expect. > > At least, that's how I read it. > >> >> - benoît
