@@ -98,6 +98,21 @@ def test_clone_document_sharded(t: Testing, phase: Runner.Phase):
9898
9999 t .compare_all_sharded ()
100100
101+ @pytest .mark .parametrize ("phase" , [Runner .Phase .CLONE ])
102+ def test_clone_document_sharded_with_varying_sizes (t : Testing , phase : Runner .Phase ):
103+ with t .run (phase ):
104+ t .source ["db_1" ].create_collection ("coll_1" )
105+ t .source .admin .command ("shardCollection" , "db_1.coll_1" , key = {"_id" : "hashed" })
106+ # insert documents with varying sizes to produce fractional avgObjSize
107+ docs = [
108+ {"_id" : 1 , "name" : "Alice" , "age" : 30 , "data" : "x" * 15 },
109+ {"_id" : 2 , "name" : "Bob" , "age" : 25 , "data" : "y" * 47 },
110+ {"_id" : 3 , "name" : "Charlie" , "age" : 35 , "data" : "z" * 73 },
111+ {"_id" : 4 , "name" : "Diana" , "age" : 28 , "data" : "a" * 22 },
112+ {"_id" : 5 , "name" : "Eve" , "age" : 32 , "data" : "b" * 91 },
113+ ]
114+ t .source ["db_1" ]["coll_1" ].insert_many (docs )
115+ t .compare_all_sharded ()
101116
102117@pytest .mark .parametrize ("phase" , [Runner .Phase .APPLY ])
103118def test_shard_key_update_duplicate_key_error (t : Testing , phase : Runner .Phase ):
0 commit comments