Skip to content

Commit

Permalink
[skip ci] limit test run based on module
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai committed Nov 10, 2024
1 parent 27b1744 commit a86ea89
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/intermittent-test-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
39 changes: 39 additions & 0 deletions hadoop-ozone/dev-support/checks/_find_test.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a86ea89

Please sign in to comment.