@@ -374,7 +374,7 @@ async def _assert_db_skyscank8sjobs_coll(
374
374
}
375
375
376
376
377
- async def _patch_manifest (
377
+ async def _do_patch (
378
378
rc : RestClient ,
379
379
scan_id : str ,
380
380
progress : StrDict | None = None ,
@@ -460,9 +460,9 @@ async def _patch_progress_and_scan_metadata(
460
460
)
461
461
# update progress (update `scan_metadata` sometimes--not as important)
462
462
if i % 2 : # odd
463
- manifest = await _patch_manifest (rc , scan_id , progress = progress )
463
+ manifest = await _do_patch (rc , scan_id , progress = progress )
464
464
else : # even
465
- manifest = await _patch_manifest (
465
+ manifest = await _do_patch (
466
466
rc ,
467
467
scan_id ,
468
468
progress = progress ,
@@ -484,7 +484,7 @@ async def _server_reply_with_event_metadata(rc: RestClient, scan_id: str) -> Str
484
484
is_real_event = IS_REAL_EVENT ,
485
485
)
486
486
487
- await _patch_manifest (rc , scan_id , event_metadata = event_metadata )
487
+ manifest = await _do_patch (rc , scan_id , event_metadata = event_metadata )
488
488
489
489
# query by run+event id
490
490
resp = await rc .request (
@@ -526,7 +526,7 @@ async def _server_reply_with_event_metadata(rc: RestClient, scan_id: str) -> Str
526
526
)
527
527
assert [m ["scan_id" ] for m in resp ["manifests" ]] == [scan_id ]
528
528
529
- return event_metadata
529
+ return manifest
530
530
531
531
532
532
async def _send_result (
@@ -760,6 +760,12 @@ def get_tms_args(
760
760
return tms_args
761
761
762
762
763
+ async def _is_scan_complete (rc : RestClient , scan_id : str ) -> bool :
764
+ resp = await rc .request ("GET" , f"/scans/{ scan_id } /status" )
765
+ pprint .pprint (resp )
766
+ return resp ["scan_complete" ]
767
+
768
+
763
769
########################################################################################
764
770
# TESTS
765
771
########################################################################################
@@ -842,7 +848,7 @@ async def _after_scan_start_logic(
842
848
#
843
849
# INITIAL UPDATES
844
850
#
845
- event_metadata = await _server_reply_with_event_metadata (rc , scan_id )
851
+ manifest = await _server_reply_with_event_metadata (rc , scan_id )
846
852
# follow-up query
847
853
assert await rc .request ("GET" , f"/scan/{ scan_id } /result" ) == {}
848
854
resp = await rc .request ("GET" , f"/scan/{ scan_id } " )
@@ -867,17 +873,25 @@ async def _after_scan_start_logic(
867
873
#
868
874
# SEND RESULT(s)
869
875
#
870
- assert not manifest ["ewms_task" ][ "complete" ] # workforce is not done
876
+ assert not await _is_scan_complete ( rc , manifest ["scan_id" ]) # workforce is not done
871
877
result = await _send_result (rc , scan_id , manifest , True )
872
878
# wait as long as the server, so it'll mark as complete
873
879
await asyncio .sleep (test_wait_before_teardown + 1 )
874
880
manifest = await rc .request ("GET" , f"/scan/{ scan_id } /manifest" )
875
- assert manifest ["ewms_task" ][ "complete" ] # workforce is done
881
+ assert await _is_scan_complete ( rc , manifest ["scan_id" ]) # workforce is done
876
882
877
883
#
878
884
# DELETE SCAN
879
885
#
880
- await _delete_scan (rc , event_metadata , scan_id , manifest , result , True , True )
886
+ await _delete_scan (
887
+ rc ,
888
+ manifest ["event_metadata" ],
889
+ scan_id ,
890
+ manifest ,
891
+ result ,
892
+ True ,
893
+ True ,
894
+ )
881
895
882
896
883
897
POST_SCAN_BODY_FOR_TEST_01 = dict (** POST_SCAN_BODY , cluster = {"foobar" : 1 })
@@ -1112,7 +1126,7 @@ async def test_100__bad_data(
1112
1126
#
1113
1127
# INITIAL UPDATES
1114
1128
#
1115
- event_metadata = await _server_reply_with_event_metadata (rc , scan_id )
1129
+ manifest = await _server_reply_with_event_metadata (rc , scan_id )
1116
1130
# follow-up query
1117
1131
assert await rc .request ("GET" , f"/scan/{ scan_id } /result" ) == {}
1118
1132
resp = await rc .request ("GET" , f"/scan/{ scan_id } " )
@@ -1126,7 +1140,7 @@ async def test_100__bad_data(
1126
1140
f"400 Client Error: Cannot change an existing event_metadata for url: { rc .address } /scan/{ scan_id } /manifest"
1127
1141
),
1128
1142
) as e :
1129
- await _patch_manifest (
1143
+ await _do_patch (
1130
1144
rc ,
1131
1145
scan_id ,
1132
1146
event_metadata = dict (
@@ -1173,7 +1187,7 @@ async def test_100__bad_data(
1173
1187
f"400 Client Error: Cannot change an existing scan_metadata for url: { rc .address } /scan/{ scan_id } /manifest"
1174
1188
),
1175
1189
) as e :
1176
- await _patch_manifest (rc , scan_id , scan_metadata = {"boo" : "baz" , "bot" : "fox" })
1190
+ await _do_patch (rc , scan_id , scan_metadata = {"boo" : "baz" , "bot" : "fox" })
1177
1191
1178
1192
#
1179
1193
# SEND RESULT
@@ -1218,7 +1232,7 @@ async def test_100__bad_data(
1218
1232
# wait as long as the server, so it'll mark as complete
1219
1233
await asyncio .sleep (test_wait_before_teardown )
1220
1234
manifest = await rc .request ("GET" , f"/scan/{ scan_id } /manifest" )
1221
- assert manifest ["ewms_task" ][ "complete" ] # workforce is done
1235
+ assert await _is_scan_complete ( rc , manifest ["scan_id" ]) # workforce is done
1222
1236
1223
1237
#
1224
1238
# DELETE SCAN
0 commit comments