Add CloudEvents format webhook testcase (#18908)

Fix #18616

Signed-off-by: Yang Jiao <jiaoya@vmware.com>
This commit is contained in:
Yang Jiao 2023-07-10 15:05:56 +08:00 committed by GitHub
parent 78799ccb2f
commit cbb211e670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 247 additions and 38 deletions

View File

@ -9,15 +9,20 @@ Switch To Project Webhooks
Retry Element Click xpath=//project-detail//a[contains(.,'Webhooks')]
Create A New Webhook
[Arguments] ${webhook_name} ${webhook_endpoint_url} ${event_type}=@{EMPTY}
[Arguments] ${webhook_name} ${webhook_endpoint_url} ${payload_format}=Default ${event_type}=@{EMPTY}
Retry Element Click ${new_webhook_button_xpath}
Retry Text Input ${webhook_name_xpath} ${webhook_name}
Retry Text Input ${webhook_endpoint_id_xpath} ${webhook_endpoint_url}
Run Keyword If '${payload_format}' != 'Default' Select Payload Format ${payload_format}
${len}= Get Length ${event_type}
Run Keyword If ${len} > 0 Select Event Type @{event_type}
Retry Double Keywords When Error Retry Element Click ${create_webhooks_continue_button_xpath} Retry Wait Until Page Not Contains Element ${create_webhooks_continue_button_xpath}
Retry Wait Until Page Contains ${webhook_name}
Select Payload Format
[Arguments] ${payload_format}
Retry Double Keywords When Error Retry Element Click ${webhook_payload_format_xpath} Retry Element Click ${webhook_payload_format_xpath}//option[@value='${payload_format}']
Select Event Type
[Arguments] @{event_type}
${elements}= Get WebElements //form//div[contains(@class,'clr-control-inline')]//label
@ -29,7 +34,7 @@ Select Event Type
END
Update A Webhook
[Arguments] ${old_webhook_name} ${new_webhook_name} ${new_webhook_enpoint}
[Arguments] ${old_webhook_name} ${new_webhook_name} ${new_webhook_enpoint} ${payload_format}=Default
# select one webhook
Retry Element Click xpath=//clr-dg-row[contains(.,'${old_webhook_name}')]//div[contains(@class,'datagrid-select')]
Retry Element Click ${action_webhook_xpath}
@ -42,6 +47,7 @@ Update A Webhook
Retry Element Click ${action_webhook_edit_button}
Retry Text Input ${webhook_name_xpath} ${new_webhook_name}
Retry Text Input ${webhook_endpoint_id_xpath} ${new_webhook_enpoint}
Select Payload Format ${payload_format}
Retry Double Keywords When Error Retry Element Click ${edit_webhooks_save_button_xpath} Retry Wait Until Page Not Contains Element ${edit_webhooks_save_button_xpath}
Retry Wait Until Page Contains ${new_webhook_name}

View File

@ -5,6 +5,7 @@ Documentation This resource provides any keywords related to the Harbor private
${new_webhook_button_xpath} xpath=//*[@id='new-webhook']
${webhook_name_xpath} xpath=//*[@id='name']
${webhook_endpoint_id_xpath} xpath=//*[@id='edit_endpoint_url']
${webhook_payload_format_xpath} xpath=//*[@id='payload-format']
${webhook_auth_header_xpath} xpath=//*[@id='auth_header']
${action_webhook_xpath} xpath=//*[@id='action-webhook']
${action_webhook_edit_button} xpath=//*[@id='edit-webhook']

View File

@ -400,62 +400,107 @@ Prepare Image Package Test Files
${rc} ${output}= Run And Return Rc And Output bash tests/robot-cases/Group0-Util/prepare_imgpkg_test_files.sh ${files_path}
Verify Webhook By Artifact Pushed Event
[Arguments] ${project_name} ${image} ${tag} ${user} ${pwd} ${webhook_handle}
[Arguments] ${project_name} ${webhook_name} ${image} ${tag} ${user} ${pwd} ${harbor_handle} ${webhook_handle} ${payload_format}=Default
&{artifact_pushed_property}= Create Dictionary
Run Keyword If '${payload_format}' == 'Default' Set To Dictionary ${artifact_pushed_property} type=PUSH_ARTIFACT operator=${user} namespace=${project_name} name=${image} tag=${tag}
... ELSE Set To Dictionary ${artifact_pushed_property} specversion=1.0 type=harbor.artifact.pushed datacontenttype=application/json namespace=${project_name} name=${image} repo_full_name=${project_name}/${image} tag=${tag} operator=${user}
Switch Window ${webhook_handle}
Delete All Requests
Push Image With Tag ${ip} ${user} ${pwd} ${project_name} ${image} ${tag}
&{artifact_pushed_property}= Create Dictionary type=PUSH_ARTIFACT operator=${user} namespace=${project_name} name=${image} tag=${tag}
Switch Window ${harbor_handle}
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//div[contains(@class,'datagrid-select')]
${webhook_execution_id}= Get Latest Webhook Execution ID
Retry Action Keyword Verify Webhook Execution ${webhook_execution_id} WEBHOOK Success Artifact pushed ${artifact_pushed_property}
Verify Webhook Execution Log ${webhook_execution_id}
Switch Window ${webhook_handle}
Verify Request &{artifact_pushed_property}
Clean All Local Images
Verify Webhook By Artifact Pulled Event
[Arguments] ${project_name} ${image} ${tag} ${user} ${pwd} ${webhook_handle}
[Arguments] ${project_name} ${webhook_name} ${image} ${tag} ${user} ${pwd} ${harbor_handle} ${webhook_handle} ${payload_format}=Default
&{artifact_pulled_property}= Create Dictionary
Run Keyword If '${payload_format}' == 'Default' Set To Dictionary ${artifact_pulled_property} type=PULL_ARTIFACT operator=${user} namespace=${project_name} name=${image}
... ELSE Set To Dictionary ${artifact_pulled_property} specversion=1.0 type=harbor.artifact.pulled datacontenttype=application/json namespace=${project_name} name=${image} repo_full_name=${project_name}/${image} operator=${user}
Switch Window ${webhook_handle}
Delete All Requests
Clean All Local Images
Docker Login ${ip} ${user} ${pwd}
Docker Pull ${ip}/${project_name}/${image}:${tag}
Docker Logout ${ip}
&{artifact_pulled_property}= Create Dictionary type=PULL_ARTIFACT operator=${user} namespace=${project_name} name=${image}
Switch Window ${harbor_handle}
Go Into Project ${project_name}
Switch To Project Webhooks
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//div[contains(@class,'datagrid-select')]
${webhook_execution_id}= Get Latest Webhook Execution ID
Retry Action Keyword Verify Webhook Execution ${webhook_execution_id} WEBHOOK Success Artifact pulled ${artifact_pulled_property}
Verify Webhook Execution Log ${webhook_execution_id}
Switch Window ${webhook_handle}
Verify Request &{artifact_pulled_property}
Verify Webhook By Artifact Deleted Event
[Arguments] ${project_name} ${image} ${tag} ${user} ${harbor_handle} ${webhook_handle}
[Arguments] ${project_name} ${webhook_name} ${image} ${tag} ${user} ${harbor_handle} ${webhook_handle} ${payload_format}=Default
&{artifact_deleted_property}= Create Dictionary
Run Keyword If '${payload_format}' == 'Default' Set To Dictionary ${artifact_deleted_property} type=DELETE_ARTIFACT operator=${user} namespace=${project_name} name=${image} tag=${tag}
... ELSE Set To Dictionary ${artifact_deleted_property} specversion=1.0 type=harbor.artifact.deleted datacontenttype=application/json namespace=${project_name} name=${image} repo_full_name=${project_name}/${image} tag=${tag} operator=${user}
Switch Window ${webhook_handle}
Delete All Requests
Switch Window ${harbor_handle}
Go Into Repo ${project_name} ${image}
@{tag_list} Create List ${tag}
Multi-delete Artifact @{tag_list}
Go Into Project ${project_name}
Switch To Project Webhooks
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//div[contains(@class,'datagrid-select')]
${webhook_execution_id}= Get Latest Webhook Execution ID
Retry Action Keyword Verify Webhook Execution ${webhook_execution_id} WEBHOOK Success Artifact deleted ${artifact_deleted_property}
Verify Webhook Execution Log ${webhook_execution_id}
Switch Window ${webhook_handle}
&{artifact_deleted_property}= Create Dictionary type=DELETE_ARTIFACT operator=${user} namespace=${project_name} name=${image} tag=${tag}
Verify Request &{artifact_deleted_property}
Verify Webhook By Scanning Finished Event
[Arguments] ${project_name} ${image} ${tag} ${harbor_handle} ${webhook_handle}
[Arguments] ${project_name} ${webhook_name} ${image} ${tag} ${harbor_handle} ${webhook_handle} ${payload_format}=Default
&{scanning_finished_property}= Create Dictionary
Run Keyword If '${payload_format}' == 'Default' Set To Dictionary ${scanning_finished_property} type=SCANNING_COMPLETED scan_status=Success namespace=${project_name} tag=${tag} name=${image}
... ELSE Set To Dictionary ${scanning_finished_property} specversion=1.0 type=harbor.scan.completed datacontenttype=application/json namespace=${project_name} name=${image} repo_full_name=${project_name}/${image} tag=${tag} scan_status=Success
Switch Window ${webhook_handle}
Delete All Requests
Switch Window ${harbor_handle}
Go Into Repo ${project_name} ${image}
Scan Repo ${tag} Succeed
Go Into Project ${project_name}
Switch To Project Webhooks
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//div[contains(@class,'datagrid-select')]
${webhook_execution_id}= Get Latest Webhook Execution ID
Retry Action Keyword Verify Webhook Execution ${webhook_execution_id} WEBHOOK Success Scanning finished ${scanning_finished_property}
Verify Webhook Execution Log ${webhook_execution_id}
Switch Window ${webhook_handle}
&{scanning_finished_property}= Create Dictionary type=SCANNING_COMPLETED scan_status=Success namespace=${project_name} tag=${tag} name=${image}
Verify Request &{scanning_finished_property}
Verify Webhook By Scanning Stopped Event
[Arguments] ${project_name} ${image} ${tag} ${harbor_handle} ${webhook_handle}
[Arguments] ${project_name} ${webhook_name} ${image} ${tag} ${harbor_handle} ${webhook_handle} ${payload_format}=Default
&{scanning_stopped_property}= Create Dictionary
Run Keyword If '${payload_format}' == 'Default' Set To Dictionary ${scanning_stopped_property} type=SCANNING_STOPPED scan_status=Stopped namespace=${project_name} tag=${tag} name=${image}
... ELSE Set To Dictionary ${scanning_stopped_property} specversion=1.0 type=harbor.scan.stopped datacontenttype=application/json namespace=${project_name} name=${image} repo_full_name=${project_name}/${image} tag=${tag} scan_status=Stopped
Switch Window ${webhook_handle}
Delete All Requests
Switch Window ${harbor_handle}
Scan Artifact ${project_name} ${image}
Stop Scan Artifact
Check Scan Artifact Job Status Is Stopped
Go Into Project ${project_name}
Switch To Project Webhooks
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//div[contains(@class,'datagrid-select')]
${webhook_execution_id}= Get Latest Webhook Execution ID
Retry Action Keyword Verify Webhook Execution ${webhook_execution_id} WEBHOOK Success Scanning stopped ${scanning_stopped_property}
Verify Webhook Execution Log ${webhook_execution_id}
Switch Window ${webhook_handle}
&{scanning_stopped_property}= Create Dictionary type=SCANNING_STOPPED scan_status=Stopped namespace=${project_name} tag=${tag} name=${image}
Verify Request &{scanning_stopped_property}
Verify Webhook By Tag Retention Finished Event
[Arguments] ${project_name} ${image} ${tag1} ${tag2} ${harbor_handle} ${webhook_handle}
[Arguments] ${project_name} ${webhook_name} ${image} ${tag1} ${tag2} ${harbor_handle} ${webhook_handle} ${payload_format}=Default
&{tag_retention_finished_property}= Create Dictionary
Run Keyword If '${payload_format}' == 'Default' Set To Dictionary ${tag_retention_finished_property} type=TAG_RETENTION operator=MANUAL project_name=${project_name} name_tag=${image}:${tag2} status=SUCCESS
... ELSE Set To Dictionary ${tag_retention_finished_property} specversion=1.0 type=harbor.tag_retention.finished datacontenttype=application/json project_name=${project_name} name_tag=${image}:${tag2} status=SUCCESS
Switch Window ${webhook_handle}
Delete All Requests
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${project_name} ${image} ${tag1} ${tag1}
@ -464,24 +509,39 @@ Verify Webhook By Tag Retention Finished Event
Go Into Project ${project_name}
Switch To Tag Retention
Execute Run ${image}
Go Into Project ${project_name}
Switch To Project Webhooks
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//div[contains(@class,'datagrid-select')]
${webhook_execution_id}= Get Latest Webhook Execution ID
Retry Action Keyword Verify Webhook Execution ${webhook_execution_id} WEBHOOK Success Tag retention finished ${tag_retention_finished_property}
Verify Webhook Execution Log ${webhook_execution_id}
Switch Window ${webhook_handle}
&{tag_retention_finished_property}= Create Dictionary type=TAG_RETENTION operator=MANUAL project_name=${project_name} name_tag=${image}:${tag2} status=SUCCESS
Verify Request &{tag_retention_finished_property}
Wait Until Page Contains "total":2
Wait Until Page Contains "retained":1
Verify Webhook By Replication Status Changed Event
[Arguments] ${project_name} ${project_dest_name} ${replication_rule_name} ${harbor_handle} ${webhook_handle}
[Arguments] ${project_name} ${webhook_name} ${project_dest_name} ${replication_rule_name} ${harbor_handle} ${webhook_handle} ${payload_format}=Default
&{replication_finished_property}= Create Dictionary
Run Keyword If '${payload_format}' == 'Default' Set To Dictionary ${replication_finished_property} type=REPLICATION operator=MANUAL registry_type=harbor harbor_hostname=${ip}
... ELSE Set To Dictionary ${replication_finished_property} specversion=1.0 type=harbor.replication.status.changed datacontenttype=application/json trigger_type=MANUAL namespace=${project_name}
Switch Window ${webhook_handle}
Delete All Requests
Switch Window ${harbor_handle}
Switch To Replication Manage
Select Rule And Replicate ${replication_rule_name}
Check Latest Replication Job Status Succeeded
Go Into Project ${project_name}
Switch To Project Webhooks
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//div[contains(@class,'datagrid-select')]
${webhook_execution_id}= Get Latest Webhook Execution ID
Retry Action Keyword Verify Webhook Execution ${webhook_execution_id} WEBHOOK Success Replication status changed ${replication_finished_property}
Verify Webhook Execution Log ${webhook_execution_id}
Switch Window ${webhook_handle}
&{replication_finished_property}= Create Dictionary type=REPLICATION operator=MANUAL registry_type=harbor harbor_hostname=${ip}
Verify Request &{replication_finished_property}
Verify Webhook By Quota Near Threshold Event And Quota Exceed Event
[Arguments] ${webhook_endpoint_url} ${harbor_handle} ${webhook_handle}
[Arguments] ${webhook_endpoint_url} ${harbor_handle} ${webhook_handle} ${payload_format}=Default
${d}= Get Current Date result_format=%m%s
${image}= Set Variable nginx
${tag1}= Set Variable 1.17.6
@ -490,26 +550,46 @@ Verify Webhook By Quota Near Threshold Event And Quota Exceed Event
Create An New Project And Go Into Project project${d} storage_quota=${storage_quota} storage_quota_unit=MiB
Switch To Project Webhooks
${event_type} Create List Quota near threshold
Create A New Webhook webhook${d} ${webhook_endpoint_url} ${event_type}
Create A New Webhook webhook${d} ${webhook_endpoint_url} ${payload_format} ${event_type}
&{quota_near_threshold_property}= Create Dictionary
Run Keyword If '${payload_format}' == 'Default' Set To Dictionary ${quota_near_threshold_property} type=QUOTA_WARNING name=nginx namespace=project${d}
... ELSE Set To Dictionary ${quota_near_threshold_property} specversion=1.0 type=harbor.quota.warned datacontenttype=application/json name=${image} repo_full_name=project${d}/${image} namespace=project${d}
Switch Window ${webhook_handle}
Delete All Requests
# Quota near threshold
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image} ${tag1} ${tag1}
&{quota_near_threshold_property}= Create Dictionary type=QUOTA_WARNING name=nginx namespace=project${d}
Switch Window ${harbor_handle}
Retry Element Click xpath=//clr-dg-row[contains(.,'webhook${d}')]//div[contains(@class,'datagrid-select')]
${webhook_execution_id}= Get Latest Webhook Execution ID
Retry Action Keyword Verify Webhook Execution ${webhook_execution_id} WEBHOOK Success Quota near threshold ${quota_near_threshold_property}
Verify Webhook Execution Log ${webhook_execution_id}
Switch Window ${webhook_handle}
Verify Request &{quota_near_threshold_property}
Retry Action Keyword Verify Webhook By Quota Exceed Event project${d} webhook${d} ${image} ${tag2} ${webhook_endpoint_url} ${storage_quota} ${harbor_handle} ${webhook_handle}
Retry Action Keyword Verify Webhook By Quota Exceed Event project${d} webhook${d} ${image} ${tag2} ${webhook_endpoint_url} ${storage_quota} ${harbor_handle} ${webhook_handle} ${payload_format}
Verify Webhook By Quota Exceed Event
[Arguments] ${project_name} ${webhook_name} ${image} ${tag} ${webhook_endpoint_url} ${storage_quota} ${harbor_handle} ${webhook_handle}
[Arguments] ${project_name} ${webhook_name} ${image} ${tag} ${webhook_endpoint_url} ${storage_quota} ${harbor_handle} ${webhook_handle} ${payload_format}=Default
&{quota_exceed_property}= Create Dictionary
Run Keyword If '${payload_format}' == 'Default' Set To Dictionary ${quota_exceed_property} type=QUOTA_EXCEED name=${image} namespace=${project_name}
... ELSE Set To Dictionary ${quota_exceed_property} specversion=1.0 type=harbor.quota.exceeded datacontenttype=application/json name=${image} repo_full_name=${project_name}/${image} namespace=${project_name}
# Quota exceed
Switch Window ${harbor_handle}
Go Into Project ${project_name}
Switch To Project Webhooks
Delete A Webhook ${webhook_name}
${event_type} Create List Quota exceed
Create A New Webhook ${webhook_name} ${webhook_endpoint_url} ${event_type}
Create A New Webhook ${webhook_name} ${webhook_endpoint_url} ${payload_format} ${event_type}
Switch Window ${webhook_handle}
Delete All Requests
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${project_name} ${image}:${tag} err_msg=adding 21.1 MiB of storage resource, which when updated to current usage of 48.5 MiB will exceed the configured upper limit of ${storage_quota}.0 MiB.
&{quota_exceed_property}= Create Dictionary type=QUOTA_EXCEED name=${image} namespace=${project_name}
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${project_name} ${image}:${tag}
Switch Window ${harbor_handle}
Go Into Project ${project_name}
Switch To Project Webhooks
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//div[contains(@class,'datagrid-select')]
${webhook_execution_id}= Get Latest Webhook Execution ID
Retry Action Keyword Verify Webhook Execution ${webhook_execution_id} WEBHOOK Success Quota exceed ${quota_exceed_property}
Verify Webhook Execution Log ${webhook_execution_id}
Switch Window ${webhook_handle}
Verify Request &{quota_exceed_property}
Create Schedules For Job Service Dashboard Schedules

View File

@ -20,10 +20,31 @@ Library Process
*** Keywords ***
Delete All Requests
Sleep 3
Run Keyword And Ignore Error Button Click //button[contains(., 'Delete all requests')]
Run Keyword And Ignore Error Click button //button[contains(., 'Delete all requests')]
Verify Request
[Arguments] &{property}
FOR ${key} IN @{property.keys()}
Wait Until Page Contains "${key}":"${property['${key}']}"
END
END
Get Latest Webhook Execution ID
${execution_id}= Get Text //clr-dg-row[1]//clr-dg-cell[1]//a
[Return] ${execution_id}
Verify Webhook Execution
[Arguments] ${execution_id} ${vendor_type} ${status} ${event_type} ${payload_data}
Retry Wait Until Page Contains Element //clr-dg-row[.//clr-dg-cell/a[text()=${execution_id}]]//clr-dg-cell[3][contains(.,'${status}')]
Wait Until Page Contains Element //clr-dg-row[.//clr-dg-cell/a[text()=${execution_id}]]//clr-dg-cell[2][contains(.,'WEBHOOK')]
Wait Until Page Contains Element //clr-dg-row[.//clr-dg-cell/a[text()=${execution_id}]]//clr-dg-cell[4][contains(.,'${event_type}')]
Retry Element Click //clr-dg-row[.//clr-dg-cell/a[text()=${execution_id}]]//clr-dg-cell[5]
FOR ${key} IN @{payload_data.keys()}
Wait Until Page Contains "${key}": "${payload_data['${key}']}"
END
Verify Webhook Execution Log
[Arguments] ${execution_id} ${log}=success to run webhook job
Retry Link Click //clr-dg-row//clr-dg-cell/a[text()=${execution_id}]
Retry Link Click //clr-dg-row[1]//clr-dg-cell[5]//a
Switch Window locator=NEW
Wait Until Page Contains ${log}

View File

@ -31,8 +31,8 @@ Test Case - Webhook CRUD
Switch To Project Webhooks
# create more than one webhooks
Create A New Webhook webhook${d} https://test.com
Create A New Webhook webhook2${d} https://test2.com
Update A Webhook webhook${d} newWebhook${d} https://new-test.com
Create A New Webhook webhook2${d} https://test2.com CloudEvents
Update A Webhook webhook${d} newWebhook${d} https://new-test.com CloudEvents
Enable/Deactivate State of Same Webhook newWebhook${d}
Delete A Webhook newWebhook${d}
Close Browser
@ -50,16 +50,16 @@ Test Case - Artifact Event Type Webhook Functionality
Create An New Project And Go Into Project project${d}
Switch To Project Webhooks
${event_type} Create List Artifact deleted Artifact pulled Artifact pushed
Create A New Webhook webhook${d} ${webhook_endpoint_url} ${event_type}
Create A New Webhook webhook${d} ${webhook_endpoint_url} Default ${event_type}
${handles}= Get Window Handles
${webhook_handle}= Set Variable ${handles}[0]
${harbor_handle}= Set Variable ${handles}[1]
# Artifact pushed
Retry Action Keyword Verify Webhook By Artifact Pushed Event project${d} ${image} ${tag} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${webhook_handle}
Retry Action Keyword Verify Webhook By Artifact Pushed Event project${d} webhook${d} ${image} ${tag} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${harbor_handle} ${webhook_handle}
# Artifact pulled
Retry Action Keyword Verify Webhook By Artifact Pulled Event project${d} ${image} ${tag} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${webhook_handle}
Retry Action Keyword Verify Webhook By Artifact Pulled Event project${d} webhook${d} ${image} ${tag} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${harbor_handle} ${webhook_handle}
# Artifact deleted
Retry Action Keyword Verify Webhook By Artifact Deleted Event project${d} ${image} ${tag} ${HARBOR_ADMIN} ${harbor_handle} ${webhook_handle}
Retry Action Keyword Verify Webhook By Artifact Deleted Event project${d} webhook${d} ${image} ${tag} ${HARBOR_ADMIN} ${harbor_handle} ${webhook_handle}
Close Browser
Test Case - Scan Event Type Webhook Functionality
@ -79,14 +79,14 @@ Test Case - Scan Event Type Webhook Functionality
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image2} ${tag2} ${tag2}
Switch To Project Webhooks
${event_type} Create List Scanning finished Scanning stopped
Create A New Webhook webhook${d} ${webhook_endpoint_url} ${event_type}
Create A New Webhook webhook${d} ${webhook_endpoint_url} Default ${event_type}
${handles}= Get Window Handles
${webhook_handle}= Set Variable ${handles}[0]
${harbor_handle}= Set Variable ${handles}[1]
# Scanning finished
Retry Action Keyword Verify Webhook By Scanning Finished Event project${d} ${image1} ${tag1} ${harbor_handle} ${webhook_handle}
Retry Action Keyword Verify Webhook By Scanning Finished Event project${d} webhook${d} ${image1} ${tag1} ${harbor_handle} ${webhook_handle}
# Scanning stopped
Retry Action Keyword Verify Webhook By Scanning Stopped Event project${d} ${image2} ${tag2} ${harbor_handle} ${webhook_handle}
Retry Action Keyword Verify Webhook By Scanning Stopped Event project${d} webhook${d} ${image2} ${tag2} ${harbor_handle} ${webhook_handle}
Close Browser
Test Case - Tag Retention And Replication Event Type Webhook Functionality
@ -107,7 +107,7 @@ Test Case - Tag Retention And Replication Event Type Webhook Functionality
Edit A Tag Retention Rule ** ${tag1}
Switch To Project Webhooks
${event_type} Create List Tag retention finished Replication status changed
Create A New Webhook webhook${d} ${webhook_endpoint_url} ${event_type}
Create A New Webhook webhook${d} ${webhook_endpoint_url} Default ${event_type}
Switch To Registries
Create A New Endpoint harbor e${d} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
@ -116,9 +116,9 @@ Test Case - Tag Retention And Replication Event Type Webhook Functionality
${webhook_handle}= Set Variable ${handles}[0]
${harbor_handle}= Set Variable ${handles}[1]
# Tag retention finished
Retry Action Keyword Verify Webhook By Tag Retention Finished Event project${d} ${image} ${tag1} ${tag2} ${harbor_handle} ${webhook_handle}
Retry Action Keyword Verify Webhook By Tag Retention Finished Event project${d} webhook${d} ${image} ${tag1} ${tag2} ${harbor_handle} ${webhook_handle}
# Replication status changed
Retry Action Keyword Verify Webhook By Replication Status Changed Event project${d} project_push_dest${d} rule_push_${d} ${harbor_handle} ${webhook_handle}
Retry Action Keyword Verify Webhook By Replication Status Changed Event project${d} webhook${d} project_push_dest${d} rule_push_${d} ${harbor_handle} ${webhook_handle}
Close Browser
Test Case - Tag Quota Event Type Webhook Functionality
@ -133,3 +133,104 @@ Test Case - Tag Quota Event Type Webhook Functionality
${harbor_handle}= Set Variable ${handles}[1]
Retry Action Keyword Verify Webhook By Quota Near Threshold Event And Quota Exceed Event ${webhook_endpoint_url} ${harbor_handle} ${webhook_handle}
Close Browser
Test Case - Artifact Event Type Webhook Functionality By CloudEvents Format
[Tags] artifact_webhook_cloudevents need_webhook_endpoint
Init Chrome Driver
${image}= Set Variable busybox
${tag}= Set Variable latest
${payload_format}= Set Variable CloudEvents
${d}= Get Current Date result_format=%m%s
Go To http://${WEBHOOK_ENDPOINT}
${webhook_endpoint_url}= Get Text //p//code
New Tab
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d}
Switch To Project Webhooks
${event_type} Create List Artifact deleted Artifact pulled Artifact pushed
Create A New Webhook webhook${d} ${webhook_endpoint_url} ${payload_format} ${event_type}
${handles}= Get Window Handles
${webhook_handle}= Set Variable ${handles}[0]
${harbor_handle}= Set Variable ${handles}[1]
# Artifact pushed
Retry Action Keyword Verify Webhook By Artifact Pushed Event project${d} webhook${d} ${image} ${tag} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${harbor_handle} ${webhook_handle} ${payload_format}
# Artifact pulled
Retry Action Keyword Verify Webhook By Artifact Pulled Event project${d} webhook${d} ${image} ${tag} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${harbor_handle} ${webhook_handle} ${payload_format}
# Artifact deleted
Retry Action Keyword Verify Webhook By Artifact Deleted Event project${d} webhook${d} ${image} ${tag} ${HARBOR_ADMIN} ${harbor_handle} ${webhook_handle} ${payload_format}
Close Browser
Test Case - Scan Event Type Webhook Functionality By CloudEvents Format
[Tags] scan_webhook_cloudevents need_webhook_endpoint
Init Chrome Driver
${image1}= Set Variable busybox
${tag1}= Set Variable latest
${image2}= Set Variable goharbor/harbor-e2e-engine
${tag2}= Set Variable 5.0.0-api
${payload_format}= Set Variable CloudEvents
${d}= Get Current Date result_format=%m%s
Go To http://${WEBHOOK_ENDPOINT}
${webhook_endpoint_url}= Get Text //p//code
New Tab
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d}
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image1} ${tag1} ${tag1}
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image2} ${tag2} ${tag2}
Switch To Project Webhooks
${event_type} Create List Scanning finished Scanning stopped
Create A New Webhook webhook${d} ${webhook_endpoint_url} ${payload_format} ${event_type}
${handles}= Get Window Handles
${webhook_handle}= Set Variable ${handles}[0]
${harbor_handle}= Set Variable ${handles}[1]
# Scanning finished
Retry Action Keyword Verify Webhook By Scanning Finished Event project${d} webhook${d} ${image1} ${tag1} ${harbor_handle} ${webhook_handle} ${payload_format}
# Scanning stopped
Retry Action Keyword Verify Webhook By Scanning Stopped Event project${d} webhook${d} ${image2} ${tag2} ${harbor_handle} ${webhook_handle} ${payload_format}
Close Browser
Test Case - Tag Retention And Replication Event Type Webhook Functionality By CloudEvents Format
[Tags] tag_retention_replication_webhook_cloudevents need_webhook_endpoint
Init Chrome Driver
${image}= Set Variable busybox
${tag1}= Set Variable latest
${tag2}= Set Variable stable
${payload_format}= Set Variable CloudEvents
${d}= Get Current Date result_format=%m%s
Go To http://${WEBHOOK_ENDPOINT}
${webhook_endpoint_url}= Get Text //p//code
New Tab
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project_dest${d}
Create An New Project And Go Into Project project${d}
Switch To Tag Retention
Add A Tag Retention Rule
Edit A Tag Retention Rule ** ${tag1}
Switch To Project Webhooks
${event_type} Create List Tag retention finished Replication status changed
Create A New Webhook webhook${d} ${webhook_endpoint_url} ${payload_format} ${event_type}
Switch To Registries
Create A New Endpoint harbor e${d} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
Create A Rule With Existing Endpoint rule_push_${d} push project${d}/* image e${d} project_push_dest${d}
${handles}= Get Window Handles
${webhook_handle}= Set Variable ${handles}[0]
${harbor_handle}= Set Variable ${handles}[1]
# Tag retention finished
Retry Action Keyword Verify Webhook By Tag Retention Finished Event project${d} webhook${d} ${image} ${tag1} ${tag2} ${harbor_handle} ${webhook_handle} ${payload_format}
# Replication status changed
Retry Action Keyword Verify Webhook By Replication Status Changed Event project${d} webhook${d} project_push_dest${d} rule_push_${d} ${harbor_handle} ${webhook_handle} ${payload_format}
Close Browser
Test Case - Tag Quota Event Type Webhook Functionality By CloudEvents Format
[Tags] quota_webhook_cloudevents need_webhook_endpoint
${payload_format}= Set Variable CloudEvents
Init Chrome Driver
Go To http://${WEBHOOK_ENDPOINT}
${webhook_endpoint_url}= Get Text //p//code
New Tab
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
${handles}= Get Window Handles
${webhook_handle}= Set Variable ${handles}[0]
${harbor_handle}= Set Variable ${handles}[1]
Retry Action Keyword Verify Webhook By Quota Near Threshold Event And Quota Exceed Event ${webhook_endpoint_url} ${harbor_handle} ${webhook_handle} ${payload_format}
Close Browser