Skip to content

Commit bf495b9

Browse files
committed
Merge branch 'main' into SOLR_17712_remove_waitForFinalState_default_true
2 parents 33c3b28 + 54a802d commit bf495b9

15 files changed

Lines changed: 130 additions & 350 deletions

File tree

AGENTS.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ While README.md and CONTRIBUTING.md are mainly written for humans, this file is
2929

3030
## Build and Development Workflow
3131

32-
- When done or preparing to commit changes to java source files, be sure to run `gradlew tidy` to format the code
32+
- When done or preparing to commit changes to java source files, be sure to run `gradlew tidy` to format the code. Don't bother beforehand.
3333
- Always run `gradlew check -x test` before declaring a feature done
3434

3535
## Code Quality and Best Practices
@@ -38,15 +38,25 @@ While README.md and CONTRIBUTING.md are mainly written for humans, this file is
3838
- Be careful to not add non-essential logging! If you add slf4j log calls, make sure to wrap debug/trace level calls in `logger.isXxxEnabled()` clause
3939
- Validate user input. For file paths, always call `myCoreContainer.assertPathAllowed(myPath)` before using
4040

41-
## Testing
41+
## Running Tests
42+
43+
- See `dev-docs/gradle-help/tests.txt` for hints on running tests
44+
- To run a specific test: `gradlew :solr:core:test --tests "org.apache.solr.search.TestCaffeineCache"`
45+
- To run a specific BATS test: `gradlew iTest --tests test_adminconsole_urls.bats`
46+
- The randomization seed is important. To repeat a failing tests, pass the same seed given in the failure by adding to Gradle: `-Ptests.seed=HEXADECIMALHERE`.
47+
- Test output goes to `solr/<module>/build/test-results/test/outputs/OUTPUT-<fully.qualified.TestName>.txt` (stdout/stderr log) and `solr/<module>/build/test-results/test/TEST-<fully.qualified.TestName>.xml` (JUnit XML with pass/fail/error details)
48+
- To scan test output for a specific issue across already-run tests: `grep -rl "pattern" solr/*/build/test-results/test/outputs/`
49+
50+
## Writing Tests
4251

4352
- When adding a test to an existing suite/file, keep the same style / design choices
4453
- When adding a *new* Java test suite/file:
45-
- Subclass SolrTestCase, or if SolrCloud is needed then SolrCloudTestCase
46-
- If SolrTestCase and need to embed Solr, use either EmbeddedSolrServerTestRule (doesn't use HTTP) or SolrJettyTestRule if HTTP/Jetty is relevant to what is being tested.
47-
- Avoid SolrTestCaseJ4 for new tests
48-
49-
- See `dev-docs/gradle-help/tests.txt` for hints on running tests
54+
- Subclass SolrTestCase, or if SolrCloud is needed then SolrCloudTestCase
55+
- If SolrTestCase and need to embed Solr, use either EmbeddedSolrServerTestRule (doesn't use HTTP) or SolrJettyTestRule if HTTP/Jetty is relevant to what is being tested.
56+
- Avoid SolrTestCaseJ4 for new tests
57+
- For BATS shell integration tests in `solr/packaging/test/`:
58+
- Always use `run <command>` followed by `assert_output --partial "..."` or `refute_output --partial "..."` instead of capturing output into local variables and using `[[ ]]` comparisons
59+
- Avoid patterns like `local var=$(cmd | grep ...); [[ "$var" == *"..."* ]]` — use `run cmd` + `assert_output`/`refute_output` instead
5060

5161
## Documentation
5262

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
2-
title: SOLR 18041 - Path exclusions for the admin UI are now defined in a separate servlet filter
3-
type: other # added, changed, fixed, deprecated, removed, dependency_update, security, other
1+
title: Path exclusions for the admin UI no longer need bespoke Solr code.
2+
type: other
43
authors:
54
- name: Gus Heck
5+
- name: David Smiley
66
links:
77
- name: SOLR-18041
88
url: https://issues.apache.org/jira/browse/SOLR-18041
9+
- name: SOLR-18168
10+
url: https://issues.apache.org/jira/browse/SOLR-18168
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
title: Published POMs now include resolved dependency versions, fixing ambiguous/missing version problems.
2+
type: fixed
3+
authors:
4+
- name: David Smiley
5+
links:
6+
- name: SOLR-18185
7+
url: https://issues.apache.org/jira/browse/SOLR-18185
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
title: Fixed Admin UI to use max heap (-Xmx) value instead of committed heap to compute heap used percentage.
2+
type: fixed # added, changed, fixed, deprecated, removed, dependency_update, security, other
3+
authors:
4+
- name: Ravi Ranjan Jha
5+
links:
6+
- name: SOLR-18186
7+
url: https://issues.apache.org/jira/browse/SOLR-18186

gradle/maven/defaults-maven.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ configure(subprojects.findAll {it.path in rootProject.published}) {prj ->
149149

150150
pom(configurePom)
151151

152+
// Publish resolved/locked dependency versions instead of declared catalog versions
153+
versionMapping {
154+
usage('java-api') { fromResolutionOf('runtimeClasspath') }
155+
usage('java-runtime') { fromResolutionResult() }
156+
}
157+
152158
// Remove the internal :platform dependency from dependencyManagement in POMs
153159
pom.withXml {
154160
def root = asNode()

solr/core/src/java/org/apache/solr/servlet/PathExclusionFilter.java

Lines changed: 0 additions & 80 deletions
This file was deleted.

solr/core/src/test/org/apache/solr/servlet/LoadAdminUiServletTest.java

Lines changed: 0 additions & 106 deletions
This file was deleted.

solr/packaging/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ task integrationTests(type: BatsTask) {
282282
}
283283

284284
inputs.dir(distDir)
285+
inputs.dir('test') // Track .bats test files and helper as inputs
285286
outputs.dir(integrationTestOutput)
286287

287288
doFirst {
@@ -311,7 +312,9 @@ task integrationTests(type: BatsTask) {
311312
}
312313

313314
class BatsTask extends Exec {
314-
@InputDirectory
315+
// Note: testDir is marked @Internal because it's a String configuration property, not a trackable input.
316+
// The task using BatsTask should explicitly declare inputs.dir(testDir) in its configuration.
317+
@Internal
315318
String testDir = 'test'
316319

317320
@Input

solr/packaging/test/test_adminconsole_urls.bats

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,37 @@ teardown() {
2828
solr stop --all >/dev/null 2>&1
2929
}
3030

31+
3132
@test "assert able to launch solr admin console" {
3233
run solr start
3334

3435
run curl -s -o /dev/null -w "%{http_code}" http://localhost:${SOLR_PORT}/solr/
36+
assert_output "200"
37+
38+
run curl -s -I http://localhost:${SOLR_PORT}/solr/
39+
assert_output --partial "text/html"
3540

36-
# Check if the HTTP response code is 200 (OK)
41+
run curl -s http://localhost:${SOLR_PORT}/solr/
42+
assert_output --partial "<html"
43+
44+
run curl -s -o /dev/null -w "%{http_code}" http://localhost:${SOLR_PORT}/solr/css/angular/chosen.css
3745
assert_output "200"
46+
47+
run curl -s -I http://localhost:${SOLR_PORT}/solr/css/angular/chosen.css
48+
assert_output --partial "text/css"
49+
50+
run curl -s http://localhost:${SOLR_PORT}/solr/css/angular/chosen.css
51+
assert_output --partial "{"
52+
}
53+
54+
@test "assert CSP header contains custom connect src URLs" {
55+
# Set custom CSP connect-src URLs via system property
56+
local csp_urls="http://example1.com/token,https://example2.com/path/uri1,http://example3.com/oauth2/uri2"
57+
58+
run solr start -Dsolr.ui.headers.csp.connect-src.urls="${csp_urls}"
59+
60+
run curl -s -I http://localhost:${SOLR_PORT}/solr/
61+
assert_output --partial "http://example1.com/token"
62+
assert_output --partial "https://example2.com/path/uri1"
63+
assert_output --partial "http://example3.com/oauth2/uri2"
3864
}

solr/solrj/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ dependencies {
7575
testRuntimeOnly(libs.eclipse.jetty.alpnjavaserver, {
7676
exclude group: "org.eclipse.jetty.alpn", module: "alpn-api"
7777
})
78-
testImplementation libs.eclipse.jetty.session
7978

8079
testImplementation(libs.mockito.core, {
8180
exclude group: "net.bytebuddy", module: "byte-buddy-agent"

0 commit comments

Comments
 (0)