aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBulat Gayazov <brgayazov@yandex-team.ru>2023-06-08 14:22:47 +0000
committerbrgayazov <bulat@ydb.tech>2023-06-08 17:22:47 +0300
commit67979c6e5cdbfdb34dcbafc7edace699e2ba375f (patch)
tree83674c05ca69a1314f1a511f580369da954c9b1a
parent8bfba786a00c488c54b9950cea95da5a28e99be9 (diff)
downloadydb-67979c6e5cdbfdb34dcbafc7edace699e2ba375f.tar.gz
Added intergration of python CI with testmo
Added intergration of python CI with testmo Pull Request resolved: #237
-rw-r--r--.github/actions/test/action.yml68
-rw-r--r--.github/actions/test_python/action.yml62
-rw-r--r--.github/workflows/build_and_test_ondemand.yml20
-rw-r--r--.github/workflows/build_and_test_provisioned.yml17
-rw-r--r--.github/workflows/pr_check.yml1
-rw-r--r--.github/workflows/prepare_vm_for_build.yml2
-rw-r--r--ydb/tests/functional/pytest.ini1
7 files changed, 75 insertions, 96 deletions
diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml
index 819c29d3ef..090afdadac 100644
--- a/.github/actions/test/action.yml
+++ b/.github/actions/test/action.yml
@@ -28,6 +28,12 @@ inputs:
aws_endpoint:
required: true
type: string
+ run_unit_tests:
+ required: true
+ type: string
+ run_functional_tests:
+ required: true
+ type: string
runs:
using: "composite"
@@ -40,6 +46,7 @@ runs:
rm -rf artifacts/* tmp/* test_reports/*
echo "WORKDIR=$(pwd)" >> $GITHUB_ENV
echo "TESTREPDIR=$(pwd)/test_reports" >> $GITHUB_ENV
+ echo "PYTESTREPDIR=$(pwd)/ydb/tests/functional/test-results/xml" >> $GITHUB_ENV
echo "TESTMO_TOKEN=${{inputs.testman_token}}" >> $GITHUB_ENV
echo "TESTMO_URL=${{inputs.testman_url}}" >> $GITHUB_ENV
echo "logfilename=${{inputs.log_suffix}}-ctest-stdout.gz" >> $GITHUB_OUTPUT
@@ -47,6 +54,8 @@ runs:
echo "testfilterfile=$(pwd)/.github/config/muted_test.txt" >> $GITHUB_OUTPUT
echo "testshardfilterfile=$(pwd)/.github/config/muted_shard.txt" >> $GITHUB_OUTPUT
echo "logurlprefix=${{inputs.aws_endpoint}}/${{inputs.aws_bucket}}/${{ github.repository }}/${{github.workflow}}/${{github.run_id}}" >> $GITHUB_OUTPUT
+ echo "pytest-logfilename=${{inputs.log_suffix}}-pytest-stdout.gz" >> $GITHUB_OUTPUT
+
- name: Install Node required for Testmo CLI
uses: actions/setup-node@v3
with:
@@ -91,13 +100,14 @@ runs:
--tags "$BRANCH_TAG" --tags "$EXTRA_TAG" | \
echo "runid=$(cat)" >> $GITHUB_OUTPUT
- - name: Test
+ - name: Run unit tests
id: ctest
+ if: inputs.run_unit_tests == 'true'
shell: bash
run: |
cd $WORKDIR/../build/ydb
- echo "[Stdout log (gzip archive)](${{steps.init.outputs.logurlprefix}}/${{steps.init.outputs.logfilename}})" >> $GITHUB_STEP_SUMMARY
+ echo "[Stdout unittest/ctest log (gzip archive)](${{steps.init.outputs.logurlprefix}}/${{steps.init.outputs.logfilename}})" >> $GITHUB_STEP_SUMMARY
echo "[Testmo](${TESTMO_URL}/automation/runs/view/${{steps.th.outputs.runid}})" >> $GITHUB_STEP_SUMMARY
# Sed removes coloring from the output
@@ -117,13 +127,17 @@ runs:
exit $RC
fi
)
+
- name: archive unitest reports (orig)
+ if: inputs.run_unit_tests == 'true'
shell: bash
run: |
tar -C $TESTREPDIR/ -czf ${{steps.init.outputs.artifactsdir}}/reports.tar.gz .
ls -la ${{steps.init.outputs.artifactsdir}}/reports.tar.gz
echo "[Unittest/CTest XML reports archive](${{steps.init.outputs.logurlprefix}}/reports.tar.gz)" >> $GITHUB_STEP_SUMMARY
+
- name: postprocess junit reports
+ if: inputs.run_unit_tests == 'true'
shell: bash
run: |
echo "::group::junit-postprocess"
@@ -143,7 +157,9 @@ runs:
$TESTREPDIR/suites/ctest_report.xml
echo "::endgroup::"
+
- name: extract log output
+ if: inputs.run_unit_tests == 'true'
shell: bash
run: |
mkdir ${{steps.init.outputs.artifactsdir}}/logs/
@@ -159,10 +175,9 @@ runs:
--decompress \
${{steps.init.outputs.artifactsdir}}/${{steps.init.outputs.logfilename}} \
${{steps.init.outputs.artifactsdir}}/logs/
-
- - name: Test history upload results
- if: always() && inputs.testman_token
+ - name: Unit test history upload results
+ if: always() && inputs.run_unit_tests == 'true' && inputs.testman_token
shell: bash
run: |
testmo automation:run:submit-thread \
@@ -173,7 +188,50 @@ runs:
--instance "$TESTMO_URL" --run-id ${{steps.th.outputs.runid}} \
--results "$TESTREPDIR/suites/*.xml" \
-- cat $WORKDIR/short.log
+
+ - name: Run functional tests
+ if: inputs.run_functional_tests == 'true' && (success() || failure())
+ shell: bash
+ run: |
+ export source_root=$WORKDIR
+ export build_root=$WORKDIR/../build/
+
+ echo "[Stdout pytest log (gzip archive)](${{steps.init.outputs.logurlprefix}}/${{steps.init.outputs.pytest-logfilename}})" >> $GITHUB_STEP_SUMMARY
+ cd $WORKDIR/ydb/tests/functional/
+ bad_suites=$(grep -Eo 'ignore=[a-zA-Z_-]*' pytest.ini | sed -e 's/ignore=//g')
+ suites=""
+ for suite in $(echo */ | sed -e 's/\///g'); do
+ if [[ $(echo "$bad_suites" | grep -F -e $suite -) == '' ]]; then
+ suites+=$suite
+ suites+=$'\n'
+ fi
+ done
+ if [[ "${{inputs.test_label_regexp}}" != '' ]]; then
+ suites="${{inputs.test_label_regexp}}"
+ fi
+ source $WORKDIR/ydb/tests/oss/launch/prepare.sh
+ echo -n "$suites" | parallel -j28 "pytest -o junit_logging=log -o junit_log_passing_tests=False \
+ -v --junit-xml=$PYTESTREPDIR/{}.xml {}" | \
+ sed -e 's/\x1b\[[0-9;]*m//g' | \
+ tee >(gzip --stdout > ${{steps.init.outputs.artifactsdir}}/${{steps.init.outputs.pytest-logfilename}}) | \
+ grep -E '(FAILED|ERROR)\s*\[.*\]' | \
+ tee $WORKDIR/pytest-short.log
+
+ - name: Functional tests history upload results
+ if: always() && inputs.run_functional_tests == 'true' && inputs.testman_token
+ shell: bash
+ run: |
+ testmo automation:run:submit-thread \
+ --instance "$TESTMO_URL" --run-id ${{steps.th.outputs.runid}} \
+ --results "$PYTESTREPDIR/*.xml" \
+ -- cat $WORKDIR/pytest-short.log
+
+ - name: Test history run complete
+ if: always() && inputs.testman_token
+ shell: bash
+ run: |
testmo automation:run:complete --instance "$TESTMO_URL" --run-id ${{steps.th.outputs.runid}}
+
- name: Upload S3
uses: shallwefootball/s3-upload-action@master
if: always()
diff --git a/.github/actions/test_python/action.yml b/.github/actions/test_python/action.yml
index f195e408f2..e69de29bb2 100644
--- a/.github/actions/test_python/action.yml
+++ b/.github/actions/test_python/action.yml
@@ -1,62 +0,0 @@
-name: test-python
-description: Run functional Python tests
-inputs:
- log_suffix:
- required: true
- type: string
- test_label_regexp:
- required: false
- type: string
- aws_key_id:
- required: true
- type: string
- aws_key_value:
- required: true
- type: string
- aws_bucket:
- required: true
- type: string
- aws_endpoint:
- required: true
- type: string
-
-runs:
- using: "composite"
- steps:
- - name: Test
- shell: bash
- run: |
- export source_root=$(pwd)
- export build_root=$(pwd)/../build/
- mkdir -p ../artifacts
- rm -rf ../artifacts/*
-
- echo "Stdout log (gzip archive): https://storage.yandexcloud.net/${{inputs.aws_bucket}}/${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}/${{inputs.log_suffix}}-${{inputs.sanitizer}}-pytest-stdout.gz" >> $GITHUB_STEP_SUMMARY
- cd ${source_root}/ydb/tests/functional/
- bad_suites=$(grep -Eo 'ignore=[a-zA-Z_-]*' pytest.ini | sed -e 's/ignore=//g')
- suites=""
- for suite in $(echo */ | sed -e 's/\///g'); do
- if [[ $(echo "$bad_suites" | grep -F -e $suite -) == '' ]]; then
- suites+=$suite
- suites+=$'\n'
- fi
- done
- if [[ "${{inputs.test_label_regexp}}" != '' ]]; then
- suites="${{inputs.test_label_regexp}}"
- fi
- source ${source_root}/ydb/tests/oss/launch/prepare.sh
- echo -n "$suites" | parallel -j32 "pytest -o junit_logging=log -o junit_log_passing_tests=False \
- -v --junit-xml=${source_root}/ydb/tests/functional/test-results/xml/{}/res.xml {}" | \
- sed -e 's/\x1b\[[0-9;]*m//g' | \
- tee >(gzip --stdout > ${source_root}/../artifacts/${{inputs.log_suffix}}-pytest-stdout.gz) | \
- tee -a $GITHUB_STEP_SUMMARY
- - name: Upload S3
- uses: shallwefootball/s3-upload-action@master
- if: always()
- with:
- aws_key_id: ${{inputs.aws_key_id}}
- aws_secret_access_key: ${{inputs.aws_key_value}}
- aws_bucket: ${{inputs.aws_bucket}}
- source_dir: ../artifacts
- destination_dir: '${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}'
- endpoint: ${{inputs.aws_endpoint}}
diff --git a/.github/workflows/build_and_test_ondemand.yml b/.github/workflows/build_and_test_ondemand.yml
index bc3a01ff34..984411f65e 100644
--- a/.github/workflows/build_and_test_ondemand.yml
+++ b/.github/workflows/build_and_test_ondemand.yml
@@ -18,7 +18,7 @@ on:
default: true
run_functional_tests:
type: boolean
- default: false
+ default: true
workflow_dispatch:
inputs:
sanitizer:
@@ -36,7 +36,7 @@ on:
default: true
run_functional_tests:
type: boolean
- default: false
+ default: true
jobs:
@@ -94,8 +94,7 @@ jobs:
uses: ./.github/actions/build
with:
sanitizer: ${{ inputs.sanitizer }}
- - name: Run unit tests
- if: inputs.run_unit_tests
+ - name: Run tests
uses: ./.github/actions/test
with:
log_suffix: ${{format('{0}{1}', 'X64', inputs.sanitizer)}}
@@ -107,17 +106,8 @@ jobs:
testman_token: ${{secrets.TESTMO_TOKEN}}
testman_url: ${{vars.TESTMO_URL}}
testman_project_id: ${{vars.TESTMO_PROJECT_ID}}
- - name: Run functional tests
- if: inputs.run_functional_tests && (success() || failure()) && steps.build.conclusion != 'failure'
- uses: ./.github/actions/test_python
- with:
- log_suffix: ${{format('{0}{1}', 'X64', inputs.sanitizer)}}
- test_label_regexp: ${{ inputs.test_label_regexp }}
- aws_key_id: ${{secrets.AWS_KEY_ID}}
- aws_key_value: ${{secrets.AWS_KEY_VALUE}}
- aws_bucket: ${{vars.AWS_BUCKET}}
- aws_endpoint: ${{vars.AWS_ENDPOINT}}
-
+ run_unit_tests: ${{inputs.run_unit_tests}}
+ run_functional_tests: ${{inputs.run_functional_tests}}
release-runner:
name: Release self-hosted YC runner if provided on-demand
needs:
diff --git a/.github/workflows/build_and_test_provisioned.yml b/.github/workflows/build_and_test_provisioned.yml
index fa726a115d..6ef13f8a7b 100644
--- a/.github/workflows/build_and_test_provisioned.yml
+++ b/.github/workflows/build_and_test_provisioned.yml
@@ -17,7 +17,7 @@ on:
default: true
run_functional_tests:
type: boolean
- default: false
+ default: true
test_label_regexp:
required: false
type: string
@@ -54,9 +54,8 @@ jobs:
if: inputs.run_build
with:
sanitizer: ${{ inputs.sanitizer }}
- - name: Run unit tests
+ - name: Run tests
uses: ./.github/actions/test
- if: inputs.run_unit_tests
with:
log_suffix: ${{format('{0}{1}', inputs.runner_label, inputs.sanitizer)}}
test_label_regexp: ${{ inputs.test_label_regexp }}
@@ -67,14 +66,6 @@ jobs:
testman_token: ${{secrets.TESTMO_TOKEN}}
testman_url: ${{vars.TESTMO_URL}}
testman_project_id: ${{vars.TESTMO_PROJECT_ID}}
- - name: Run functional tests
- if: inputs.run_functional_tests && (success() || failure()) && steps.build.conclusion != 'failure'
- uses: ./.github/actions/test_python
- with:
- log_suffix: ${{format('{0}{1}', inputs.runner_label, inputs.sanitizer)}}
- test_label_regexp: ${{ inputs.test_label_regexp }}
- aws_key_id: ${{secrets.AWS_KEY_ID}}
- aws_key_value: ${{secrets.AWS_KEY_VALUE}}
- aws_bucket: ${{vars.AWS_BUCKET}}
- aws_endpoint: ${{vars.AWS_ENDPOINT}}
+ run_unit_tests: ${{inputs.run_unit_tests}}
+ run_functional_tests: ${{inputs.run_functional_tests}}
diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml
index f8e3c56870..f9380be0fe 100644
--- a/.github/workflows/pr_check.yml
+++ b/.github/workflows/pr_check.yml
@@ -88,5 +88,6 @@ jobs:
if: needs.check-running-allowed.outputs.result == 'true'
uses: ./.github/workflows/build_and_test_ondemand.yml
with:
+ run_functional_tests: false
test_label_regexp: '(SMALL|MEDIUM)'
secrets: inherit
diff --git a/.github/workflows/prepare_vm_for_build.yml b/.github/workflows/prepare_vm_for_build.yml
index dab4270299..778d03b1e3 100644
--- a/.github/workflows/prepare_vm_for_build.yml
+++ b/.github/workflows/prepare_vm_for_build.yml
@@ -28,7 +28,7 @@ jobs:
echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null
sudo apt-get update
sudo apt-get -y install python-is-python3 git cmake python3-pip ninja-build antlr3 m4 clang-12 lld-12 libidn11-dev libaio1 libaio-dev parallel
- sudo pip3 install conan==1.59 pytest==7.1.3 grpcio grpcio-tools PyHamcrest tornado xmltodict pyarrow
+ sudo pip3 install conan==1.59 pytest==7.1.3 pytest-timeout grpcio grpcio-tools PyHamcrest tornado xmltodict pyarrow
- name: Install AllureCtl
if: false
shell: bash
diff --git a/ydb/tests/functional/pytest.ini b/ydb/tests/functional/pytest.ini
index 661da0dcf7..07f6c809f5 100644
--- a/ydb/tests/functional/pytest.ini
+++ b/ydb/tests/functional/pytest.ini
@@ -1,2 +1,3 @@
[pytest]
+timeout = 600
addopts = --ignore=clickbench --ignore=dynumber --ignore=large_serializable --ignore=serializable --ignore=postgresql --ignore=rename