mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-23 07:11:36 +01:00
Merge pull request #13625 from danfengliu/fix-scan-all-py-test-script
Fix scan all python test script issue of missing test step
This commit is contained in:
commit
792a3c8c27
@ -4991,6 +4991,10 @@ definitions:
|
|||||||
'Success': 5
|
'Success': 5
|
||||||
'Error': 2,
|
'Error': 2,
|
||||||
'Running': 3
|
'Running': 3
|
||||||
|
ongoing:
|
||||||
|
type: boolean
|
||||||
|
description: A flag indicating job status of scan all .
|
||||||
|
|
||||||
SupportedWebhookEventTypes:
|
SupportedWebhookEventTypes:
|
||||||
type: object
|
type: object
|
||||||
description: Supportted webhook event types and notify types.
|
description: Supportted webhook event types and notify types.
|
||||||
|
@ -117,6 +117,21 @@ class System(base.Base):
|
|||||||
base._assert_status_code(expect_status_code, status_code)
|
base._assert_status_code(expect_status_code, status_code)
|
||||||
return base._get_id_from_header(header)
|
return base._get_id_from_header(header)
|
||||||
|
|
||||||
|
def wait_until_scans_all_finish(self, **kwargs):
|
||||||
|
client = self._get_client(**kwargs)
|
||||||
|
timeout_count = 50
|
||||||
|
scan_status=""
|
||||||
|
while True:
|
||||||
|
time.sleep(5)
|
||||||
|
timeout_count = timeout_count - 1
|
||||||
|
if (timeout_count == 0):
|
||||||
|
break
|
||||||
|
stats = client.scans_all_metrics_get()
|
||||||
|
print("Scan all status:", stats)
|
||||||
|
if stats.ongoing:
|
||||||
|
return
|
||||||
|
raise Exception("Error: Scan all job is timeout.")
|
||||||
|
|
||||||
def create_scan_all_schedule(self, schedule_type, cron = None, expect_status_code = 201, expect_response_body = None, **kwargs):
|
def create_scan_all_schedule(self, schedule_type, cron = None, expect_status_code = 201, expect_response_body = None, **kwargs):
|
||||||
client = self._get_client(**kwargs)
|
client = self._get_client(**kwargs)
|
||||||
scanschedule = swagger_client.AdminJobScheduleObj()
|
scanschedule = swagger_client.AdminJobScheduleObj()
|
||||||
|
@ -82,6 +82,7 @@ class TestScanAll(unittest.TestCase):
|
|||||||
|
|
||||||
#4. Trigger scan all event;
|
#4. Trigger scan all event;
|
||||||
self.system.scan_now(**ADMIN_CLIENT)
|
self.system.scan_now(**ADMIN_CLIENT)
|
||||||
|
self.system.wait_until_scans_all_finish(**ADMIN_CLIENT)
|
||||||
|
|
||||||
#5. Check if image in project_Alice and another image in project_Luca were both scanned.
|
#5. Check if image in project_Alice and another image in project_Luca were both scanned.
|
||||||
self.artifact.check_image_scan_result(TestScanAll.project_Alice_name, image_a, tag_Alice, **USER_ALICE_CLIENT)
|
self.artifact.check_image_scan_result(TestScanAll.project_Alice_name, image_a, tag_Alice, **USER_ALICE_CLIENT)
|
||||||
|
Loading…
Reference in New Issue
Block a user