1010 poll_destination ,
1111 DestinationType ,
1212)
13+ import logging
14+
1315
1416from constants import (
1517 SOURCE_BUCKET ,
2527
2628seed_datas = [
2729 TestData ("Create" , "V0V8L" , [CREATE ]),
28- # TestData("Update", "8HK48", [CREATE, UPDATE]),
29- # TestData("Delete", "8HA94", [CREATE, UPDATE, DELETE]),
30- # TestData("Reinstate", "X26", [CREATE, DELETE, UPDATE]),
30+ TestData ("Update" , "8HK48" , [CREATE , UPDATE ]),
31+ TestData ("Delete" , "8HA94" , [CREATE , UPDATE , DELETE ]),
32+ TestData ("Reinstate" , "X26" , [CREATE , DELETE , UPDATE ]),
3133 # TestData("Update-Reinstate", "X8E5B", [CREATE, DELETE, UPDATE, UPDATE]),
3234 # TestData("Update-No Create", "YGM41", [UPDATE], success=False),
3335 # TestData("Delete-No Create", "YGJ", [DELETE], success=False),
3436 # TestData("Create with extended ascii characters in name", "YGA", [CREATE], inject_char=True),
3537]
3638
39+ logging .basicConfig (level = "INFO" )
40+ logger = logging .getLogger ()
41+ logger .setLevel ("INFO" )
42+
3743
3844class TestE2EBatch (unittest .TestCase ):
3945
4046 @unittest .skipIf (environment == "ref" , "Skip for ref" )
4147 def test_create_success (self ):
4248 """Test CREATE scenario."""
49+ start_time = time .time ()
4350 max_timeout = 1200 # seconds
4451
4552 test_datas : list [TestData ] = generate_csv_files (seed_datas )
@@ -62,17 +69,25 @@ def test_create_success(self):
6269 found_ack_key = poll_destination (test_data .file_name , ack_key )
6370 if found_ack_key :
6471 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 } " )
6573 else :
6674 pending = True
6775 if pending :
6876 time .sleep (1 )
6977
78+ logging .info (f"Finished polling for acks. Time taken: { time .time () - start_time :.1f} seconds" )
79+
7080 # Now validate all files have been processed correctly
7181 for test_data in test_datas :
7282 # Validate the ACK file
7383 inf_ack_content = get_file_content_from_s3 (ACK_BUCKET , test_data .ack_keys [DestinationType .INF ])
74- bus_ack_content = get_file_content_from_s3 (ACK_BUCKET , test_data .ack_keys [DestinationType .BUS ])
7584
7685 check_ack_file_content (inf_ack_content , "Success" , None , test_data .actions )
7786 validate_row_count (test_data .file_name , test_data .ack_keys [DestinationType .BUS ])
87+ # check row after header
88+
7889 # how to validate bus ack content?
90+ # bus_ack_content = get_file_content_from_s3(ACK_BUCKET, test_data.ack_keys[DestinationType.BUS])
91+
92+ logging .info (f"Completed all validations. Total time taken: { time .time () - start_time :.1f} seconds" )
93+
0 commit comments