Skip to content
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

[Draft] Split unit tests in CI #17608

Draft
wants to merge 27 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e38d20f
Split processing_modules_test into 2 ranges
Akshat-Jain Jan 7, 2025
b57e01b
Try commenting unnecessary checks
Akshat-Jain Jan 7, 2025
f3b7265
Fix issue with test_range not present in inputs
Akshat-Jain Jan 7, 2025
40cac46
Disable failIfNoSpecifiedTests
Akshat-Jain Jan 7, 2025
82c7497
Split indexing_modules_test and other_modules_test
Akshat-Jain Jan 7, 2025
0e0372d
Add test_range to job name
Akshat-Jain Jan 7, 2025
89c3877
Try splits from A-J and K-Z
Akshat-Jain Jan 7, 2025
8dad5f7
Remove Test from regex pattern matching
Akshat-Jain Jan 7, 2025
03a7136
Try splits from A-K and L-Z
Akshat-Jain Jan 7, 2025
e4d9e46
Revert "Remove Test from regex pattern matching"
Akshat-Jain Jan 7, 2025
de3ed41
Use A*,B* approach
Akshat-Jain Jan 7, 2025
f32487d
Use A*,B* approach
Akshat-Jain Jan 7, 2025
95dfcde
Revert "Use A*,B* approach"
Akshat-Jain Jan 7, 2025
b173d66
Revert "Use A*,B* approach"
Akshat-Jain Jan 7, 2025
d94ba1f
Restore A*,B* approach and make a couple of classes abstract
Akshat-Jain Jan 7, 2025
c13e965
Investigating jacoco issues of azure module because of no tests in split
Akshat-Jain Jan 7, 2025
ab70a11
Remove hardcoded jacoco config limits from azure module
Akshat-Jain Jan 7, 2025
3f0605b
Revert "Investigating jacoco issues of azure module because of no tes…
Akshat-Jain Jan 7, 2025
4c77f42
Remove echo
Akshat-Jain Jan 7, 2025
edcdbc4
Revert "Try commenting unnecessary checks"
Akshat-Jain Jan 7, 2025
2d36e84
Try to fix reading matrix outputs
Akshat-Jain Jan 7, 2025
f7492cb
Try to fix reading matrix outputs v2
Akshat-Jain Jan 7, 2025
25b1582
Run check_results always
Akshat-Jain Jan 7, 2025
703099f
Debug reading matrix values
Akshat-Jain Jan 7, 2025
df04ce8
Reduce tests and try reading job result and outputs
Akshat-Jain Jan 8, 2025
5cbb8ed
Change default to X-X
Akshat-Jain Jan 8, 2025
4f000f0
Comment out last layer of tests
Akshat-Jain Jan 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/scripts/unit_tests_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@ set -e

unset _JAVA_OPTIONS

# Get the start and end letters from the range
START=$(echo ${TEST_RANGE} | cut -d'-' -f1)
END=$(echo ${TEST_RANGE} | cut -d'-' -f2)

# Generate the list of patterns and replace spaces with *,
# This essentially converts a range of A-D to A*,B*,C*,D*
RANGES=$(eval echo {${START}..${END}} | sed -e 's/ /*,/g')
RANGES+="*"

# Set MAVEN_OPTS for Surefire launcher.
MAVEN_OPTS='-Xmx2500m' ${MVN} test -pl ${MAVEN_PROJECTS} \
${MAVEN_SKIP} \
-Dtest="${RANGES}" \
-DjfrProfilerArgLine="${JFR_PROFILER_ARG_LINE}" -Pci
sh -c "dmesg | egrep -i '(oom|out of memory|kill process|killed).*' -C 1 || exit 0"
free -m
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,9 @@ name: "CodeQL"

on:
push:
paths-ignore:
- '**/*.md'
- 'dev/**'
- 'docs/**'
branches: [ 'master', '0.6.x', '0.7.x', '0.7.1.x', '0.7.2.x', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.9.0', '0.9.1' ]
branches: [ 'nonexistentbranch' ]
pull_request:
paths-ignore:
- '**/*.md'
- 'dev/**'
- 'docs/**'
# The branches below must be a subset of the branches above
branches: [ 'master' ]
branches: [ 'nonexistentbranch' ]
schedule:
- cron: '18 15 * * 4'

Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/reusable-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ on:
required: true
type: string
description: 'Name of group of tests running (to display)'
test_range:
required: false
type: string
description: 'Test name range (A-M, for example) for splitting tests based on the first character of the test class name'
default: 'X-X'
outputs:
coverage_failure:
description: 'Indicates if test failed by coverage issues'
Expand All @@ -44,7 +49,7 @@ env:

jobs:
unit-tests:
name: ${{ inputs.module }} modules test
name: ${{ inputs.module }} modules test (test_range=${{ inputs.test_range }})
runs-on: ubuntu-latest
outputs:
coverage_failure: ${{ steps.set_outputs.outputs.coverage_failure }}
Expand Down Expand Up @@ -103,6 +108,7 @@ jobs:
id: test_and_coverage
env:
MAVEN_PROJECTS: ${{ inputs.maven_projects }}
TEST_RANGE: ${{ inputs.test_range }}
run: ./.github/scripts/unit_tests_script.sh

- name: Check for dumps on failure
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ name: "Static Checks CI"
on:
push:
branches:
- master
- '[0-9]+.[0-9]+.[0-9]+' # release branches
- '[0-9]+.[0-9]+.[0-9]+-[A-Za-z0-9]+' # release branches
- nonexistentbranch
pull_request:
branches:
- master
- '[0-9]+.[0-9]+.[0-9]+' # release branches
- '[0-9]+.[0-9]+.[0-9]+-[A-Za-z0-9]+' # release branches
- nonexistentbranch

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}' # group workflows only on pull_requests and not on branch commits
Expand Down
52 changes: 26 additions & 26 deletions .github/workflows/unit-and-integration-tests-unified.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,18 @@ jobs:
echo ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_IT_IMAGE_NAME }}
docker save "${{ needs.set-env-var.outputs.DRUID_PREVIOUS_IT_IMAGE_NAME }}" | gzip > druid-container-jdk${{ matrix.jdk }}-version${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION }}.tar.gz

unit-tests-phase2:
strategy:
fail-fast: false
matrix:
# Use JDK 21.0.4 to work around https://github.com/apache/druid/issues/17429
jdk: [ '11', '21.0.4' ]
name: "unit tests (jdk${{ matrix.jdk }})"
uses: ./.github/workflows/unit-tests.yml
needs: unit-tests
if: ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
with:
jdk: ${{ matrix.jdk }}
# unit-tests-phase2:
# strategy:
# fail-fast: false
# matrix:
# # Use JDK 21.0.4 to work around https://github.com/apache/druid/issues/17429
# jdk: [ '11', '21.0.4' ]
# name: "unit tests (jdk${{ matrix.jdk }})"
# uses: ./.github/workflows/unit-tests.yml
# needs: unit-tests
# if: ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
# with:
# jdk: ${{ matrix.jdk }}

unit-tests:
name: "unit tests (jdk17)"
Expand All @@ -177,17 +177,17 @@ jobs:
with:
jdk: 17

standard-its:
needs: unit-tests
if: ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
uses: ./.github/workflows/standard-its.yml

revised-its:
needs: [unit-tests, set-env-var]
if: ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
uses: ./.github/workflows/revised-its.yml
with:
BACKWARD_COMPATIBILITY_IT_ENABLED: ${{ needs.set-env-var.outputs.BACKWARD_COMPATIBILITY_IT_ENABLED }}
DRUID_PREVIOUS_VERSION: ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION }}
DRUID_PREVIOUS_VERSION_DOWNLOAD_URL: ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION_DOWNLOAD_URL }}
DRUID_PREVIOUS_IT_IMAGE_NAME: ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_IT_IMAGE_NAME }}
# standard-its:
# needs: unit-tests
# if: ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
# uses: ./.github/workflows/standard-its.yml

# revised-its:
# needs: [unit-tests, set-env-var]
# if: ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
# uses: ./.github/workflows/revised-its.yml
# with:
# BACKWARD_COMPATIBILITY_IT_ENABLED: ${{ needs.set-env-var.outputs.BACKWARD_COMPATIBILITY_IT_ENABLED }}
# DRUID_PREVIOUS_VERSION: ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION }}
# DRUID_PREVIOUS_VERSION_DOWNLOAD_URL: ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION_DOWNLOAD_URL }}
# DRUID_PREVIOUS_IT_IMAGE_NAME: ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_IT_IMAGE_NAME }}
71 changes: 46 additions & 25 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,7 @@ on:
outputs:
continue_tests:
description: 'Flag to decide if next tests need to run incase coverage issue failures'
value: |
${{
(jobs.indexing_modules_test.result == 'success' || jobs.indexing_modules_test.result == 'skipped' ||
fromJson(jobs.indexing_modules_test.outputs.coverage_failure)) &&
(jobs.processing_modules_test.result == 'success' || jobs.processing_modules_test.result == 'skipped' ||
fromJson(jobs.processing_modules_test.outputs.coverage_failure)) &&
(jobs.server_modules_test.result == 'success' || jobs.server_modules_test.result == 'skipped' || fromJson
(jobs.server_modules_test.outputs.coverage_failure)) &&
(jobs.other_modules_test.result == 'success' || jobs.other_modules_test.result == 'skipped' || fromJson(jobs
.other_modules_test.outputs.coverage_failure))
}}
value: ${{ jobs.check_results.outputs.should_continue }}

jobs:
changes:
Expand All @@ -61,23 +51,33 @@ jobs:
kinesis:
- 'extensions-core/kinesis-indexing-service/**'

indexing_modules_test:
needs: changes
if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.kafka == 'true' || needs.changes.outputs.kinesis == 'true'}}
uses: ./.github/workflows/reusable-unit-tests.yml
with:
jdk: ${{ inputs.jdk }}
module: indexing
maven_projects: 'indexing-hadoop,indexing-service,extensions-core/kafka-indexing-service,extensions-core/kinesis-indexing-service'
# indexing_modules_test:
# needs: changes
# strategy:
# fail-fast: false
# matrix:
# test_range: [ 'A-K', 'L-Z' ]
# if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.kafka == 'true' || needs.changes.outputs.kinesis == 'true'}}
# uses: ./.github/workflows/reusable-unit-tests.yml
# with:
# jdk: ${{ inputs.jdk }}
# module: indexing
# maven_projects: 'indexing-hadoop,indexing-service,extensions-core/kafka-indexing-service,extensions-core/kinesis-indexing-service'
# test_range: ${{ matrix.test_range }}

processing_modules_test:
needs: changes
strategy:
fail-fast: false
matrix:
test_range: [ 'X-X', 'Y-Y' ]
if: ${{ needs.changes.outputs.core == 'true' }}
uses: ./.github/workflows/reusable-unit-tests.yml
with:
jdk: ${{ inputs.jdk }}
module: processing
maven_projects: 'processing'
test_range: ${{ matrix.test_range }}

server_modules_test:
needs: changes
Expand All @@ -88,9 +88,30 @@ jobs:
module: server
maven_projects: 'server'

other_modules_test:
uses: ./.github/workflows/reusable-unit-tests.yml
with:
jdk: ${{ inputs.jdk }}
module: other
maven_projects: '!processing,!indexing-hadoop,!indexing-service,!extensions-core/kafka-indexing-service,!extensions-core/kinesis-indexing-service,!server,!web-console,!integration-tests,!:druid-it-tools,!:druid-it-image,!:druid-it-cases'
# other_modules_test:
# uses: ./.github/workflows/reusable-unit-tests.yml
# strategy:
# fail-fast: false
# matrix:
# test_range: [ 'A-K', 'L-Z' ]
# with:
# jdk: ${{ inputs.jdk }}
# module: other
# maven_projects: '!processing,!indexing-hadoop,!indexing-service,!extensions-core/kafka-indexing-service,!extensions-core/kinesis-indexing-service,!server,!web-console,!integration-tests,!:druid-it-tools,!:druid-it-image,!:druid-it-cases'
# test_range: ${{ matrix.test_range }}

check_results:
needs: [processing_modules_test, server_modules_test]
runs-on: ubuntu-latest
outputs:
should_continue: ${{ steps.check.outputs.continue }}
steps:
- id: check
run: |
echo '${{ toJSON(needs.processing_modules_test.result) }}'
echo '${{ toJSON(needs.server_modules_test.result) }}'

echo '${{ toJSON(needs.processing_modules_test.outputs) }}'
echo '${{ toJSON(needs.server_modules_test.outputs) }}'

echo "continue=true" >> $GITHUB_OUTPUT
58 changes: 0 additions & 58 deletions extensions-core/azure-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,62 +180,4 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.8</minimum>
</limit>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.8</minimum>
</limit>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>0.8</minimum>
</limit>
<limit>
<counter>COMPLEXITY</counter>
<value>COVEREDRATIO</value>
<minimum>0.7</minimum>
</limit>
<limit>
<counter>METHOD</counter>
<value>COVEREDRATIO</value>
<minimum>0.7</minimum>
</limit>
<limit>
<counter>CLASS</counter>
<value>COVEREDRATIO</value>
<minimum>0.90</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
<executions>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1859,6 +1859,7 @@
<trimStackTrace>${surefire.trimStackTrace}</trimStackTrace>
<!-- our tests are very verbose, let's keep the volume down -->
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
<!-- Surefire default is to exclude static inner classes; which may lead to the ignore of static inner classes
https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#excludes -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
import java.util.Map;
import java.util.stream.Collectors;

public class IndexMergerTestBase extends InitializedNullHandlingTest
public abstract class IndexMergerTestBase extends InitializedNullHandlingTest
{
@Rule
public final TemporaryFolder temporaryFolder = new TemporaryFolder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import static org.junit.Assert.assertArrayEquals;

public class CacheTestBase<T extends Cache>
public abstract class CacheTestBase<T extends Cache>
{
T cache;

Expand Down
Loading