@@ -134,9 +134,7 @@ def test_rs_plink_PML_T2(reset_state, srcRS, dstRS, plink, metrics_collector):
134134def test_rs_plink_PML_T3 (reset_state , srcRS , dstRS , plink ):
135135 """
136136 Test to validate handling of index creation failures during clone and replication phase due to
137- IndexOptionsConflict error (index with the same key spec already exists with a different name).
138- Since PLM temporarily creates unique indexes as non-unique, creation of index with the same options
139- but different name should fail. It's expected behavior, but all other indexes should be created successfully.
137+ IndexOptionsConflict error (index with the same key spec already exists with a different name). The failed index will be created during the finalization stage.
140138 """
141139 try :
142140 src = pymongo .MongoClient (srcRS .connection )
@@ -197,8 +195,6 @@ def test_rs_plink_PML_T3(reset_state, srcRS, dstRS, plink):
197195 name = "compound_test_sparse_index" , sparse = True
198196 )
199197
200- time .sleep (5 )
201-
202198 except Exception :
203199 raise
204200 finally :
@@ -219,28 +215,16 @@ def test_rs_plink_PML_T3(reset_state, srcRS, dstRS, plink):
219215 result = plink .finalize ()
220216 assert result is True , "Failed to finalize plink service"
221217
222- expected_mismatches = [
223- ("init_test_db.invalid_index_collection" , "compound_test_unique_index" ),
224- ("clone_test_db.invalid_index_collection" , "compound_test_unique_index" ),
225- ("repl_test_db.invalid_index_collection" , "compound_test_unique_index" )
226- ]
227-
228218 result , summary = compare_data_rs (srcRS , dstRS )
229- assert result is False , "Data mismatch after synchronization"
230-
231- missing_mismatches = [index for index in expected_mismatches if index not in summary ]
232- unexpected_mismatches = [mismatch for mismatch in summary if mismatch not in expected_mismatches ]
233-
234- assert not missing_mismatches , f"Expected mismatches missing: { missing_mismatches } "
235- if unexpected_mismatches :
236- pytest .fail ("Unexpected mismatches:\n " + "\n " .join (unexpected_mismatches ))
219+ assert result is True , "Data mismatch after synchronization"
237220
238221 plink_error , error_logs = plink .check_plink_errors ()
239222 expected_error = "ERR One or more indexes failed to create"
240223 if not plink_error :
241224 unexpected = [line for line in error_logs if expected_error not in line ]
242225 if unexpected :
243226 pytest .fail ("Unexpected error(s) in logs:\n " + "\n " .join (unexpected ))
227+ assert len (error_logs ) == 3
244228
245229@pytest .mark .timeout (300 ,func_only = True )
246230@pytest .mark .usefixtures ("start_cluster" )
@@ -674,7 +658,7 @@ def test_rs_plink_PML_T30(reset_state, srcRS, dstRS, plink):
674658 Test to validate handling of concurrent data clone and index build failure
675659 """
676660 src = pymongo .MongoClient (srcRS .connection )
677- dst = pymongo .MongoClient (dstRS .connection )
661+ pymongo .MongoClient (dstRS .connection )
678662 normal_docs = [{"a" : {"b" : 1 }, "words" : "omnibus" } for _ in range (20000 )]
679663 src ["init_test_db" ].invalid_text_collection1 .insert_many (normal_docs )
680664 src ["init_test_db" ].invalid_text_collection1 .insert_one ({"a" : {"b" : []}, "words" : "omnibus" })
@@ -699,7 +683,7 @@ def invalid_index_creation():
699683 t2 .start ()
700684 t1 .join ()
701685 t2 .join ()
702- assert plink .wait_for_repl_stage (timeout = 30 ) is True , "Failed to start replication stage"
686+ assert plink .wait_for_repl_stage (timeout = 60 ) is True , "Failed to start replication stage"
703687 assert plink .wait_for_zero_lag () is True , "Failed to catch up on replication"
704688 assert plink .finalize () is True , "Failed to finalize plink service"
705689 result , _ = compare_data_rs (srcRS , dstRS )
0 commit comments