77 validate_row_count ,
88 generate_csv_files ,
99 TestData ,
10- poll_destination ,
1110 DestinationType ,
1211)
1312import logging
3029 TestData ("Update" , "8HK48" , [CREATE , UPDATE ]),
3130 TestData ("Delete" , "8HA94" , [CREATE , UPDATE , DELETE ]),
3231 TestData ("Reinstate" , "X26" , [CREATE , DELETE , UPDATE ]),
33- # TestData("Update-Reinstate", "X8E5B", [CREATE, DELETE, UPDATE, UPDATE]),
34- # TestData("Update-No Create", "YGM41", [UPDATE], success=False),
35- # TestData("Delete-No Create", "YGJ", [DELETE], success=False),
36- # TestData("Create with extended ascii characters in name", "YGA", [CREATE], inject_char=True),
32+ TestData ("Update no Create" , "YGM41" , [UPDATE ], success = False ),
33+ TestData ("Delete no Create" , "YGJ" , [DELETE ], success = False ),
34+ TestData ("Create with extended ascii characters in name" , "YGA" , [CREATE ], inject_char = True ),
3735]
3836
3937logging .basicConfig (level = "INFO" )
@@ -51,10 +49,10 @@ def test_create_success(self):
5149
5250 test_datas : list [TestData ] = generate_csv_files (seed_datas )
5351
54- for test in test_datas :
55-
56- key = upload_file_to_s3 (test .file_name , SOURCE_BUCKET , INPUT_PREFIX )
57- test .key = key
52+ for test_data in test_datas :
53+ logging . info ( f"Upload { test_data . file_name } " )
54+ key = upload_file_to_s3 (test_data .file_name , SOURCE_BUCKET , INPUT_PREFIX )
55+ test_data .key = key
5856
5957 # dictionary of file name to track whether inf and bus acks have been received
6058 start_time = time .time ()
@@ -63,15 +61,7 @@ def test_create_success(self):
6361 while pending and (time .time () - start_time ) < max_timeout :
6462 pending = False
6563 for test_data in test_datas :
66- # loop through keys in test (inf and bus)
67- for ack_key in test_data .ack_keys .keys ():
68- if not test_data .ack_keys [ack_key ]:
69- found_ack_key = poll_destination (test_data .file_name , ack_key )
70- if found_ack_key :
71- test_data .ack_keys [ack_key ] = found_ack_key
72- logging .info (f"Found { ack_key } ack for { test_data .file_name } : { found_ack_key } " )
73- else :
74- pending = True
64+ pending = test_data .poll_destination (pending , logging )
7565 if pending :
7666 time .sleep (1 )
7767
@@ -90,4 +80,3 @@ def test_create_success(self):
9080 # bus_ack_content = get_file_content_from_s3(ACK_BUCKET, test_data.ack_keys[DestinationType.BUS])
9181
9282 logging .info (f"Completed all validations. Total time taken: { time .time () - start_time :.1f} seconds" )
93-
0 commit comments