The postgres image is not being pulled from nordix.
- use hardcoded image name instead of properties file
- use new PostreSQLContainer to fix deprecation issue
- clean up unneeded @Testcontainers annotations
Issue-ID: POLICY-5472
Change-Id: Ief6b8c3fa1704ac9e581752128897c6d31688c28
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
import liquibase.database.jvm.JdbcConnection;
import liquibase.exception.DatabaseException;
import liquibase.resource.ClassLoaderResourceAccessor;
-import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
+import org.testcontainers.postgresql.PostgreSQLContainer;
+import org.testcontainers.utility.DockerImageName;
+@Testcontainers
public abstract class AbstractLiquibaseTestBase {
+
+ private static final DockerImageName POSTGRES_IMAGE = DockerImageName
+ .parse("registry.nordix.org/onaptest/postgres:14.1")
+ .asCompatibleSubstituteFor("postgres");
+
@Container
- protected static final PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres");
+ protected static final PostgreSQLContainer postgres = new PostgreSQLContainer(POSTGRES_IMAGE);
protected static Liquibase initLiquibase(Connection connection) throws DatabaseException {
var database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
-import org.testcontainers.junit.jupiter.Testcontainers;
/**
* This test enables Hibernate validation during context startup.
*/
@SpringBootTest
@ActiveProfiles("hibernate-validation")
-@Testcontainers
class HibernateValidationTest extends AbstractLiquibaseTestBase {
@Autowired
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ * Copyright (C) 2025-2026 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
-import org.testcontainers.junit.jupiter.Testcontainers;
// This test class verifies that rollbacks for each Liquibase release tag works correctly.
-@Testcontainers
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class LiquibaseRollbackTest extends AbstractLiquibaseTestBase {
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ * Copyright (C) 2025-2026 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import liquibase.Liquibase;
import liquibase.exception.LiquibaseException;
import org.junit.jupiter.api.Test;
-import org.testcontainers.junit.jupiter.Testcontainers;
-@Testcontainers
class LiquibaseSessionLockTest extends AbstractLiquibaseTestBase {
@Test
+++ /dev/null
-postgres.container.image=registry.nordix.org/onaptest/postgres:14.1
\ No newline at end of file