@@ -123,6 +123,28 @@ def test_debug_id_hash_format_put_get_parse_obj(archivers, request):
123123 assert meta_read .get ("clevel" ) == c .compressor .level
124124
125125
126+ def test_debug_format_obj_respects_type (archivers , request ):
127+ """Test format-obj uses the type from metadata JSON, not just ROBJ_FILE_STREAM."""
128+ archiver = request .getfixturevalue (archivers )
129+ cmd (archiver , "repo-create" , RK_ENCRYPTION )
130+ data = b"some data" * 100
131+ meta_dict = {"some" : "property" , "type" : ROBJ_ARCHIVE_STREAM }
132+ meta = json .dumps (meta_dict ).encode ()
133+ create_regular_file (archiver .input_path , "data.bin" , contents = data )
134+ create_regular_file (archiver .input_path , "meta.json" , contents = meta )
135+ output = cmd (archiver , "debug" , "id-hash" , "input/data.bin" )
136+ id_hash = output .strip ()
137+ cmd (archiver , "debug" , "format-obj" , id_hash , "input/data.bin" , "input/meta.json" , "input/repoobj.bin" )
138+ output = cmd (archiver , "debug" , "put-obj" , id_hash , "input/repoobj.bin" )
139+ assert id_hash in output
140+ output = cmd (archiver , "debug" , "get-obj" , id_hash , "output/object.bin" )
141+ assert id_hash in output
142+ cmd (archiver , "debug" , "parse-obj" , id_hash , "output/object.bin" , "output/data.bin" , "output/meta.json" )
143+ with open ("output/meta.json" ) as f :
144+ meta_read = json .load (f )
145+ assert meta_read ["type" ] == ROBJ_ARCHIVE_STREAM
146+
147+
126148def test_debug_dump_manifest (archivers , request ):
127149 archiver = request .getfixturevalue (archivers )
128150 create_regular_file (archiver .input_path , "file1" , size = 1024 * 80 )
0 commit comments