From f3e688373082574d6f469acc282b873658a2321a Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Thu, 15 Apr 2010 16:34:25 +0000 Subject: refactor att compression to allow more encodings. thanks fdmanana. COUCHDB-710 git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@934475 13f79535-47bb-0310-9956-ffa450edef68 --- test/etap/113-replication-attachment-comp.t | 31 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'test/etap/113-replication-attachment-comp.t') diff --git a/test/etap/113-replication-attachment-comp.t b/test/etap/113-replication-attachment-comp.t index d9039694..30f602ef 100644 --- a/test/etap/113-replication-attachment-comp.t +++ b/test/etap/113-replication-attachment-comp.t @@ -30,7 +30,7 @@ test_db_b_name() -> main(_) -> test_util:init_code_path(), - etap:plan(28), + etap:plan(30), case (catch test()) of ok -> etap:end_tests(); @@ -191,7 +191,7 @@ check_server_can_decompress_att(DbName) -> check_att_stubs(SourceDbName, TargetDbName) -> {ok, {{_, Code1, _}, _Headers1, Body1}} = http:request( get, - {db_url(SourceDbName) ++ "/testdoc1?att_gzip_length=true", []}, + {db_url(SourceDbName) ++ "/testdoc1?att_encoding_info=true", []}, [], [{sync, true}]), etap:is( @@ -206,7 +206,7 @@ check_att_stubs(SourceDbName, TargetDbName) -> ), {ok, {{_, Code2, _}, _Headers2, Body2}} = http:request( get, - {db_url(TargetDbName) ++ "/testdoc1?att_gzip_length=true", []}, + {db_url(TargetDbName) ++ "/testdoc1?att_encoding_info=true", []}, [], [{sync, true}]), etap:is( @@ -225,21 +225,30 @@ check_att_stubs(SourceDbName, TargetDbName) -> TargetAttStub, [<<"length">>] ), - TargetAttStubGzipLength = couch_util:get_nested_json_value( + TargetAttStubEnc = couch_util:get_nested_json_value( TargetAttStub, - [<<"gzip_length">>] + [<<"encoding">>] ), - GzipLengthDefined = is_integer(TargetAttStubGzipLength), etap:is( - GzipLengthDefined, + TargetAttStubEnc, + <<"gzip">>, + "Attachment stub has encoding property set to gzip" + ), + TargetAttStubEncLength = couch_util:get_nested_json_value( + TargetAttStub, + [<<"encoded_length">>] + ), + EncLengthDefined = is_integer(TargetAttStubEncLength), + etap:is( + EncLengthDefined, true, - "Stubs have the gzip_length field properly defined" + "Stubs have the encoded_length field properly defined" ), - GzipLengthSmaller = (TargetAttStubGzipLength < TargetAttStubLength), + EncLengthSmaller = (TargetAttStubEncLength < TargetAttStubLength), etap:is( - GzipLengthSmaller, + EncLengthSmaller, true, - "Stubs have the gzip_length field smaller than their length field" + "Stubs have the encoded_length field smaller than their length field" ), ok. -- cgit v1.2.3