Skip to content

Commit

Permalink
chore: update postgre container from 14.1 -> 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAure committed Nov 4, 2024
1 parent 52a601b commit 321a05b
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2021, 2022 IBM Corporation and others.
* Copyright (c) 2021, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
Expand Down Expand Up @@ -70,7 +70,7 @@ public class ContainersTest extends FATServletClient {
* have been used here. This is just an example of how to setup a GenericContainer.
*/
@ClassRule
public static GenericContainer<?> container = new GenericContainer<>("postgres:14.1-alpine")
public static GenericContainer<?> container = new GenericContainer<>("postgres:17.0-alpine")
.withExposedPorts(POSTGRE_PORT)
.withEnv("POSTGRES_DB", POSTGRES_DB)
.withEnv("POSTGRES_USER", POSTGRES_USER)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2021 IBM Corporation and others.
* Copyright (c) 2021, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
Expand Down Expand Up @@ -51,6 +51,6 @@ public class FATSuite extends TestContainerSuite {
* In this example suite I am going to use a different container for each example.
*/
@ClassRule
public static PostgreSQLContainer<?> container = new PostgreSQLContainer<>("postgres:14.1-alpine");
public static PostgreSQLContainer<?> container = new PostgreSQLContainer<>("postgres:17.0-alpine");

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2022 IBM Corporation and others.
* Copyright (c) 2021, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -64,18 +64,18 @@ public class ProgrammaticImageTest {
*
* NOTE: building from a Dockerfile should be avoided at all costs.
*
* Here we are pulling from a base image postgres:14.1-alpine
* Here we are pulling from a base image postgres:17.0-alpine
*
* However, we use special processing for the image name to ensure that when testing locally we pull
* from DockerHub, and when testing against a remote docker image we use a subsituted image name to pull
* from artifactory.
*
* Example:
* ImageNameSubstitutor.instance().apply(DockerImageName.parse("postgres:14.1-alpine")).asCanonicalNameString()
* ImageNameSubstitutor.instance().apply(DockerImageName.parse("postgres:17.0-alpine")).asCanonicalNameString()
*
* When testing locally a DefaultImageNameSubstitutor will be used and postgres:14.1-alpine will be returned as normal.
* When testing locally a DefaultImageNameSubstitutor will be used and postgres:17.0-alpine will be returned as normal.
* When testing on a remote docker host, our internal ArtifactoryImageNameSubstitutor will be used and
* [ARTIFACTORY_REGISTRY]/wasliberty-docker-remote/postgres:14.1-alpine will be returned
* [ARTIFACTORY_REGISTRY]/wasliberty-docker-remote/postgres:17.0-alpine will be returned
*
* </pre>
*
Expand All @@ -86,20 +86,20 @@ public class ProgrammaticImageTest {
public static GenericContainer<?> container = new GenericContainer<>(//
new ImageFromDockerfile().withDockerfileFromBuilder(builder -> builder.from(//
ImageNameSubstitutor.instance()
.apply(DockerImageName.parse("postgres:14.1-alpine"))
.apply(DockerImageName.parse("postgres:17.0-alpine"))
.asCanonicalNameString()) //
.copy("/docker-entrypoint-initdb.d/initDB.sql", "/docker-entrypoint-initdb.d/initDB.sql")
.build())
.withFileFromFile("/docker-entrypoint-initdb.d/initDB.sql", new File("lib/LibertyFATTestFiles/postgres/scripts/initDB.sql"), 644))
.withExposedPorts(POSTGRE_PORT)
.withEnv("POSTGRES_DB", POSTGRES_DB)
.withEnv("POSTGRES_USER", POSTGRES_USER)
.withEnv("POSTGRES_PASSWORD", POSTGRES_PASSWORD)
.withLogConsumer(new SimpleLogConsumer(ContainersTest.class, "postgres"))
.waitingFor(new LogMessageWaitStrategy()
.withRegEx(".*database system is ready to accept connections.*\\s")
.withTimes(2)
.withStartupTimeout(Duration.ofSeconds(60)));
.withExposedPorts(POSTGRE_PORT)
.withEnv("POSTGRES_DB", POSTGRES_DB)
.withEnv("POSTGRES_USER", POSTGRES_USER)
.withEnv("POSTGRES_PASSWORD", POSTGRES_PASSWORD)
.withLogConsumer(new SimpleLogConsumer(ContainersTest.class, "postgres"))
.waitingFor(new LogMessageWaitStrategy()
.withRegEx(".*database system is ready to accept connections.*\\s")
.withTimes(2)
.withStartupTimeout(Duration.ofSeconds(60)));

@BeforeClass
public static void setUp() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TODO update to 17.0-alpine

FROM postgres:14.1-alpine

COPY scripts/initDB.sql /docker-entrypoint-initdb.d/initDB.sql
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TODO update to 17.0-alpine

FROM postgres:12.4

RUN set -ex; \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2023 IBM Corporation and others.
* Copyright (c) 2019, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -35,7 +35,7 @@ public class FATSuite extends TestContainerSuite {
private static final String POSTGRES_PASS = "superSecret";

@ClassRule
public static PostgreSQLContainer postgre = new PostgreSQLContainer("postgres:14.1-alpine")
public static PostgreSQLContainer postgre = new PostgreSQLContainer("postgres:17.0-alpine")
.withDatabaseName(POSTGRES_DB)
.withUsername(POSTGRES_USER)
.withPassword(POSTGRES_PASS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class ThreadLocalConnectionTest extends FATServletClient {
//This also means that we can only run this test manually because if this test were to run more than once at the same time
//on the same host, the ports would conflict and it would fail.
//But it is still useful to have in case a similar incident happens in the future.
public static FixedHostPortGenericContainer<?> postgre = new FixedHostPortGenericContainer<>("postgres:14.1-alpine")
public static FixedHostPortGenericContainer<?> postgre = new FixedHostPortGenericContainer<>("postgres:17.0-alpine")
.withFixedExposedPort(POSTGRE_HOST_PORT, POSTGRE_CONTAINER_PORT)
.withEnv("POSTGRES_DB", POSTGRES_DB)
.withEnv("POSTGRES_USER", POSTGRES_USER)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TODO update to 17.0-alpine

FROM postgres:14.1-alpine

COPY ssl-certs/server.crt /var/lib/postgresql/server.crt
Expand Down
2 changes: 1 addition & 1 deletion dev/fattest.simplicity/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ generate.replacement: true
# These are the images used by the org.testcontainers and componenttest.topology.database.container packages
fat.test.container.images: testcontainers/ryuk:0.9.0, testcontainers/sshd:1.2.0, testcontainers/vnc-recorder:1.3.0, alpine:3.17,\
icr.io/db2_community/db2:11.5.9.0, gvenzl/oracle-free:23.3-full-faststart,\
postgres:14.1-alpine, mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04
postgres:17.0-alpine, mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04

-buildpath: \
com.ibm.websphere.javaee.jaxb.2.2;version=latest,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public enum DatabaseContainerType {
Oracle("ojdbc8.jar", OracleContainer.class.getCanonicalName(), Properties_oracle.class, //
DockerImageName.parse("gvenzl/oracle-free:23.3-full-faststart"), "OracleDB"),
Postgres("postgresql.jar", PostgreSQLContainer.class.getCanonicalName(), Properties_postgresql.class, //
DockerImageName.parse("postgres:14.1-alpine"), "Postgre", "PostgreSQL"),
DockerImageName.parse("postgres:17.0-alpine"), "Postgre", "PostgreSQL"),
SQLServer("mssql-jdbc.jar", MSSQLServerContainer.class.getCanonicalName(), Properties_microsoft_sqlserver.class, //
DockerImageName.parse("mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04"), "MSSQLServer");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void testValueOfContainer() {
assertEquals(DatabaseContainerType.Oracle, //
DatabaseContainerType.valueOf(new OracleContainer(DockerImageName.parse("gvenzl/oracle-free:23.3-full-faststart"))));
assertEquals(DatabaseContainerType.Postgres, //
DatabaseContainerType.valueOf(new PostgreSQLContainer(DockerImageName.parse("postgres:14.1-alpine"))));
DatabaseContainerType.valueOf(new PostgreSQLContainer(DockerImageName.parse("postgres:17.0-alpine"))));
assertEquals(DatabaseContainerType.SQLServer,
DatabaseContainerType.valueOf(new MSSQLServerContainer<>(DockerImageName.parse("mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04"))));
}
Expand Down
4 changes: 2 additions & 2 deletions dev/io.openliberty.checkpoint_fat_persistence/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#*******************************************************************************
# Copyright (c) 2022, 2023 IBM Corporation and others.
# Copyright (c) 2022, 2024 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
Expand All @@ -22,7 +22,7 @@ src: \

fat.project: true

fat.test.container.images: kyleaure/db2-ssl:3.0,postgres:16.0-alpine
fat.test.container.images: kyleaure/db2-ssl:3.0,postgres:17.0-alpine

# To define a global minimum java level for the FAT, use the following property.
# If unspecified, the default value is ${javac.source}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class JakartaDataTest extends FATServletClient {
private static final String DATA_APP = "jakartaDataApp";

@ClassRule
public static PostgreSQLContainer postgre = new PostgreSQLContainer("postgres:16.0-alpine")
public static PostgreSQLContainer postgre = new PostgreSQLContainer("postgres:17.0-alpine")
.withDatabaseName(POSTGRES_DB)
.withUsername(POSTGRES_USER)
.withPassword(POSTGRES_PASS)
Expand Down
2 changes: 1 addition & 1 deletion dev/io.openliberty.checkpoint_fat_springboot_data/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ src: \
fat/src

fat.project: true
fat.test.container.images: postgres:16.0-alpine
fat.test.container.images: postgres:17.0-alpine

-buildpath: \
io.openliberty.org.apache.commons.logging;version=latest,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class FATSuite extends TestContainerSuite {
private static final String POSTGRES_PASS = "productionpw";

@ClassRule
public static PostgreSQLContainer postgre = new PostgreSQLContainer("postgres:16.0-alpine")
public static PostgreSQLContainer postgre = new PostgreSQLContainer("postgres:17.0-alpine")
.withDatabaseName(POSTGRES_DB)
.withUsername(POSTGRES_USER)
.withPassword(POSTGRES_PASS)
Expand Down
3 changes: 1 addition & 2 deletions dev/io.openliberty.org.testcontainers/cache/images
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ mongo:6.0.6
openzipkin/zipkin-slim:2.23
otel/opentelemetry-collector-contrib:0.103.0
otel/opentelemetry-collector:0.74.0
postgres:14.1-alpine
postgres:16.0-alpine
postgres:17.0-alpine
ryanesch/acme-boulder:1.2
seleniarm/standalone-chromium:4.8.3
selenium/standalone-chrome:4.8.3
Expand Down

0 comments on commit 321a05b

Please sign in to comment.