From a86ea89a7e2fd9db0ee6f5246c4e3d49d7faa99c Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Sun, 10 Nov 2024 15:53:29 +0100 Subject: [PATCH] [skip ci] limit test run based on module --- .github/workflows/intermittent-test-check.yml | 8 +++- hadoop-ozone/dev-support/checks/_find_test.sh | 39 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 hadoop-ozone/dev-support/checks/_find_test.sh diff --git a/.github/workflows/intermittent-test-check.yml b/.github/workflows/intermittent-test-check.yml index 5de5654aced..fbd7dee2d48 100644 --- a/.github/workflows/intermittent-test-check.yml +++ b/.github/workflows/intermittent-test-check.yml @@ -179,11 +179,17 @@ jobs: java-version: 8 - name: Execute tests run: | + args="-DexcludedGroups=native|slow|unhealthy" + if [[ -e "${{ steps.download-ozone-repo.outputs.download-path }}" ]]; then export OZONE_REPO_CACHED=true + + module=$(hadoop-ozone/dev-support/checks/_find_test.sh "$TEST_CLASS") + if [[ -n "$module" ]]; then + args="$args -pl :$module" + fi fi - args="-DexcludedGroups=native|slow|unhealthy" if [[ "${{ github.event.inputs.ratis-ref }}" != "" ]]; then args="$args -Dratis.version=${{ needs.ratis.outputs.ratis-version }}" args="$args -Dratis.thirdparty.version=${{ needs.ratis.outputs.thirdparty-version }}" diff --git a/hadoop-ozone/dev-support/checks/_find_test.sh b/hadoop-ozone/dev-support/checks/_find_test.sh new file mode 100755 index 00000000000..587b69aac31 --- /dev/null +++ b/hadoop-ozone/dev-support/checks/_find_test.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# 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. + +set -u -o pipefail + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +cd "$DIR/../../.." || exit 1 + +TEST_CLASS="${1:-}" + +if [[ -n "${TEST_CLASS}" ]]; then + file=$(find hadoop-* -name "${TEST_CLASS}.java") + if [[ -n "$file" && ! -e "$file" ]]; then + file="" + fi + if [[ -z "$file" ]]; then + file=$(grep -lr "class $TEST_CLASS\>" hadoop-*) + fi + if [[ -n "$file" && ! -e "$file" ]]; then + file="" + fi + if [[ -n "$file" ]]; then + dir="$(echo "$file" | cut -f1,2 -d"/")" + cd "$dir" && mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout -Dscan=false + fi +fi