From 81a2f4268b9e0f25cb6e1ce5c28bba0a34c27604 Mon Sep 17 00:00:00 2001 From: Bo Wu Date: Sun, 15 Dec 2024 21:07:17 -0800 Subject: [PATCH] add image-tag to cancel group --- .github/workflows/replay-verify.yaml | 2 +- testsuite/replay-verify/README.md | 10 ++++++++++ testsuite/replay-verify/archive_disk_utils.py | 10 +++++++++- testsuite/replay-verify/main.py | 10 +++++++++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/replay-verify.yaml b/.github/workflows/replay-verify.yaml index 8de27ba546a80..6110eede6036b 100644 --- a/.github/workflows/replay-verify.yaml +++ b/.github/workflows/replay-verify.yaml @@ -42,7 +42,7 @@ permissions: # cancel redundant builds concurrency: # cancel redundant builds on PRs (only on PR, not on branches) - group: ${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.ref) || github.sha }} + group: ${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.ref) || github.sha }}-${{ inputs.IMAGE_TAG || 'latest' }} cancel-in-progress: true jobs: diff --git a/testsuite/replay-verify/README.md b/testsuite/replay-verify/README.md index 1c26e26d39288..fc829bbe77b87 100644 --- a/testsuite/replay-verify/README.md +++ b/testsuite/replay-verify/README.md @@ -11,6 +11,11 @@ The main script for executing replay verify tests. This script is responsible fo - Running replay verification tests against specified networks (testnet/mainnet) - Verifying transaction execution matches expected results - Handling test orchestration and reporting +``` test with cli +cd testsuite/replay-verify +poetry shell +python main.py --image_tag YOUR_IMAGE_TAG --network testnet +``` ### archive_disk_utils.py @@ -19,5 +24,10 @@ A utility script for managing archive storage disks used in replay verification. - Provisions Google Cloud Storage disks for storing blockchain archive data - Supports both testnet and mainnet networks - Is called by GitHub Actions workflows to automatically manage storage resources +```test with cli +cd testsuite/replay-verify +poetry shell +python archive_disk_utils.py --network mainnet +``` diff --git a/testsuite/replay-verify/archive_disk_utils.py b/testsuite/replay-verify/archive_disk_utils.py index 02eb746899085..0e02c04497f6f 100644 --- a/testsuite/replay-verify/archive_disk_utils.py +++ b/testsuite/replay-verify/archive_disk_utils.py @@ -201,7 +201,7 @@ def generate_disk_name(run_id: str, snapshot_name: str, pvc_id: int) -> str: @retry( stop=stop_after_attempt(3), wait=wait_exponential(multiplier=1, min=4, max=10), - retry=retry_if_exception_type((ApiException, Exception)), + retry=retry_if_exception_type(ApiException), before_sleep=lambda retry_state: logger.warning( f"Retrying initial disk creation after error: {retry_state.outcome.exception()}" ), @@ -493,6 +493,14 @@ def parse_args() -> argparse.Namespace: return args +@retry( + stop=stop_after_attempt(3), + wait=wait_exponential(multiplier=1, min=4, max=10), + retry=retry_if_exception_type((ApiException, Exception)), + before_sleep=lambda retry_state: logger.warning( + f"Retrying creating pvc from snapshot after error: {retry_state.outcome.exception()}" + ), +) def create_one_pvc_from_snapshot( pvc_name: str, snapshot_name: str, namespace: str, label: str ) -> str: diff --git a/testsuite/replay-verify/main.py b/testsuite/replay-verify/main.py index 566a850cf1585..dd889745087bd 100644 --- a/testsuite/replay-verify/main.py +++ b/testsuite/replay-verify/main.py @@ -237,6 +237,14 @@ def start(self) -> None: ) time.sleep(RETRY_DELAY) + @retry( + stop=stop_after_attempt(MAX_RETRIES), + wait=wait_fixed(RETRY_DELAY), + retry=retry_if_exception_type(ApiException), + before_sleep=lambda retry_state: logger.warning( + f"Retry {retry_state.attempt_number}/{MAX_RETRIES} failed: {retry_state.outcome.exception()}" + ), + ) def delete_pod(self): response = self.client.delete_namespaced_pod( name=self.name, @@ -259,7 +267,7 @@ def get_pod_exit_code(self): retry=retry_if_exception_type(ApiException), before_sleep=lambda retry_state: logger.warning( f"Retry {retry_state.attempt_number}/{MAX_RETRIES} failed: {retry_state.outcome.exception()}" - ) + ), ) def get_pod_status(self): pod_status = self.client.read_namespaced_pod_status(