-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: add validation for zombienet flaky tests #10034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
150e8b3
feat: add validation for zombienet flaky tests entries and issue refe…
DenzelPenzel bf1c52c
feat: validate that zombienet flaky test entries reference issues, no…
DenzelPenzel f0ca667
chore: remove deregister-register-validator from flaky tests list
DenzelPenzel b7edbb9
Merge branch 'master' into flaky-validation-tests
pepoviola File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Validates the .github/zombienet-flaky-tests file to ensure: | ||
| # 1. Each entry has the correct format: <test-name>:<issue-number> | ||
| # 2. The referenced number is a GitHub Issue | ||
| # 3. The GitHub issue exists | ||
| # 4. The issue is OPEN (warns if closed) | ||
|
|
||
| set -uo pipefail | ||
|
|
||
| FLAKY_TESTS_FILE="${1:-.github/zombienet-flaky-tests}" | ||
|
|
||
| if [[ ! -f "$FLAKY_TESTS_FILE" ]]; then | ||
| echo "Error: File not found: $FLAKY_TESTS_FILE" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! command -v gh &> /dev/null; then | ||
| echo "Error: gh CLI is not installed" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Validating $FLAKY_TESTS_FILE..." | ||
| echo | ||
|
|
||
| has_errors=false | ||
| line_num=0 | ||
|
|
||
| while IFS= read -r line || [[ -n "$line" ]]; do | ||
| line_num=$((line_num + 1)) | ||
|
|
||
| if [[ -z "$line" ]]; then | ||
| continue | ||
| fi | ||
|
|
||
| # Parse format: test-name:issue-number | ||
| if [[ ! "$line" =~ ^([^:]+):([0-9]+)$ ]]; then | ||
| echo "❌ Line $line_num: Missing required issue number" >&2 | ||
| echo " Entry: '$line'" >&2 | ||
| echo " Expected format: <test-name>:<issue-number>" >&2 | ||
| echo " Example: zombienet-polkadot-test-name:1234" >&2 | ||
| has_errors=true | ||
| continue | ||
| fi | ||
|
|
||
| test_name="${BASH_REMATCH[1]}" | ||
| issue_number="${BASH_REMATCH[2]}" | ||
|
|
||
| set +e | ||
| issue_data=$(gh issue view "$issue_number" --json state,title,url 2>&1) | ||
| gh_exit_code=$? | ||
| set -e | ||
|
|
||
| if [[ $gh_exit_code -ne 0 ]]; then | ||
| echo "❌ Line $line_num: Issue #$issue_number does not exist" >&2 | ||
| echo " Test: $test_name" >&2 | ||
| has_errors=true | ||
| continue | ||
| fi | ||
|
|
||
| url=$(echo "$issue_data" | jq -r '.url') | ||
| state=$(echo "$issue_data" | jq -r '.state') | ||
| title=$(echo "$issue_data" | jq -r '.title') | ||
|
|
||
| # Check if it's an issue (not a PR) by verifying the URL contains '/issues/' | ||
| if [[ ! "$url" =~ /issues/ ]]; then | ||
| echo "❌ Line $line_num: #$issue_number is a Pull Request, not an Issue" >&2 | ||
| echo " Test: $test_name" >&2 | ||
| echo " URL: $url" >&2 | ||
| echo " Please reference a GitHub Issue, not a PR" >&2 | ||
| has_errors=true | ||
| continue | ||
| fi | ||
|
|
||
| if [[ "$state" == "OPEN" ]]; then | ||
| echo "✅ Line $line_num: $test_name -> Issue #$issue_number (open)" | ||
| else | ||
| echo "⚠️ Line $line_num: Issue #$issue_number is closed: '$title'" >&2 | ||
| echo " Test: $test_name" >&2 | ||
| echo " Consider removing this entry if the issue is resolved." >&2 | ||
| fi | ||
|
|
||
| done < "$FLAKY_TESTS_FILE" | ||
|
|
||
| echo | ||
|
|
||
| if [[ "$has_errors" == "true" ]]; then | ||
| echo "❌ Validation failed with errors" >&2 | ||
| exit 1 | ||
| else | ||
| echo "✅ All entries are valid" | ||
| exit 0 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: Check Zombienet Flaky Tests | ||
|
|
||
| concurrency: | ||
| group: check-zombienet-flaky-tests-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| paths: | ||
| - '.github/zombienet-flaky-tests' | ||
| - '.github/scripts/check-zombienet-flaky-tests.sh' | ||
| - '.github/workflows/check-zombienet-flaky-tests.yml' | ||
| merge_group: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| check-flaky-tests: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
|
|
||
| - name: Validate zombienet-flaky-tests | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| .github/scripts/check-zombienet-flaky-tests.sh .github/zombienet-flaky-tests | ||
|
|
||
| - name: Check results | ||
| if: failure() | ||
| run: | | ||
| echo "::error::Validation failed. Please ensure all entries in .github/zombienet-flaky-tests have valid format and reference existing GitHub issues." | ||
| echo "Format: <test-name>:<issue-number>" | ||
| echo "See .github/ZOMBIENET_FLAKY_TESTS.md for more information." | ||
| exit 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.