TestSnapshotDiffManager#ALL[master]-100x10 #28
This file contains 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
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: flaky-test-check | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: Git Ref (Branch/Commit_ID/Tag) | |
default: master | |
required: true | |
test-class: | |
description: Test Class | |
default: NA | |
required: true | |
test-name: | |
description: Test Name | |
default: ALL | |
required: false | |
iterations: | |
description: Number of Iterations per split | |
default: 10 | |
required: true | |
splits: | |
description: Number of splits | |
default: 10 | |
required: true | |
fail-fast: | |
description: Stop after first failure | |
default: false | |
required: true | |
env: | |
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 | |
TEST_CLASS: ${{ github.event.inputs.test-class}} | |
TEST_METHOD: ${{ github.event.inputs.test-name }} | |
ITERATIONS: ${{ github.event.inputs.iterations }} | |
FAIL_FAST: ${{ github.event.inputs.fail-fast }} | |
run-name: ${{ github.event_name == 'workflow_dispatch' && format('{0}#{1}[{2}]-{3}x{4}', inputs.test-class, inputs.test-name, inputs.ref, inputs.splits, inputs.iterations) || '' }} | |
jobs: | |
prepare-job: | |
runs-on: ubuntu-20.04 | |
outputs: | |
matrix: ${{steps.generate.outputs.matrix}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.ref }} | |
- id: generate | |
name: Generate test matrix | |
run: | | |
splits=() | |
for ((i = 1; i <= ${{ github.event.inputs.splits }}; i++)); do | |
splits+=("$i") | |
done | |
printf -v x "%s," "${splits[@]}" | |
split_matrix="[${x%,}]" | |
echo "matrix=$split_matrix" >> $GITHUB_OUTPUT | |
build: | |
needs: | |
- prepare-job | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Cache for maven dependencies | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
~/.m2/repository/*/*/* | |
!~/.m2/repository/org/apache/ozone | |
key: maven-repo-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
maven-repo- | |
- name: Setup java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 8 | |
- name: Build (most) of Ozone | |
run: hadoop-ozone/dev-support/checks/build.sh -Dskip.npx -Dskip.installnpx -DskipShade | |
- name: Store Maven repo for tests | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ozone-repo | |
path: | | |
~/.m2/repository/org/apache/ozone | |
retention-days: 1 | |
run-test: | |
needs: | |
- prepare-job | |
- build | |
name: Run-Split | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
split: ${{fromJson(needs.prepare-job.outputs.matrix)}} # Define splits | |
fail-fast: ${{ fromJson(github.event.inputs.fail-fast) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.ref }} | |
- name: Cache for maven dependencies | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
~/.m2/repository/*/*/* | |
!~/.m2/repository/org/apache/ozone | |
key: maven-repo-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
maven-repo- | |
- name: Download Ozone repo | |
id: download-ozone-repo | |
uses: actions/download-artifact@v4 | |
with: | |
name: ozone-repo | |
path: | | |
~/.m2/repository/org/apache/ozone | |
continue-on-error: true | |
- name: Setup java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 8 | |
- name: Execute tests | |
run: | | |
if [[ -e "${{ steps.download-ozone-repo.outputs.download-path }}" ]]; then | |
export OZONE_REPO_CACHED=true | |
fi | |
args="-DexcludedGroups=native|slow|unhealthy" | |
if [ "$TEST_METHOD" = "ALL" ]; then | |
echo "Running all tests from $TEST_CLASS" | |
set -x | |
hadoop-ozone/dev-support/checks/junit.sh $args -Dtest="$TEST_CLASS,Abstract*Test*\$*" | |
else | |
echo "Running test: $TEST_METHOD from $TEST_CLASS" | |
set -x | |
hadoop-ozone/dev-support/checks/junit.sh $args -Dtest="$TEST_CLASS#$TEST_METHOD,Abstract*Test*\$*" | |
fi | |
continue-on-error: true | |
env: | |
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }} | |
- name: Summary of failures | |
run: hadoop-ozone/dev-support/checks/_summary.sh target/unit/summary.txt | |
if: ${{ !cancelled() }} | |
- name: Archive build results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: result-${{ github.run_id }}-${{ github.run_number }}-${{ matrix.split }} | |
path: target/unit | |
count-failures: | |
if: ${{ always() }} | |
needs: run-test | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Download build results | |
uses: actions/download-artifact@v4 | |
- name: Count failures | |
run: | | |
failures=$(find . -name 'summary.txt' | grep -v 'iteration' | xargs grep -v 'exit code: 0' | wc -l) | |
echo "Total failures: $failures" | |
if [[ $failures -gt 0 ]]; then | |
echo "" | |
echo "Failed runs:" | |
grep 'exit code: 1' */summary.txt | grep -o 'split.*teration [0-9]*' | sed -e 's/.summary.txt:/ /' -e 's/-/ /' | sort -g -k2 -k4 | |
echo "" | |
exit 1 | |
fi |