diff --git a/.github/workflows/gradle-extraction-check.yml b/.github/workflows/gradle-extraction-check.yml deleted file mode 100644 index 5f742b2f90aa..000000000000 --- a/.github/workflows/gradle-extraction-check.yml +++ /dev/null @@ -1,29 +0,0 @@ -# This test covers TikaServer tests for SolrCell, since crave does not support docker yet. -name: Extraction module tests with Docker - -on: - pull_request: - branches: - - '*' - paths: - - 'solr/modules/extraction/**' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - test: - name: extraction module tests with docker - - runs-on: ubuntu-latest - timeout-minutes: 15 - - steps: - - name: Checkout code - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: ./.github/actions/prepare-for-build - - - name: Run extraction module tests - run: ./gradlew --no-daemon solr:modules:extraction:check diff --git a/.github/workflows/solrj-test.yml b/.github/workflows/solrj-test.yml deleted file mode 100644 index 4e66e4af85df..000000000000 --- a/.github/workflows/solrj-test.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: SolrJ Tests - -on: - pull_request: - branches: - - '*' - paths: - - '.github/workflows/solrj-test.yml' - - 'solr/solrj/**' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - test: - name: Run SolrJ Tests - - runs-on: ubuntu-latest - timeout-minutes: 15 - - steps: - - name: Checkout code - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: ./.github/actions/prepare-for-build - - - name: Test SolrJ module - run: ./gradlew solr:solrj:test diff --git a/.github/workflows/tests-core.yml b/.github/workflows/tests-core.yml new file mode 100644 index 000000000000..8f4007bcb162 --- /dev/null +++ b/.github/workflows/tests-core.yml @@ -0,0 +1,91 @@ +name: Solr Core Tests + +# solr/core is most of the whole test suite, so it is split into four slices by +# Java package that run in parallel. The slices are balanced from measured CI +# timings: the cloud package alone is the largest unit in solr/core and sets +# the critical path, so its api and overseer sub-packages run in the search +# slice instead. The "other" slice is exclusion-based so that a new package +# can never silently fall outside every slice. + +on: + pull_request: + branches: + - '*' + paths: + - '.github/workflows/tests-core.yml' + - 'gradle/libs.versions.toml' + - 'solr/core/**' + - 'solr/solrj-zookeeper/**' + # core tests are built on these; a change here can break them + - 'solr/test-framework/**' + - 'solr/api/**' + - 'solr/solrj/**' + - 'solr/solrj-jetty/**' + - 'solr/solrj-streaming/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Run Solr Core Tests (${{ matrix.slice }}) + + runs-on: ubuntu-latest + timeout-minutes: 25 + + strategy: + fail-fast: false + matrix: + slice: [cloud, search, handler, other] + + env: + # Top-level packages under org.apache.solr for each named slice. + # The "other" slice runs everything not listed here. + SLICE_CLOUD: cloud + SLICE_SEARCH: search uninverting spelling highlight analysis legacy index parser request cloud.api cloud.overseer + SLICE_HANDLER: handler response servlet jersey rest security api + + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - uses: ./.github/actions/prepare-for-build + + - name: Test solr/core slice "${{ matrix.slice }}" + run: | + tasks=(:solr:core:test) + args=() + case "${{ matrix.slice }}" in + cloud) + pkgs="$SLICE_CLOUD" + args+=("-Ptests.exclude=org.apache.solr.cloud.api.*,org.apache.solr.cloud.overseer.*") + ;; + search) pkgs="$SLICE_SEARCH" ;; + handler) pkgs="$SLICE_HANDLER" ;; + other) + # This slice has the most headroom, so it also runs solrj-zookeeper. + # It passes no --tests, so one invocation can drive both test tasks, + # and the excluded packages do not overlap solrj-zookeeper's tests. + pkgs="" + tasks+=(:solr:solrj-zookeeper:test) + excl="" + for p in $SLICE_CLOUD $SLICE_SEARCH $SLICE_HANDLER; do + excl="${excl:+$excl,}org.apache.solr.$p.*" + done + args+=("-Ptests.exclude=$excl") + ;; + esac + for p in $pkgs; do + args+=(--tests "org.apache.solr.$p.*") + done + ./gradlew "${tasks[@]}" -Ptests.jvms=2 "${args[@]}" + + - name: Archive test output + if: ${{ failure() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-output-core-${{ matrix.slice }} + path: | + solr/core/build/test-results/** + solr/solrj-zookeeper/build/test-results/** diff --git a/.github/workflows/tests-extraction.yml b/.github/workflows/tests-extraction.yml new file mode 100644 index 000000000000..98ceca47c959 --- /dev/null +++ b/.github/workflows/tests-extraction.yml @@ -0,0 +1,41 @@ +name: Extraction Module Tests + +# The extraction module tests need Docker for the TikaServer tests of SolrCell, +# so they get a workflow of their own. + +on: + pull_request: + branches: + - '*' + paths: + - '.github/workflows/tests-extraction.yml' + - 'gradle/libs.versions.toml' + - 'solr/modules/extraction/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Run Extraction Module Tests + + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - uses: ./.github/actions/prepare-for-build + + - name: Run extraction module tests + run: ./gradlew --no-daemon :solr:modules:extraction:check + + - name: Archive test output + if: ${{ failure() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-output-extraction + path: | + solr/modules/extraction/build/test-results/** diff --git a/.github/workflows/tests-misc.yml b/.github/workflows/tests-misc.yml new file mode 100644 index 000000000000..0abb4bf6d553 --- /dev/null +++ b/.github/workflows/tests-misc.yml @@ -0,0 +1,44 @@ +name: Misc Tests + +# Small test suites that do not belong to any other tests-* workflow. + +on: + pull_request: + branches: + - '*' + paths: + - '.github/workflows/tests-misc.yml' + - 'gradle/libs.versions.toml' + - 'solr/benchmark/**' + - 'solr/test-framework/**' + - 'solr/solr-ref-guide/modules/*/examples/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Run Misc Tests + + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - uses: ./.github/actions/prepare-for-build + + - name: Test the test-framework, benchmark and ref-guide example code + run: ./gradlew :solr:test-framework:test :solr:benchmark:test :solr:solr-ref-guide:test + + - name: Archive test output + if: ${{ failure() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-output-misc + path: | + solr/test-framework/build/test-results/** + solr/benchmark/build/test-results/** + solr/solr-ref-guide/build/test-results/** diff --git a/.github/workflows/tests-modules-ops.yml b/.github/workflows/tests-modules-ops.yml new file mode 100644 index 000000000000..b2ab91652991 --- /dev/null +++ b/.github/workflows/tests-modules-ops.yml @@ -0,0 +1,51 @@ +name: Ops Modules Tests + +on: + pull_request: + branches: + - '*' + paths: + - '.github/workflows/tests-modules-ops.yml' + - 'gradle/libs.versions.toml' + - 'solr/cross-dc-manager/**' + - 'solr/modules/cross-dc/**' + - 'solr/modules/gcs-repository/**' + - 'solr/modules/jwt-auth/**' + - 'solr/modules/opentelemetry/**' + - 'solr/modules/s3-repository/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Run Ops Modules Tests + + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - uses: ./.github/actions/prepare-for-build + + - name: Test the ops and infrastructure modules + run: > + ./gradlew + :solr:cross-dc-manager:test + :solr:modules:cross-dc:test + :solr:modules:gcs-repository:test + :solr:modules:jwt-auth:test + :solr:modules:opentelemetry:test + :solr:modules:s3-repository:test + + - name: Archive test output + if: ${{ failure() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-output-modules-ops + path: | + solr/cross-dc-manager/build/test-results/** + solr/modules/*/build/test-results/** diff --git a/.github/workflows/tests-modules-search.yml b/.github/workflows/tests-modules-search.yml new file mode 100644 index 000000000000..a97c8ae3b5db --- /dev/null +++ b/.github/workflows/tests-modules-search.yml @@ -0,0 +1,54 @@ +name: Search Modules Tests + +on: + pull_request: + branches: + - '*' + paths: + - '.github/workflows/tests-modules-search.yml' + - 'gradle/libs.versions.toml' + - 'solr/modules/analysis-extras/**' + - 'solr/modules/clustering/**' + - 'solr/modules/cuvs/**' + - 'solr/modules/langid/**' + - 'solr/modules/language-models/**' + - 'solr/modules/ltr/**' + - 'solr/modules/scripting/**' + - 'solr/modules/sql/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Run Search Modules Tests + + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - uses: ./.github/actions/prepare-for-build + + - name: Test the search-related modules + run: > + ./gradlew + :solr:modules:analysis-extras:test + :solr:modules:clustering:test + :solr:modules:cuvs:test + :solr:modules:langid:test + :solr:modules:language-models:test + :solr:modules:ltr:test + :solr:modules:scripting:test + :solr:modules:sql:test + + - name: Archive test output + if: ${{ failure() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-output-modules-search + path: | + solr/modules/*/build/test-results/** diff --git a/.github/workflows/tests-solrj.yml b/.github/workflows/tests-solrj.yml new file mode 100644 index 000000000000..72a5a98fec49 --- /dev/null +++ b/.github/workflows/tests-solrj.yml @@ -0,0 +1,44 @@ +name: SolrJ Tests + +on: + pull_request: + branches: + - '*' + paths: + - '.github/workflows/tests-solrj.yml' + - 'gradle/libs.versions.toml' + - 'solr/api/**' + - 'solr/solrj/**' + - 'solr/solrj-jetty/**' + - 'solr/solrj-streaming/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Run SolrJ Tests + + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - uses: ./.github/actions/prepare-for-build + + - name: Test the SolrJ modules and the API module + run: ./gradlew :solr:api:test :solr:solrj:test :solr:solrj-jetty:test :solr:solrj-streaming:test -Ptests.jvms=3 + + - name: Archive test output + if: ${{ failure() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-output-solrj + path: | + solr/api/build/test-results/** + solr/solrj/build/test-results/** + solr/solrj-jetty/build/test-results/** + solr/solrj-streaming/build/test-results/** diff --git a/.github/workflows/tests-via-crave.yml b/.github/workflows/tests-via-crave.yml deleted file mode 100644 index 14d09a964b11..000000000000 --- a/.github/workflows/tests-via-crave.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Solr Tests via Crave - -on: - pull_request: - branches: - - '*' - paths: - - 'solr/**/src/**' - - 'gradle/libs.versions.toml' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - test: - name: Run Solr Tests using Crave.io resources - - runs-on: self-hosted - timeout-minutes: 40 - - env: - # Use a PR-scoped workspace path so that each new run for the same PR - # destroys any leftover resources from a previous run (including cancelled - # runs whose cleanup step may not have completed in time). - CRAVE_WORKSPACE: /crave-devspaces/pipeline/prs/${{ github.event.pull_request.number }} - - steps: - - name: Destroy previous clone - run: crave clone destroy -y ${CRAVE_WORKSPACE} || echo "Clone did not exist" - continue-on-error: true - - name: Crave clone sources - run: crave clone create --projectID 39 ${CRAVE_WORKSPACE} - - name: Checkout the correct branch - run: | - git -C ${CRAVE_WORKSPACE} fetch origin ${GITHUB_REF}:${GITHUB_REF} - git -C ${CRAVE_WORKSPACE} checkout ${GITHUB_REF} - - name: Initialize, build, test - run: | - cd ${CRAVE_WORKSPACE} - crave run --clean --message "PR: ${GITHUB_REF_NAME}" -- env CI=true ./gradlew --console=plain test - - name: Cleanup - if: ${{ always() }} - run: | - pushd ${CRAVE_WORKSPACE} - crave stop --all - popd - crave clone destroy -y ${CRAVE_WORKSPACE} diff --git a/gradle/testing/defaults-tests.gradle b/gradle/testing/defaults-tests.gradle index fbe118548d51..a646ce5edd94 100644 --- a/gradle/testing/defaults-tests.gradle +++ b/gradle/testing/defaults-tests.gradle @@ -47,6 +47,9 @@ allprojects { description: "Number of forked test JVMs", includeInReproLine: false], [propName: 'tests.haltonfailure', value: true, description: "Halt processing on test failure."], + [propName: 'tests.exclude', value: null, + description: "Comma-separated test class patterns to exclude (same syntax as --tests), e.g. org.apache.solr.cloud.*", + includeInReproLine: false], // Default code cache size is 240m, but disabling C2 compiler shrinks it to 48m, which turns out to not be enough [propName: 'tests.jvmargs', value: {-> @@ -117,6 +120,13 @@ allprojects { ignoreFailures = resolvedTestOption("tests.haltonfailure").toBoolean() == false + def excludePatterns = resolvedTestOption("tests.exclude") + if (excludePatterns) { + filter { + excludePatterns.split(',').each { excludeTestsMatching(it.trim()) } + } + } + jvmArgs Commandline.translateCommandline(resolvedTestOption("tests.jvmargs")) // Enable the vector incubator module on supported Java versions: diff --git a/solr/core/src/test/org/apache/solr/core/CoreContainerShutdownTest.java b/solr/core/src/test/org/apache/solr/core/CoreContainerShutdownTest.java index ea14a6b2ad92..6d3f2f4b5fe6 100644 --- a/solr/core/src/test/org/apache/solr/core/CoreContainerShutdownTest.java +++ b/solr/core/src/test/org/apache/solr/core/CoreContainerShutdownTest.java @@ -21,6 +21,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.lucene.tests.util.LuceneTestCase.Nightly; import org.apache.solr.SolrTestCase; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.util.ObjectReleaseTracker; @@ -41,6 +42,8 @@ * container's metrics contexts; skipping them leaks the whole metrics tree, and in a test JVM the * leaked contexts are then charged to an unrelated suite by the object release tracker. */ +// Two minutes of waiting on the production close timeouts, so nightly only. +@Nightly public class CoreContainerShutdownTest extends SolrTestCase { private static final String SOLR_XML = diff --git a/solr/core/src/test/org/apache/solr/search/TestCpuAllowedLimit.java b/solr/core/src/test/org/apache/solr/search/TestCpuAllowedLimit.java index 2afe765197ae..a6066ada10c5 100644 --- a/solr/core/src/test/org/apache/solr/search/TestCpuAllowedLimit.java +++ b/solr/core/src/test/org/apache/solr/search/TestCpuAllowedLimit.java @@ -21,6 +21,7 @@ import java.nio.file.Path; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.lucene.tests.util.LuceneTestCase.Nightly; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.request.CollectionAdminRequest; import org.apache.solr.client.solrj.response.QueryResponse; @@ -35,6 +36,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +// Runs queries until the CPU limit trips, close to two minutes, so nightly only. +@Nightly public class TestCpuAllowedLimit extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());