Add bugfux validate check

This commit is contained in:
vdimir 2022-03-08 15:19:05 +00:00
parent a506120646
commit da179c607e
No known key found for this signature in database
GPG Key ID: 6EE4CE2BEDC51862
3 changed files with 47 additions and 6 deletions

View File

@ -1733,6 +1733,41 @@ jobs:
docker kill "$(docker ps -q)" ||: docker kill "$(docker ps -q)" ||:
docker rm -f "$(docker ps -a -q)" ||: docker rm -f "$(docker ps -a -q)" ||:
sudo rm -fr "$TEMP_PATH" sudo rm -fr "$TEMP_PATH"
FunctionalStatelessTestBugfixCheck:
needs: [BuilderDebAsan]
runs-on: [self-hosted, func-tester]
steps:
- name: Set envs
run: |
cat >> "$GITHUB_ENV" << 'EOF'
TEMP_PATH=${{runner.temp}}/stateless_bugfix_asan
REPORTS_PATH=${{runner.temp}}/reports_dir
CHECK_NAME=Stateless tests bugfix validate check (address, actions)
REPO_COPY=${{runner.temp}}/stateless_bugfix_asan/ClickHouse
KILL_TIMEOUT=3600
EOF
- name: Download json reports
uses: actions/download-artifact@v2
with:
path: ${{ env.REPORTS_PATH }}
- name: Clear repository
run: |
sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE"
- name: Check out repository code
uses: actions/checkout@v2
- name: Functional test
run: |
sudo rm -fr "$TEMP_PATH"
mkdir -p "$TEMP_PATH"
cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH"
cd "$REPO_COPY/tests/ci"
python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" --validate-bugfix
- name: Cleanup
if: always()
run: |
docker kill "$(docker ps -q)" ||:
docker rm -f "$(docker ps -a -q)" ||:
sudo rm -fr "$TEMP_PATH"
############################################################################################## ##############################################################################################
############################ FUNCTIONAl STATEFUL TESTS ####################################### ############################ FUNCTIONAl STATEFUL TESTS #######################################
############################################################################################## ##############################################################################################

View File

@ -17,7 +17,7 @@ class DockerImage:
def __str__(self): def __str__(self):
return f"{self.name}:{self.version}" return f"{self.name}:{self.version}"
def get_images_with_versions(reports_path, required_image, pull=True): def get_images_with_versions(reports_path, required_image, pull=True, version=None):
images_path = None images_path = None
for root, _, files in os.walk(reports_path): for root, _, files in os.walk(reports_path):
for f in files: for f in files:
@ -43,6 +43,8 @@ def get_images_with_versions(reports_path, required_image, pull=True):
docker_image = DockerImage(image_name) docker_image = DockerImage(image_name)
if image_name in images: if image_name in images:
docker_image.version = images[image_name] docker_image.version = images[image_name]
if version is not None:
docker_image.version = str(version)
docker_images.append(docker_image) docker_images.append(docker_image)
if pull: if pull:
@ -60,5 +62,5 @@ def get_images_with_versions(reports_path, required_image, pull=True):
return docker_images return docker_images
def get_image_with_version(reports_path, image, pull=True): def get_image_with_version(reports_path, image, pull=True, version=None):
return get_images_with_versions(reports_path, [image], pull)[0] return get_images_with_versions(reports_path, [image], pull, version=version)[0]

View File

@ -139,10 +139,13 @@ if __name__ == "__main__":
check_name = sys.argv[1] check_name = sys.argv[1]
kill_timeout = int(sys.argv[2]) kill_timeout = int(sys.argv[2])
validate_bugix_check = len(sys.argv) >= 4 and sys.argv[3] == "--validate-bugfix"
flaky_check = 'flaky' in check_name.lower() flaky_check = 'flaky' in check_name.lower()
run_changed_tests = flaky_check or validate_bugix_check
gh = Github(get_best_robot_token()) gh = Github(get_best_robot_token())
pr_info = PRInfo(need_changed_files=flaky_check) pr_info = PRInfo(need_changed_files=run_changed_tests)
if 'RUN_BY_HASH_NUM' in os.environ: if 'RUN_BY_HASH_NUM' in os.environ:
run_by_hash_num = int(os.getenv('RUN_BY_HASH_NUM')) run_by_hash_num = int(os.getenv('RUN_BY_HASH_NUM'))
@ -162,7 +165,7 @@ if __name__ == "__main__":
os.makedirs(temp_path) os.makedirs(temp_path)
tests_to_run = [] tests_to_run = []
if flaky_check: if run_changed_tests:
tests_to_run = get_tests_to_run(pr_info) tests_to_run = get_tests_to_run(pr_info)
if not tests_to_run: if not tests_to_run:
commit = get_commit(gh, pr_info.sha) commit = get_commit(gh, pr_info.sha)
@ -170,7 +173,8 @@ if __name__ == "__main__":
sys.exit(0) sys.exit(0)
image_name = get_image_name(check_name) image_name = get_image_name(check_name)
docker_image = get_image_with_version(reports_path, image_name) image_ver = 0 if validate_bugix_check else None
docker_image = get_image_with_version(reports_path, image_name, version=image_ver)
repo_tests_path = os.path.join(repo_path, "tests") repo_tests_path = os.path.join(repo_path, "tests")