Skip to content

Commit f090ec8

Browse files
committed
Update Neo4j default image to 5.26 (LTS).
This will not only update the test image but also clean up usage of `withEnterpriseEdition` to just append the `-enterprise` suffix instead of pulling in the former neo4j:4.4 default image without users noting the implicit change from their defined image version.
1 parent c478453 commit f090ec8

File tree

3 files changed

+25
-40
lines changed

3 files changed

+25
-40
lines changed

modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jContainer.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,7 @@ public class Neo4jContainer extends GenericContainer<Neo4jContainer> {
3838
*/
3939
private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("neo4j");
4040

41-
/**
42-
* The default tag (version) to use.
43-
*/
44-
private static final String DEFAULT_TAG = "4.4";
45-
46-
private static final String ENTERPRISE_TAG = DEFAULT_TAG + "-enterprise";
41+
private static final String ENTERPRISE_SUFFIX = "-enterprise";
4742

4843
/**
4944
* Default port for the binary Bolt protocol.
@@ -211,8 +206,7 @@ public Neo4jContainer withEnterpriseEdition() {
211206
String.format("Cannot use enterprise version with alternative image %s.", getDockerImageName())
212207
);
213208
}
214-
215-
setDockerImageName(DEFAULT_IMAGE_NAME.withTag(ENTERPRISE_TAG).asCanonicalNameString());
209+
setDockerImageName(DockerImageName.parse(getDockerImageName() + ENTERPRISE_SUFFIX).asCanonicalNameString());
216210
LicenseAcceptance.assertLicenseAccepted(getDockerImageName());
217211

218212
addEnv("NEO4J_ACCEPT_LICENSE_AGREEMENT", "yes");

modules/neo4j/src/test/java/org/testcontainers/containers/Neo4jContainerJUnitIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
public class Neo4jContainerJUnitIntegrationTest {
1919

2020
@ClassRule
21-
public static Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4");
21+
public static Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26");
2222

2323
@Test
2424
public void shouldStart() {

modules/neo4j/src/test/java/org/testcontainers/containers/Neo4jContainerTest.java

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void shouldDisableAuthentication() {
3939
try (
4040
// spotless:off
4141
// withoutAuthentication {
42-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
42+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26")
4343
.withoutAuthentication()
4444
// }
4545
// spotless:on
@@ -71,20 +71,11 @@ public void shouldCopyDatabase() {
7171
}
7272
}
7373

74-
@Test
75-
public void shouldFailOnCopyDatabaseForDefaultNeo4j4Image() {
76-
assertThatIllegalArgumentException()
77-
.isThrownBy(() -> {
78-
new Neo4jContainer("neo4j:4.4.1").withDatabase(MountableFile.forClasspathResource("/test-graph.db"));
79-
})
80-
.withMessage("Copying database folder is not supported for Neo4j instances with version 4.0 or higher.");
81-
}
82-
8374
@Test
8475
public void shouldFailOnCopyDatabaseForCustomNeo4j4Image() {
8576
assertThatIllegalArgumentException()
8677
.isThrownBy(() -> {
87-
new Neo4jContainer("neo4j:4.4.1").withDatabase(MountableFile.forClasspathResource("/test-graph.db"));
78+
new Neo4jContainer("neo4j:5.26.10").withDatabase(MountableFile.forClasspathResource("/test-graph.db"));
8879
})
8980
.withMessage("Copying database folder is not supported for Neo4j instances with version 4.0 or higher.");
9081
}
@@ -102,7 +93,7 @@ public void shouldFailOnCopyDatabaseForCustomNonSemverNeo4j4Image() {
10293
public void shouldCopyPlugins() {
10394
try (
10495
// registerPluginsPath {
105-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
96+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26")
10697
.withPlugins(MountableFile.forClasspathResource("/custom-plugins"))
10798
// }
10899
) {
@@ -117,7 +108,7 @@ public void shouldCopyPlugins() {
117108
public void shouldCopyPlugin() {
118109
try (
119110
// registerPluginsJar {
120-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
111+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26")
121112
.withPlugins(MountableFile.forClasspathResource("/custom-plugins/hello-world.jar"))
122113
// }
123114
) {
@@ -139,10 +130,10 @@ private static void assertThatCustomPluginWasCopied(Session session) {
139130
public void shouldCheckEnterpriseLicense() {
140131
assumeThat(Neo4jContainerTest.class.getResource(ACCEPTANCE_FILE_LOCATION)).isNull();
141132

142-
String expectedImageName = "neo4j:4.4-enterprise";
133+
String expectedImageName = "neo4j:5.26-enterprise";
143134

144135
assertThatExceptionOfType(IllegalStateException.class)
145-
.isThrownBy(() -> new Neo4jContainer("neo4j:4.4").withEnterpriseEdition())
136+
.isThrownBy(() -> new Neo4jContainer("neo4j:5.26").withEnterpriseEdition())
146137
.withMessageContaining("The image " + expectedImageName + " requires you to accept a license agreement.");
147138
}
148139

@@ -152,7 +143,7 @@ public void shouldRunEnterprise() {
152143

153144
try (
154145
// enterpriseEdition {
155-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
146+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26")
156147
.withEnterpriseEdition()
157148
// }
158149
.withAdminPassword("Picard123")
@@ -172,7 +163,7 @@ public void shouldRunEnterprise() {
172163
@Test
173164
public void shouldAddConfigToEnvironment() {
174165
// neo4jConfiguration {
175-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
166+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26")
176167
.withNeo4jConfig("dbms.security.procedures.unrestricted", "apoc.*,algo.*")
177168
.withNeo4jConfig("dbms.tx_log.rotation.size", "42M");
178169
// }
@@ -184,7 +175,7 @@ public void shouldAddConfigToEnvironment() {
184175

185176
@Test
186177
public void shouldRespectEnvironmentAuth() {
187-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withEnv("NEO4J_AUTH", "neo4j/secret");
178+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26").withEnv("NEO4J_AUTH", "neo4j/secret");
188179

189180
neo4jContainer.configure();
190181

@@ -194,7 +185,7 @@ public void shouldRespectEnvironmentAuth() {
194185
@Test
195186
public void shouldSetCustomPasswordCorrectly() {
196187
// withAdminPassword {
197-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withAdminPassword("verySecret");
188+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26").withAdminPassword("verySecret");
198189
// }
199190

200191
neo4jContainer.configure();
@@ -204,7 +195,7 @@ public void shouldSetCustomPasswordCorrectly() {
204195

205196
@Test
206197
public void containerAdminPasswordOverrulesEnvironmentAuth() {
207-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
198+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26")
208199
.withEnv("NEO4J_AUTH", "neo4j/secret")
209200
.withAdminPassword("anotherSecret");
210201

@@ -215,7 +206,7 @@ public void containerAdminPasswordOverrulesEnvironmentAuth() {
215206

216207
@Test
217208
public void containerWithoutAuthenticationOverrulesEnvironmentAuth() {
218-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4")
209+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26")
219210
.withEnv("NEO4J_AUTH", "neo4j/secret")
220211
.withoutAuthentication();
221212

@@ -226,7 +217,7 @@ public void containerWithoutAuthenticationOverrulesEnvironmentAuth() {
226217

227218
@Test
228219
public void shouldRespectAlreadyDefinedPortMappingsBolt() {
229-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withExposedPorts(7687);
220+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26").withExposedPorts(7687);
230221

231222
neo4jContainer.configure();
232223

@@ -235,7 +226,7 @@ public void shouldRespectAlreadyDefinedPortMappingsBolt() {
235226

236227
@Test
237228
public void shouldRespectAlreadyDefinedPortMappingsHttp() {
238-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withExposedPorts(7474);
229+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26").withExposedPorts(7474);
239230

240231
neo4jContainer.configure();
241232

@@ -244,7 +235,7 @@ public void shouldRespectAlreadyDefinedPortMappingsHttp() {
244235

245236
@Test
246237
public void shouldRespectAlreadyDefinedPortMappingsWithoutHttps() {
247-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withExposedPorts(7687, 7474);
238+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26").withExposedPorts(7687, 7474);
248239

249240
neo4jContainer.configure();
250241

@@ -253,7 +244,7 @@ public void shouldRespectAlreadyDefinedPortMappingsWithoutHttps() {
253244

254245
@Test
255246
public void shouldDefaultExportBoltHttpAndHttps() {
256-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4");
247+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26");
257248

258249
neo4jContainer.configure();
259250

@@ -262,7 +253,7 @@ public void shouldDefaultExportBoltHttpAndHttps() {
262253

263254
@Test
264255
public void shouldRespectCustomWaitStrategy() {
265-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").waitingFor(new CustomDummyWaitStrategy());
256+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26").waitingFor(new CustomDummyWaitStrategy());
266257

267258
neo4jContainer.configure();
268259

@@ -271,7 +262,7 @@ public void shouldRespectCustomWaitStrategy() {
271262

272263
@Test
273264
public void shouldConfigureSinglePluginByName() {
274-
try (Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withPlugins("apoc")) {
265+
try (Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26").withPlugins("apoc")) {
275266
// needs to get called explicitly for setup
276267
neo4jContainer.configure();
277268

@@ -283,7 +274,7 @@ public void shouldConfigureSinglePluginByName() {
283274
public void shouldConfigureMultiplePluginsByName() {
284275
try (
285276
// configureLabsPlugins {
286-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4") //
277+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26") //
287278
.withPlugins("apoc", "bloom");
288279
// }
289280
) {
@@ -299,7 +290,7 @@ public void shouldConfigureMultiplePluginsByName() {
299290
public void shouldCreateRandomUuidBasedPasswords() {
300291
try (
301292
// withRandomPassword {
302-
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4").withRandomPassword();
293+
Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26").withRandomPassword();
303294
// }
304295
) {
305296
// It will throw an exception if it's not UUID parsable.
@@ -312,8 +303,8 @@ public void shouldCreateRandomUuidBasedPasswords() {
312303

313304
@Test
314305
public void shouldWarnOnPasswordTooShort() {
315-
try (Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.4");) {
316-
Logger logger = (Logger) DockerLoggerFactory.getLogger("neo4j:4.4");
306+
try (Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:5.26");) {
307+
Logger logger = (Logger) DockerLoggerFactory.getLogger("neo4j:5.26");
317308
TestLogAppender testLogAppender = new TestLogAppender();
318309
logger.addAppender(testLogAppender);
319310
testLogAppender.start();

0 commit comments

Comments
 (0)