From: danielhanrahan Date: Fri, 6 Feb 2026 15:07:34 +0000 (+0000) Subject: Use nordix docker registry for test containers X-Git-Tag: 9.0.1~7 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=9e3f9ec2525e56ee1fd771a256503c8c97330f6a;p=policy%2Fclamp.git Use nordix docker registry for test containers 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 --- diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/AbstractLiquibaseTestBase.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/AbstractLiquibaseTestBase.java index b01d30fa6..6ce71eba0 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/AbstractLiquibaseTestBase.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/AbstractLiquibaseTestBase.java @@ -28,12 +28,20 @@ import liquibase.database.DatabaseFactory; 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)); diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/HibernateValidationTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/HibernateValidationTest.java index b6104c041..37547da02 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/HibernateValidationTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/HibernateValidationTest.java @@ -32,7 +32,6 @@ import org.springframework.boot.test.context.SpringBootTest; 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. @@ -45,7 +44,6 @@ import org.testcontainers.junit.jupiter.Testcontainers; */ @SpringBootTest @ActiveProfiles("hibernate-validation") -@Testcontainers class HibernateValidationTest extends AbstractLiquibaseTestBase { @Autowired diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/LiquibaseRollbackTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/LiquibaseRollbackTest.java index 9cd60a768..e786f9b50 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/LiquibaseRollbackTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/LiquibaseRollbackTest.java @@ -1,6 +1,6 @@ /*- * ============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. @@ -39,10 +39,8 @@ import org.junit.jupiter.api.TestInstance; 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 { diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/LiquibaseSessionLockTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/LiquibaseSessionLockTest.java index f73e03657..0dccab887 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/LiquibaseSessionLockTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/LiquibaseSessionLockTest.java @@ -1,6 +1,6 @@ /*- * ============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. @@ -31,9 +31,7 @@ import java.util.concurrent.TimeUnit; 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 diff --git a/runtime-acm/src/test/resources/testcontainers.properties b/runtime-acm/src/test/resources/testcontainers.properties deleted file mode 100644 index 6e4c5a351..000000000 --- a/runtime-acm/src/test/resources/testcontainers.properties +++ /dev/null @@ -1 +0,0 @@ -postgres.container.image=registry.nordix.org/onaptest/postgres:14.1 \ No newline at end of file