From b687d9515b1340d76e8db98788358c3da6536e8b Mon Sep 17 00:00:00 2001 From: alesapin Date: Thu, 25 Nov 2021 12:23:45 +0300 Subject: [PATCH 1/4] Fail fast test check --- tests/ci/fast_test_check.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/ci/fast_test_check.py b/tests/ci/fast_test_check.py index 2734102be3f..25c8001903c 100644 --- a/tests/ci/fast_test_check.py +++ b/tests/ci/fast_test_check.py @@ -14,6 +14,7 @@ from docker_pull_helper import get_image_with_version from commit_status_helper import post_commit_status from clickhouse_helper import ClickHouseHelper, mark_flaky_tests, prepare_tests_results_for_clickhouse from stopwatch import Stopwatch +import sys NAME = 'Fast test (actions)' @@ -142,3 +143,9 @@ if __name__ == "__main__": prepared_events = prepare_tests_results_for_clickhouse(pr_info, test_results, state, stopwatch.duration_seconds, stopwatch.start_time_str, report_url, NAME) ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) + + # Refuse other checks to run if fast test failed + for test_result in test_results: + status = test_result[1] + if status != "OK": + sys.exit(1) From c09feaf2a8453f688098f50bcdea91ed13a3a16c Mon Sep 17 00:00:00 2001 From: alesapin Date: Thu, 25 Nov 2021 13:01:29 +0300 Subject: [PATCH 2/4] Also fail builds and functional tests --- .github/workflows/main.yml | 1 + tests/ci/build_check.py | 4 ++++ tests/ci/functional_test_check.py | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 268c019e778..d0a6189313d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -518,6 +518,7 @@ jobs: - BuilderDebDebug - BuilderDebSplitted runs-on: [self-hosted, style-checker] + if: always() steps: - name: Download json reports uses: actions/download-artifact@v2 diff --git a/tests/ci/build_check.py b/tests/ci/build_check.py index df9036b1975..b25bbc4c513 100644 --- a/tests/ci/build_check.py +++ b/tests/ci/build_check.py @@ -178,3 +178,7 @@ if __name__ == "__main__": with open(os.path.join(temp_path, "build_urls_" + build_name + '.json'), 'w') as build_links: json.dump(result, build_links) + + # Fail build job if not successeded + if not success: + sys.exit(1) diff --git a/tests/ci/functional_test_check.py b/tests/ci/functional_test_check.py index dc91ec07163..1e4a34c97c5 100644 --- a/tests/ci/functional_test_check.py +++ b/tests/ci/functional_test_check.py @@ -171,3 +171,9 @@ if __name__ == "__main__": prepared_events = prepare_tests_results_for_clickhouse(pr_info, test_results, state, stopwatch.duration_seconds, stopwatch.start_time_str, report_url, check_name) ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) + + # If some tests failed set red status to check + for test_result in test_results: + status = test_result[1] + if status != "OK": + sys.exit(1) From a6a44cf8b6575535562b8f827344f86be63b95e4 Mon Sep 17 00:00:00 2001 From: alesapin Date: Thu, 25 Nov 2021 13:11:47 +0300 Subject: [PATCH 3/4] Fix style --- tests/ci/fast_test_check.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/ci/fast_test_check.py b/tests/ci/fast_test_check.py index 25c8001903c..2ae105001fc 100644 --- a/tests/ci/fast_test_check.py +++ b/tests/ci/fast_test_check.py @@ -5,6 +5,8 @@ import subprocess import os import json import csv +import sys + from github import Github from pr_info import PRInfo from s3_helper import S3Helper @@ -14,7 +16,6 @@ from docker_pull_helper import get_image_with_version from commit_status_helper import post_commit_status from clickhouse_helper import ClickHouseHelper, mark_flaky_tests, prepare_tests_results_for_clickhouse from stopwatch import Stopwatch -import sys NAME = 'Fast test (actions)' From e6e4c485bc0b8185c9352d9748ef745da60c73da Mon Sep 17 00:00:00 2001 From: alesapin Date: Thu, 25 Nov 2021 16:41:38 +0300 Subject: [PATCH 4/4] More simple --- tests/ci/fast_test_check.py | 6 ++---- tests/ci/functional_test_check.py | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/ci/fast_test_check.py b/tests/ci/fast_test_check.py index 2ae105001fc..4b1e5b64d08 100644 --- a/tests/ci/fast_test_check.py +++ b/tests/ci/fast_test_check.py @@ -146,7 +146,5 @@ if __name__ == "__main__": ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) # Refuse other checks to run if fast test failed - for test_result in test_results: - status = test_result[1] - if status != "OK": - sys.exit(1) + if state != 'success': + sys.exit(1) diff --git a/tests/ci/functional_test_check.py b/tests/ci/functional_test_check.py index 1e4a34c97c5..a2f42914f64 100644 --- a/tests/ci/functional_test_check.py +++ b/tests/ci/functional_test_check.py @@ -172,8 +172,5 @@ if __name__ == "__main__": prepared_events = prepare_tests_results_for_clickhouse(pr_info, test_results, state, stopwatch.duration_seconds, stopwatch.start_time_str, report_url, check_name) ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) - # If some tests failed set red status to check - for test_result in test_results: - status = test_result[1] - if status != "OK": - sys.exit(1) + if state != 'success': + sys.exit(1)