generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 23
Add workflow to Validate E2E Tests Are Accounted For in a Repo #440
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
jj22ee
merged 10 commits into
aws-observability:main
from
jj22ee:validate-e2e-tests-are-accounted-for
Aug 1, 2025
Merged
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2ba098e
Validate E2E Tests Are Accounted For
jj22ee 8c0188e
update comments
jj22ee 8dd7e9b
Update .github/workflows/validate-e2e-tests-are-accounted-for.yml
jj22ee 4fd1f7c
Update .github/workflows/validate-e2e-tests-are-accounted-for.yml
jj22ee 6299379
Update .github/workflows/validate-e2e-tests-are-accounted-for.yml
jj22ee b26bccc
Update .github/workflows/validate-e2e-tests-are-accounted-for.yml
jj22ee 8032dde
Update .github/workflows/validate-e2e-tests-are-accounted-for.yml
jj22ee bdbe14a
Update .github/workflows/validate-e2e-tests-are-accounted-for.yml
jj22ee 000bd00
Update .github/workflows/validate-e2e-tests-are-accounted-for.yml
jj22ee 698b023
Merge branch 'main' into validate-e2e-tests-are-accounted-for
jj22ee 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
100 changes: 100 additions & 0 deletions
100
.github/workflows/validate-e2e-tests-are-accounted-for.yml
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,100 @@ | ||
| name: Validate E2E Tests Are Accounted For | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| exclusions: | ||
| description: 'Comma-separated list of test files to exclude from validation' | ||
| type: string | ||
| required: false | ||
| default: '' | ||
|
|
||
| env: | ||
| TEST_RESOURCES_FOLDER: ${GITHUB_WORKSPACE} | ||
|
|
||
| jobs: | ||
| validate-e2e-tests-are-accounted-for: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Install Ruby | ||
| uses: ruby/[email protected] | ||
| with: | ||
| ruby-version: "3.4" | ||
|
|
||
| - name: Checkout aws-application-signals-test-framework | ||
| run: | | ||
| cd ${{ env.TEST_RESOURCES_FOLDER }} | ||
| git clone https://github.com/aws-observability/aws-application-signals-test-framework.git | ||
|
|
||
| - name: Determine workflow files expected to be used by ADOT Java | ||
| if: contains(github.repository, 'aws-otel-java-instrumentation') | ||
| run: | | ||
| cd ${{ env.TEST_RESOURCES_FOLDER }}/aws-application-signals-test-framework/.github/workflows/ | ||
| EXCLUSIONS="${{ inputs.exclusions }}" | ||
jj22ee marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| [[ -n "$EXCLUSIONS" ]] && echo "Applying exclusions to TESTS_EXPECTED: $EXCLUSIONS" | ||
| echo "TESTS_EXPECTED=$(ls | grep -E '(^java-)|(^metric-limiter-)' | grep -Ev '(lambda-layer-perf-test|otlp-ocb)' | grep -E 'test\.ya?ml$' | { [[ -n "$EXCLUSIONS" ]] && grep -v -F -f <(echo "$EXCLUSIONS" | tr ',' '\n') || cat; } | sort | tr '\n' ' ' | sed 's/ $//')" >> $GITHUB_ENV | ||
|
|
||
| - name: Determine workflow files expected to be used by ADOT JavaScript | ||
| if: contains(github.repository, 'aws-otel-js-instrumentation') | ||
| run: | | ||
| cd ${{ env.TEST_RESOURCES_FOLDER }}/aws-application-signals-test-framework/.github/workflows/ | ||
| EXCLUSIONS="${{ inputs.exclusions }}" | ||
jj22ee marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| [[ -n "$EXCLUSIONS" ]] && echo "Applying exclusions to TESTS_EXPECTED: $EXCLUSIONS" | ||
| echo "TESTS_EXPECTED=$(ls | grep -E '^node-' | grep -v 'lambda-layer-perf-test' | grep -E 'test\.ya?ml$' | { [[ -n "$EXCLUSIONS" ]] && grep -v -F -f <(echo "$EXCLUSIONS" | tr ',' '\n') || cat; } | sort | tr '\n' ' ' | sed 's/ $//')" >> $GITHUB_ENV | ||
|
|
||
| - name: Determine workflow files expected to be used by ADOT Python | ||
| if: contains(github.repository, 'aws-otel-python-instrumentation') | ||
| run: | | ||
| cd ${{ env.TEST_RESOURCES_FOLDER }}/aws-application-signals-test-framework/.github/workflows/ | ||
| EXCLUSIONS="${{ inputs.exclusions }}" | ||
jj22ee marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| [[ -n "$EXCLUSIONS" ]] && echo "Applying exclusions to TESTS_EXPECTED: $EXCLUSIONS" | ||
| echo "TESTS_EXPECTED=$(ls | grep -E '^python-' | grep -v 'lambda-layer-perf-test' | grep -E 'test\.ya?ml$' | { [[ -n "$EXCLUSIONS" ]] && grep -v -F -f <(echo "$EXCLUSIONS" | tr ',' '\n') || cat; } | sort | tr '\n' ' ' | sed 's/ $//')" >> $GITHUB_ENV | ||
|
|
||
| - name: Determine workflow files expected to be used by ADOT .NET | ||
| if: contains(github.repository, 'aws-otel-dotnet-instrumentation') | ||
| run: | | ||
| cd ${{ env.TEST_RESOURCES_FOLDER }}/aws-application-signals-test-framework/.github/workflows/ | ||
| EXCLUSIONS="${{ inputs.exclusions }}" | ||
jj22ee marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| [[ -n "$EXCLUSIONS" ]] && echo "Applying exclusions to TESTS_EXPECTED: $EXCLUSIONS" | ||
| echo "TESTS_EXPECTED=$(ls | grep -E '^dotnet-' | grep -v 'lambda-layer-perf-test' | grep -E 'test\.ya?ml$' | { [[ -n "$EXCLUSIONS" ]] && grep -v -F -f <(echo "$EXCLUSIONS" | tr ',' '\n') || cat; } | sort | tr '\n' ' ' | sed 's/ $//')" >> $GITHUB_ENV | ||
|
|
||
| - name: Determine workflow files expected to be used by CloudWatch Agent | ||
| if: contains(github.repository, 'amazon-cloudwatch-agent') | ||
| run: | | ||
| cd ${{ env.TEST_RESOURCES_FOLDER }}/aws-application-signals-test-framework/.github/workflows/ | ||
| EXCLUSIONS="${{ inputs.exclusions }}" | ||
jj22ee marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| [[ -n "$EXCLUSIONS" ]] && echo "Applying exclusions to TESTS_EXPECTED: $EXCLUSIONS" | ||
| echo "TESTS_EXPECTED=$(ls | grep -E '(^java-)|(^node-)|(^python-)|(^dotnet-)|(^metric-limiter-)' | grep -Ev '(sigv4|lambda-test|lambda-layer-perf-test|ocb|genesis)' | grep -E 'test\.ya?ml$' | { [[ -n "$EXCLUSIONS" ]] && grep -v -F -f <(echo "$EXCLUSIONS" | tr ',' '\n') || cat; } | sort | tr '\n' ' ' | sed 's/ $//')" >> $GITHUB_ENV | ||
|
|
||
| - name: Determine workflow files actually being used by ${{ github.repository }} | ||
| run: | | ||
| cd ${{ env.TEST_RESOURCES_FOLDER }} | ||
| git clone -b ${{ github.ref_name }} https://github.com/${{ github.repository }}.git ${{ github.repository }} | ||
| cd ${{ github.repository }}/.github/workflows/ | ||
|
|
||
| # Get all test framework workflows actually used in application-signals-e2e-test.yml, with exclusions applied | ||
| EXCLUSIONS="${{ inputs.exclusions }}" | ||
| [[ -n "$EXCLUSIONS" ]] && echo "Applying exclusions to TESTS_ACTUALLY_USED: $EXCLUSIONS" | ||
| echo "TESTS_ACTUALLY_USED=$(ruby -ryaml -e ' | ||
| exclusions = "${{ inputs.exclusions }}".split(",").map(&:strip).reject(&:empty?) | ||
jj22ee marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| workflows = YAML.load_file("application-signals-e2e-test.yml")["jobs"].values | ||
| .map { |v| v["uses"] } | ||
| .compact | ||
| .uniq | ||
| # Ignore the Job that triggers this "validate-e2e-tests-are-accounted-for" validation | ||
| .select { |u| u.include?("aws-application-signals-test-framework/.github/workflows") && !u.include?("validate-e2e-tests-are-accounted-for") } | ||
| .map { |u| u.split("/").last.split("@").first } | ||
| .reject { |w| exclusions.include?(w) } | ||
| .sort | ||
| puts workflows.join(" ") | ||
| ')" >> $GITHUB_ENV | ||
|
|
||
| - name: Compare TESTS_ACTUALLY_USED and TESTS_EXPECTED | ||
| run: | | ||
| echo "Tests being used:" | ||
| echo "- $TESTS_ACTUALLY_USED" | ||
| echo "Tests expected to be used:" | ||
| echo "- $TESTS_EXPECTED" | ||
| if [[ -z "$TESTS_ACTUALLY_USED" || -z "$TESTS_EXPECTED" || "$TESTS_ACTUALLY_USED" != "$TESTS_EXPECTED" ]]; then | ||
| echo "Mismatch found!" | ||
| exit 1 | ||
| fi | ||
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.