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

RHODS-12410 - Create a Robot framework test for running DW tests #980

Merged
merged 1 commit into from
Nov 13, 2023
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
@@ -1,6 +1,8 @@
*** Settings ***
Documentation RHODS CodeFlare operator installation keywords
Resource ../../../../tests/Resources/Common.robot
Resource ../install/oc_install.robot
Resource ../pre-tasks/oc_is_operator_installed.robot
Library String
Library OperatingSystem
Library OpenShiftLibrary
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
*** Settings ***
Documentation This is a resource file for Distributed Workloads.
Library OperatingSystem
Library Process


*** Variables ***
${CODEFLARE_TEST_TIMEOUT_LONG} 20m
${GO_TEST_TIMEOUT} 1h
${JOB_GO_BIN} %{WORKSPACE=.}/go-bin
${GO_JUNIT_REPORT_TOOL} github.com/jstemmer/go-junit-report/v2@latest


*** Keywords ***
Clone Git Repository
Fixed Show fixed Hide fixed
[Documentation] Clone Git repository
[Arguments] ${DW_REPO_URL} ${DW_REPO_BRANCH} ${DW_DIR}
${result} = Run Process git clone -b ${DW_REPO_BRANCH} ${DW_REPO_URL} ${DW_DIR}
... shell=true stderr=STDOUT
Log To Console ${result.stdout}
IF ${result.rc} != 0

Check notice

Code scanning / Robocop

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

'IF' condition can be simplified
FAIL Unable to clone DW repo ${DW_REPO_URL}:${DW_REPO_BRANCH}:${DW_DIR}
END

Run Distributed Workloads Tests
Fixed Show fixed Hide fixed
[Documentation] Run distributed workloads E2E tests from integration directory
[Arguments] ${DW_DIR} ${DW_TEST_RESULT_FILE} ${TEST_PARAMETERS}
${result} = Run Process
... go test -v -timeout ${GO_TEST_TIMEOUT} ./integration ${TEST_PARAMETERS} 2>&1 > ${DW_TEST_RESULT_FILE}
... shell=true cwd=${DW_DIR}/tests env:ODH_NAMESPACE=redhat-ods-applications
... env:CODEFLARE_TEST_TIMEOUT_LONG=${CODEFLARE_TEST_TIMEOUT_LONG}
Log To Console ${result.stdout}
${test_output}= Get File ${DW_TEST_RESULT_FILE}

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
Log To Console ${test_output}
RETURN ${result.rc}

Install Go Junit Report Tool
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
[Documentation] Use Go install command to install Go Junit report tool
${result} = Run Process go install ${GO_JUNIT_REPORT_TOOL}
... shell=true env:GOBIN=${JOB_GO_BIN} stderr=STDOUT
Log To Console ${result.stdout}
IF ${result.rc} != 0

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 install Go junit report tool
END

Convert Go Test Results To Junit
Fixed Show fixed Hide fixed
[Documentation] Use Go Junit report tool to convert Go test results to Junit
[Arguments] ${DW_TEST_RESULT_FILE} ${DW_JUNIT_FILE}
${result} = Run Process ${JOB_GO_BIN}/go-junit-report -in ${DW_TEST_RESULT_FILE} -iocopy -out ${DW_JUNIT_FILE}
... shell=true stderr=STDOUT
Log To Console ${result.stdout}
IF ${result.rc} != 0

Check notice

Code scanning / Robocop

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

'IF' condition can be simplified
FAIL Failed to convert Go test results to Junit
END
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
*** Settings ***
Documentation Distributed workloads tests

Resource ../../../tasks/Resources/RHODS_OLM/install/codeflare_install.resource
Resource ../../Resources/Page/DistributedWorkloads/DistributedWorkloads.resource

Fixed Show fixed Hide fixed

*** Variables ***
${DW_DIR} distributed-workloads
${DW_TEST_RESULT_FILE} %{WORKSPACE=.}/dw-test-results.txt
${DW_JUNIT_FILE} %{WORKSPACE=.}/junit.xml

Fixed Show fixed Hide fixed

*** Test Cases ***
Run distributed workloads sanity tests
[Documentation] Run tests located in Distributed Workloads repo downstream
[Tags] Sanity

Skip If "%{OPERATOR_TYPE}" != "RHODS Operator V2"
DistributedWorkloads.Clone Git Repository %{DW_GIT_REPO} %{DW_GIT_REPO_BRANCH} ${DW_DIR}
${test_result}= Run Distributed Workloads Tests ${DW_DIR} ${DW_TEST_RESULT_FILE} -run '.*Test[RK].*[^r]$' -parallel 1 %{DW_GO_TESTS_PARAMS}

Check warning

Code scanning / Robocop

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

Line is too long (155/120)
Install Go Junit Report Tool
Convert Go Test Results To Junit ${DW_TEST_RESULT_FILE} ${DW_JUNIT_FILE}
IF ${test_result} != 0

Check notice

Code scanning / Robocop

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

'IF' condition can be simplified
FAIL There were test failures in the Distributed Workloads tests.
END
Loading