Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DW test to verify requested resources in case of multiple local queue exists #1565

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
Get Current CPU Usage
[Documentation] Returns value of current cpu usage
[Arguments] ${namespace} ${workload_type}

${thanos_url}= Get OpenShift Thanos URL
${token}= Generate Thanos Token
${expression}= Set Variable
Expand All @@ -81,8 +80,8 @@
Wait Until Element Is Visible xpath=//*[@id="topResourceConsumingCPU-ChartLegend-ChartLabel-0"] timeout=60
END
END
${QUERY_RESULT}= Set Variable ${query_result.json()["data"]["result"][0]["value"][-1]}
${cpu_requested}= Convert To Number ${QUERY_RESULT}
${cpu_usage_value}= Get Query Value ${query_result}
${cpu_requested}= Convert To Number ${cpu_usage_value}
${cpu_usage_rounded_value}= Evaluate round( ${cpu_requested}, 3)
RETURN ${cpu_usage_rounded_value}

Expand All @@ -103,12 +102,29 @@
Wait Until Element Is Visible xpath=//*[@id="topResourceConsumingMemory-ChartLegend-ChartLabel-0"] timeout=60
END
END

${value}= Set Variable ${query_result.json()["data"]["result"][0]["value"][-1]}
${memory_requested}= Convert To Number ${value}
${memory_usage_value}= Get Query Value ${query_result}
${memory_requested}= Convert To Number ${memory_usage_value}
${memory_requested_gb_value}= Evaluate round( ${memory_requested} / (1024**3), 3)
RETURN ${memory_requested_gb_value}

Get Query Value
[Documentation] Returns total value of query response
[Arguments] ${query_response}
@{data}= BuiltIn.Evaluate list(${query_response.json()["data"]["result"]})
Log ${data}
${size}= Get Length ${data}
${total}= Set Variable 0
IF ${size}>1
FOR ${item} IN @{data}
${value}= Get From Dictionary ${item} value
${last_value}= Get From List ${value} -1
${total}= Evaluate ${total} + ${last_value}
END
ELSE
${total}= Set Variable ${query_response.json()["data"]["result"][0]["value"][-1]}
END
RETURN ${total}

Get CPU Requested
[Documentation] get CPU requested from LocalQueue flavorsReservation
[Arguments] ${project} ${local_queue_name}
Expand Down Expand Up @@ -318,3 +334,20 @@
... ELSE IF ${usage_hover} > ${usage_lower_bound} and ${usage_hover} < ${usage_higher_bound}
... Log ${resource_name} usage value is partially matches
... ELSE Fail ${resource_name} usage hover value ${usage_hover} is not matching with expected value ${usage_expected}

Submit Kueue Workload
[Documentation] method for creating kueue workload
[Arguments] ${local_queue} ${project} ${cpu_requested} ${memory_requested} ${job_name_queue}
${result}= Run Process sh ${KUEUE_WORKLOADS_SETUP_FILEPATH} ${local_queue} ${project} ${cpu_requested} ${memory_requested} ${job_name_queue}

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (150/120)
... shell=true
... stderr=STDOUT
Log To Console ${result.stdout}
IF ${result.rc} != 0
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed

Check notice

Code scanning / Robocop

IF can be replaced with inline IF Note test

IF can be replaced with inline IF

Check notice

Code scanning / Robocop

'{{ block_name }}' condition can be simplified Note test

'IF' condition can be simplified
FAIL Failed to submit kueue workloads
END

Wait For Job With Status
[Documentation] Wait for job status with job name
[Arguments] ${job_name} ${job_status} ${timeout}
Wait Until Element Is Visible //td[@class='pf-v5-c-table__td' and contains(text(), '${job_name}')]/following-sibling::td[@data-label='Status']/span/span/span[@class='pf-v5-c-label__text'and text()='${job_status}'] timeout=${timeout}

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (242/120)

Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,9 @@
[Documentation] Monitor the workload metrics status and chart details by submitting kueue batch workload
[Tags] RHOAIENG-5216
... Tier1 DistributedWorkloads

Open Distributed Workload Metrics Home Page
# Submitting kueue batch workload
${result} = Run Process sh ${KUEUE_WORKLOADS_SETUP_FILEPATH} ${LOCAL_QUEUE_NAME} ${PRJ_TITLE} ${CPU_REQUESTED} ${MEMORY_REQUESTED} ${JOB_NAME_QUEUE}
... shell=true
... stderr=STDOUT
Log To Console ${result.stdout}
IF ${result.rc} != 0
FAIL Failed to submit kueue workloads
END
Submit Kueue Workload ${LOCAL_QUEUE_NAME} ${PRJ_TITLE} ${CPU_REQUESTED} ${MEMORY_REQUESTED} ${JOB_NAME_QUEUE}

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (128/120)
Select Distributed Workload Project By Name ${PRJ_TITLE}
Select Refresh Interval 15 seconds
Wait Until Element Is Visible ${DISTRIBUITED_WORKLOAD_RESOURCE_METRICS_TITLE_XP} timeout=20
Expand Down Expand Up @@ -163,6 +156,50 @@

[Teardown] Cleanup Ray Cluster Workload ${PRJ_TITLE} ${RAY_CLUSTER_NAME}

Verify Requested resources When Multiple Local Queue Exists

Check warning

Code scanning / Robocop

Test case '{{ test_name }}' is too long ({{ test_length }}/{{ allowed_length }}) Warning test

Test case 'Verify Requested resources When Multiple Local Queue Exists' is too long (43/20)

Check warning

Code scanning / Robocop

Test case '{{ test_name }}' has too many keywords inside ({{ keyword_count }}/{{ max_allowed_count }}) Warning test

Test case 'Verify Requested resources When Multiple Local Queue Exists' has too many keywords inside (30/10)
[Documentation] Verify That Not Admin Users Can Access Distributed workload metrics default page contents
[Tags] RHOAIENG-8559
... Tier1 DistributedWorkloads
Submit Kueue Workload ${LOCAL_QUEUE_NAME} ${PRJ_TITLE} ${CPU_REQUESTED} ${MEMORY_REQUESTED} ${JOB_NAME_QUEUE}

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (128/120)
${MULTIPLE_LOCAL_QUEUE} Set Variable test-multiple-local-queue
Fixed Show fixed Hide fixed

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning test

The assignment sign is not consistent within the file. Expected ' =' but got '' instead
${MULTIPLE_JOB_NAME} Set Variable multiple-lq-job

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning test

The assignment sign is not consistent within the file. Expected ' =' but got '' instead
# setup Kueue resource for the created project
Setup Kueue Resources ${PRJ_TITLE} ${CLUSTER_QUEUE_NAME} ${RESOURCE_FLAVOR_NAME} ${MULTIPLE_LOCAL_QUEUE}
# Submitting kueue batch workload
Submit Kueue Workload ${MULTIPLE_LOCAL_QUEUE} ${PRJ_TITLE} ${CPU_REQUESTED} ${MEMORY_REQUESTED} ${MULTIPLE_JOB_NAME}

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (135/120)
Open Distributed Workload Metrics Home Page
Select Distributed Workload Project By Name ${PRJ_TITLE}
Select Refresh Interval 15 seconds
Wait Until Element Is Visible ${DISTRIBUITED_WORKLOAD_RESOURCE_METRICS_TITLE_XP} timeout=20
Wait For Job With Status ${JOB_NAME_QUEUE} Running 60
Wait For Job With Status ${MULTIPLE_JOB_NAME} Running 60

# verify Requested by all projects requested resources
${cpu_requested_1} = Get CPU Requested ${PRJ_TITLE} ${LOCAL_QUEUE_NAME}
${cpu_requested_2} = Get CPU Requested ${PRJ_TITLE} ${MULTIPLE_LOCAL_QUEUE}
${cpu_requested} = Evaluate ${cpu_requested_1} + ${cpu_requested_2}
${memory_requested_1} = Get Memory Requested ${PRJ_TITLE} ${LOCAL_QUEUE_NAME} Job
${memory_requested_2} = Get Memory Requested ${PRJ_TITLE} ${MULTIPLE_LOCAL_QUEUE} Job
${memory_requested} = Evaluate ${memory_requested_1} + ${memory_requested_2}
Check Requested Resources ${PRJ_TITLE} ${CPU_SHARED_QUOTA} ${MEMEORY_SHARED_QUOTA} ${cpu_requested} ${memory_requested} Job

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (145/120)

Wait Until Element Is Visible xpath=//*[@id="topResourceConsumingCPU-ChartLabel-title"] timeout=120
Wait Until Element Is Visible xpath=//*[@id="topResourceConsumingCPU-ChartLegend-ChartLabel-0"] timeout=120
${cpu_usage} = Get Current CPU Usage ${PRJ_TITLE} Job
${cpu_consuming} = Get Text xpath:(//*[@style[contains(., 'var(--pf-v5-chart-donut--label--title--Fill')]])[1]
Check Resource Consuming Usage ${cpu_usage} ${cpu_consuming} CPU

Wait Until Element Is Visible xpath=//*[@id="topResourceConsumingMemory-ChartLabel-title"] timeout=120
Wait Until Element Is Visible xpath=//*[@id="topResourceConsumingMemory-ChartLegend-ChartLabel-0"] timeout=120
${memory_usage} = Get Current Memory Usage ${PRJ_TITLE} Job
${memory_consuming} = Get Text xpath:(//*[@style[contains(., 'var(--pf-v5-chart-donut--label--title--Fill')]])[2]

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (123/120)
Check Resource Consuming Usage ${memory_usage} ${memory_consuming} Memory

Wait For Job With Status ${JOB_NAME_QUEUE} Succeeded 180
Wait For Job With Status ${MULTIPLE_JOB_NAME} Succeeded 180

[Teardown] Run Process oc delete LocalQueue ${MULTIPLE_LOCAL_QUEUE} -n ${PRJ_TITLE}
... shell=true

*** Keywords ***
Project Suite Setup
Expand Down
Loading