Skip to content

Commit 88e0ec0

Browse files
committed
Temporary check change
Signed-off-by: Milosz Linkiewicz <[email protected]>
1 parent a24dad6 commit 88e0ec0

File tree

2 files changed

+39
-52
lines changed

2 files changed

+39
-52
lines changed

.github/scripts/run_validation_tests.sh

Lines changed: 38 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,9 @@
22

33
set +e
44

5-
VALIDATION_TESTS_1="${1:-$VALIDATION_TESTS_1}"
6-
VALIDATION_TESTS_2="${2:-$VALIDATION_TESTS_2}"
7-
PYTEST_ALIAS="${3:-$PYTEST_ALIAS}"
8-
PYTEST_PARAMS="${4:-$PYTEST_PARAMS}"
9-
export TEST_PORT_P="${5:-$TEST_PORT_P}"
10-
export TEST_PORT_R="${6:-$TEST_PORT_R}"
11-
PYTEST_RETRIES="${PYTEST_RETRIES:-3}"
12-
135
# Function to log messages to GitHub Actions
14-
function LOG_GITHUB_SUMMARY() {
15-
echo "$@" >> "$GITHUB_STEP_SUMMARY"
16-
}
17-
18-
function LOG_GITHUB_CONSOLE() {
19-
echo "$@"
6+
log_to_github() {
7+
echo "$1" >> "$GITHUB_STEP_SUMMARY"
208
}
219

2210
# Function to run a test and handle retries
@@ -27,84 +15,83 @@ run_test() {
2715
local pytest_params=$4
2816
local test_port_p=$5
2917
local test_port_r=$6
30-
local PYTEST_START_TIME=""
31-
local PYTEST_END_TIME=""
32-
local PYTEST_DURATION=""
33-
local PYTEST_TASK_STATUS=""
34-
local PYTEST_SUFFIX="[Err]"
3518

36-
LOG_GITHUB_CONSOLE "::group::${test}"
37-
PYTEST_START_TIME=$(date '+%s')
38-
# shellcheck disable=SC2086
39-
${pytest_alias} "${test}" ${pytest_params} --nic="${test_port_p},${test_port_r}" --collect-only -q --no-summary
19+
echo "::group::${test}"
20+
local start_time=$(date '+%s')
21+
$pytest_alias "${test}" $pytest_params --nic="${test_port_p},${test_port_r}" --collect-only -q --no-summary
4022

4123
for retry in $(seq 1 "$retries"); do
42-
# shellcheck disable=SC2086
43-
${pytest_alias} "${test}" ${pytest_params} --nic="${test_port_p},${test_port_r}"
24+
$pytest_alias "${test}" $pytest_params --nic="${test_port_p},${test_port_r}"
4425
local result=$?
45-
LOG_GITHUB_CONSOLE "RETRY: ${retry}"
26+
echo "RETRY: ${retry}"
4627
[[ "$result" == "0" ]] && break
4728
done
4829

49-
PYTEST_END_TIME="$(date '+%s')"
50-
PYTEST_DURATION="$((PYTEST_END_TIME - PYTEST_START_TIME))"
30+
local end_time=$(date '+%s')
31+
local duration=$((end_time - start_time))
32+
local status=""
33+
local suffix="[Err]"
5134

5235
if [[ "$result" == "0" ]]; then
53-
PYTEST_TASK_STATUS=""
54-
PYTEST_SUFFIX="[OK]"
36+
status=""
37+
suffix="[OK]"
5538
TESTS_SUCCESS+=("${test}")
5639
else
5740
TESTS_FAIL+=("${test}")
5841
fi
5942

60-
LOG_GITHUB_SUMMARY "| ${PYTEST_TASK_STATUS} | ${test} | $(date --date=@${PYTEST_START_TIME} '+%d%m%y_%H%M%S') | $(date --date="@${PYTEST_END_TIME}" '+%d%m%y_%H%M%S') | ${PYTEST_DURATION}s | ${PYTEST_SUFFIX} |"
61-
LOG_GITHUB_CONSOLE "::endgroup::"
43+
log_to_github "| ${status} | ${test} | $(date --date=@${start_time} '+%d%m%y_%H%M%S') | $(date --date=@${end_time} '+%d%m%y_%H%M%S') | ${duration}s | ${suffix} |"
44+
echo "::endgroup::"
6245
}
6346

6447
# Main script execution
65-
LOG_GITHUB_CONSOLE "::group::pre-execution-summary"
48+
echo "::group::pre-execution-summary"
49+
50+
# Export environment variables
51+
export TEST_PORT_P="${TEST_PORT_P}"
52+
export TEST_PORT_R="${TEST_PORT_R}"
6653

6754
# Collect tests to be executed
6855
TESTS_INCLUDED_IN_EXECUTION=(
69-
$(grep -v "collected in" <(${PYTEST_ALIAS} "tests/${VALIDATION_TESTS_1}" --collect-only -q --no-summary 2>&1))
56+
$(grep -v "collected in" <($PYTEST_ALIAS "tests/${VALIDATION_TESTS_1}" $PYTEST_PARAMS --nic="${TEST_PORT_P},${TEST_PORT_R}" --collect-only -q --no-summary 2>&1))
7057
)
7158
SUMMARY_MAIN_HEADER="Starting tests/${VALIDATION_TESTS_1}"
7259

7360
if [[ -n "${VALIDATION_TESTS_2}" ]]; then
7461
TESTS_INCLUDED_IN_EXECUTION+=(
75-
$(grep -v "collected in" <(${PYTEST_ALIAS} "tests/${VALIDATION_TESTS_2}" --collect-only -q --no-summary 2>&1))
62+
$(grep -v "collected in" <($PYTEST_ALIAS "tests/${VALIDATION_TESTS_2}" $PYTEST_PARAMS --nic="${TEST_PORT_P},${TEST_PORT_R}" --collect-only -q --no-summary 2>&1))
7663
)
7764
SUMMARY_MAIN_HEADER="${SUMMARY_MAIN_HEADER}, tests/${VALIDATION_TESTS_2}"
7865
fi
7966

67+
NUMBER_OF_TESTS="${#TESTS_INCLUDED_IN_EXECUTION[@]}"
8068
TESTS_FAIL=()
8169
TESTS_SUCCESS=()
8270

83-
LOG_GITHUB_CONSOLE "${SUMMARY_MAIN_HEADER} tests (total ${NUMBER_OF_TESTS}) :rocket:"
84-
LOG_GITHUB_CONSOLE "----------------------------------"
85-
LOG_GITHUB_CONSOLE "Tests to be executed:"
86-
LOG_GITHUB_CONSOLE "${TESTS_INCLUDED_IN_EXECUTION[@]}"
87-
88-
LOG_GITHUB_SUMMARY "## ${SUMMARY_MAIN_HEADER} tests (total ${NUMBER_OF_TESTS}) :rocket:"
89-
LOG_GITHUB_SUMMARY "| ❌/✅ | Collected Test | Started | Ended | Took (s) | Result |"
90-
LOG_GITHUB_SUMMARY "| --- | --- | --- | --- | --- | --- |"
71+
echo "${SUMMARY_MAIN_HEADER} tests (total ${NUMBER_OF_TESTS}) :rocket:"
72+
echo "----------------------------------"
73+
echo "Tests to be executed:"
74+
echo "${TESTS_INCLUDED_IN_EXECUTION[@]}"
9175

92-
LOG_GITHUB_CONSOLE "::endgroup::"
76+
log_to_github "## ${SUMMARY_MAIN_HEADER} tests (total ${NUMBER_OF_TESTS}) :rocket:"
77+
log_to_github "| ❌/✅ | Collected Test | Started | Ended | Took (s) | Result |"
78+
log_to_github "| --- | --- | --- | --- | --- | --- |"
79+
echo "::endgroup::"
9380

9481
# Execute each test
9582
for test in "${TESTS_INCLUDED_IN_EXECUTION[@]}"; do
96-
run_test "$test" "${PYTEST_RETRIES}" "${PYTEST_ALIAS}" "${PYTEST_PARAMS}" "${TEST_PORT_P}" "${TEST_PORT_R}"
83+
run_test "$test" "$PYTEST_RETRIES" "$PYTEST_ALIAS" "$PYTEST_PARAMS" "$TEST_PORT_P" "$TEST_PORT_R"
9784
done
9885

9986
# Summary of test results
100-
LOG_GITHUB_SUMMARY "### Total success ${#TESTS_SUCCESS[@]}/${NUMBER_OF_TESTS}:"
101-
LOG_GITHUB_SUMMARY "${TESTS_SUCCESS[@]}"
102-
LOG_GITHUB_SUMMARY "### Total failed ${#TESTS_FAIL[@]}/${NUMBER_OF_TESTS}:"
103-
LOG_GITHUB_SUMMARY "${TESTS_FAIL[@]}"
87+
log_to_github "### Total success ${#TESTS_SUCCESS[@]}/${NUMBER_OF_TESTS}:"
88+
log_to_github "${TESTS_SUCCESS[@]}"
89+
log_to_github "### Total failed ${#TESTS_FAIL[@]}/${NUMBER_OF_TESTS}:"
90+
log_to_github "${TESTS_FAIL[@]}"
10491

10592
# Determine exit status
10693
if [[ "${#TESTS_FAIL[@]}" == "0" ]] || [[ "${VALIDATION_NO_FAIL_TESTS}" == "true" ]]; then
10794
exit 0
95+
else
96+
exit 1
10897
fi
109-
110-
exit 1

.github/workflows/validation-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ jobs:
240240
- name: 'execution: Run validation-bare-metal tests in pipenv environment'
241241
working-directory: tests/validation
242242
run: |
243-
"${{ github.workspace }}/.github/scripts/run_validation_tests.sh"
243+
. "${{ github.workspace }}/.github/scripts/run_validation_tests.sh"
244244
env:
245245
TEST_PORT_P: ${{ env.TEST_PORT_P }}
246246
TEST_PORT_R: ${{ env.TEST_PORT_R }}

0 commit comments

Comments
 (0)