This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-mcp.git
The following commit(s) were added to refs/heads/main by this push:
new 9e71cb4 fix(test): restore docker image tag suffix for native
integration tests (#173)
9e71cb4 is described below
commit 9e71cb4b50d4558818bf98bd9a7e6fcffba7393c
Author: Aditya Parikh <[email protected]>
AuthorDate: Tue Aug 18 16:43:19 2026 -0400
fix(test): restore docker image tag suffix for native integration tests
(#173)
* fix(test): restore docker image tag suffix for native integration tests
The native dockerIntegrationTest matrix (stdio/http) was failing because the
three Docker integration tests resolved their image as
`solr-mcp:<version>` with no `-native-<profile>` suffix, so Testcontainers
404'd pulling an image the native build never produces (it builds
`solr-mcp:<version>-native-stdio` / `-native-http`). The MCP stdio test's
`docker run` subprocess then exited immediately, surfacing as a 20s
`initialize()` timeout.
PR #139 removed the caller-side `+
System.getProperty("solr.mcp.docker.image.tag.suffix")`
concatenation on the premise that `BuildInfoReader.getDockerImageName()`
"already appends the same system property internally" — but it never did
(it was just `String.format("%s:%s", artifact, version)`), so the suffix
stopped being applied entirely.
Make `getDockerImageName()` append the suffix internally, matching #139's
documented intent and the test Javadoc. The property is unset on the JVM
(Jib) path, defaulting to an empty string, so that tag is unchanged; the
suffix is now applied exactly once. Also add the containerization tests and
BuildInfoReader to native.yml's trigger paths so future changes to these
files exercise the native matrix.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Aditya Parikh <[email protected]>
* test: pin BuildInfoReader suffix contract; fix stale image-name javadoc
Review follow-up on this PR. The suffix handling is otherwise exercised
only by dockerIntegrationTest, which regular CI never runs — that gap is
how PR #139 could silently drop the suffix and break the native image
matrix. BuildInfoReaderTest pins the contract in the default test task.
Also corrects DockerImageMcpClientStdioIntegrationTest's javadoc, which
still described the pre-#139 call-site concatenation and a "-native"
suffix value that never existed — the same doc-vs-code drift that caused
the original regression.
Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Aditya Parikh <[email protected]>
---------
Signed-off-by: Aditya Parikh <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
---
.github/workflows/native.yml | 5 ++
.../apache/solr/mcp/server/BuildInfoReader.java | 17 +++++-
.../solr/mcp/server/BuildInfoReaderTest.java | 67 ++++++++++++++++++++++
.../DockerImageMcpClientStdioIntegrationTest.java | 7 ++-
4 files changed, 90 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/native.yml b/.github/workflows/native.yml
index 6ab5aa3..b9ff829 100644
--- a/.github/workflows/native.yml
+++ b/.github/workflows/native.yml
@@ -42,6 +42,11 @@ on:
- '.github/workflows/native.yml'
- 'src/main/java/**/*NativeHints*.java'
- 'src/main/resources/META-INF/native-image/**'
+ # The Docker integration tests are the native-image validation
suite,
+ # so changes to them (or the image-name helper they rely on) must
+ # re-trigger this workflow.
+ - 'src/test/java/**/containerization/**'
+ - 'src/test/java/**/BuildInfoReader.java'
jobs:
native-test:
diff --git a/src/test/java/org/apache/solr/mcp/server/BuildInfoReader.java
b/src/test/java/org/apache/solr/mcp/server/BuildInfoReader.java
index bc1983e..04202fc 100644
--- a/src/test/java/org/apache/solr/mcp/server/BuildInfoReader.java
+++ b/src/test/java/org/apache/solr/mcp/server/BuildInfoReader.java
@@ -87,12 +87,23 @@ public class BuildInfoReader {
}
/**
- * Gets the Docker image name in the format "artifact:version".
+ * Gets the Docker image name in the format {@code
artifact:version<suffix>}.
*
- * @return Docker image name (e.g., "solr-mcp:1.0.0-SNAPSHOT")
+ * <p>
+ * The optional {@code solr.mcp.docker.image.tag.suffix} system
property is
+ * appended to the tag so that the native {@code dockerIntegrationTest}
runs
+ * target the per-profile Paketo images ({@code -native-stdio} /
+ * {@code -native-http}). For the JVM (Jib) path the property is unset
and
+ * defaults to an empty string, yielding the plain {@code
artifact:version} tag.
+ * Appending here (rather than at every call site) keeps the suffix
applied
+ * exactly once.
+ *
+ * @return Docker image name (e.g., "solr-mcp:1.0.0-SNAPSHOT" or
+ * "solr-mcp:1.0.0-SNAPSHOT-native-stdio")
*/
public static String getDockerImageName() {
- return String.format("%s:%s", getArtifact(), getVersion());
+ String suffix =
System.getProperty("solr.mcp.docker.image.tag.suffix", "");
+ return String.format("%s:%s%s", getArtifact(), getVersion(),
suffix);
}
/**
diff --git a/src/test/java/org/apache/solr/mcp/server/BuildInfoReaderTest.java
b/src/test/java/org/apache/solr/mcp/server/BuildInfoReaderTest.java
new file mode 100644
index 0000000..278a47c
--- /dev/null
+++ b/src/test/java/org/apache/solr/mcp/server/BuildInfoReaderTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+package org.apache.solr.mcp.server;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Unit tests for {@link BuildInfoReader}'s Docker image name resolution.
+ *
+ * <p>
+ * The {@code solr.mcp.docker.image.tag.suffix} handling is otherwise exercised
+ * only by {@code dockerIntegrationTest}, which regular CI never runs — that
gap
+ * is how PR #139 could silently drop the suffix and break the native image
+ * matrix. These tests pin the contract in the default {@code test} task.
+ */
+class BuildInfoReaderTest {
+
+ private static final String SUFFIX_PROPERTY =
"solr.mcp.docker.image.tag.suffix";
+
+ private String previousSuffix;
+
+ @BeforeEach
+ void captureSuffixProperty() {
+ previousSuffix = System.getProperty(SUFFIX_PROPERTY);
+ System.clearProperty(SUFFIX_PROPERTY);
+ }
+
+ @AfterEach
+ void restoreSuffixProperty() {
+ if (previousSuffix == null) {
+ System.clearProperty(SUFFIX_PROPERTY);
+ } else {
+ System.setProperty(SUFFIX_PROPERTY, previousSuffix);
+ }
+ }
+
+ @Test
+ void plainImageNameWhenSuffixUnset() {
+ assertEquals(BuildInfoReader.getArtifact() + ":" +
BuildInfoReader.getVersion(),
+ BuildInfoReader.getDockerImageName());
+ }
+
+ @Test
+ void appendsSuffixPropertyToImageName() {
+ System.setProperty(SUFFIX_PROPERTY, "-native-stdio");
+ assertEquals(BuildInfoReader.getArtifact() + ":" +
BuildInfoReader.getVersion() + "-native-stdio",
+ BuildInfoReader.getDockerImageName());
+ }
+}
diff --git
a/src/test/java/org/apache/solr/mcp/server/containerization/DockerImageMcpClientStdioIntegrationTest.java
b/src/test/java/org/apache/solr/mcp/server/containerization/DockerImageMcpClientStdioIntegrationTest.java
index 4202194..6e4a009 100644
---
a/src/test/java/org/apache/solr/mcp/server/containerization/DockerImageMcpClientStdioIntegrationTest.java
+++
b/src/test/java/org/apache/solr/mcp/server/containerization/DockerImageMcpClientStdioIntegrationTest.java
@@ -43,9 +43,10 @@ import org.testcontainers.utility.DockerImageName;
* lines and {@code initialize()} will fail.
*
* <p>
- * Image under test: {@link BuildInfoReader#getDockerImageName()} plus the
- * {@code solr.mcp.docker.image.tag.suffix} system property (set to
- * {@code -native} for {@code dockerIntegrationTest -Pnative}, empty
otherwise).
+ * Image under test: {@link BuildInfoReader#getDockerImageName()}, which
appends
+ * the {@code solr.mcp.docker.image.tag.suffix} system property
+ * ({@code -native-stdio} / {@code -native-http} under
+ * {@code dockerIntegrationTest -Pnative}, empty on the JVM/Jib path).
*/
@Tag("docker-integration")
@Testcontainers(disabledWithoutDocker = true)