Use nordix docker registry for test containers 22/143122/3
authordanielhanrahan <daniel.hanrahan@est.tech>
Fri, 6 Feb 2026 15:07:34 +0000 (15:07 +0000)
committerdanielhanrahan <daniel.hanrahan@est.tech>
Fri, 6 Feb 2026 15:42:24 +0000 (15:42 +0000)
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>
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/AbstractLiquibaseTestBase.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/HibernateValidationTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/LiquibaseRollbackTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/liquibase/LiquibaseSessionLockTest.java
runtime-acm/src/test/resources/testcontainers.properties [deleted file]

index b01d30f..6ce71eb 100644 (file)
@@ -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));
index b6104c0..37547da 100644 (file)
@@ -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
index 9cd60a7..e786f9b 100644 (file)
@@ -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 {
 
index f73e036..0dccab8 100644 (file)
@@ -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 (file)
index 6e4c5a3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-postgres.container.image=registry.nordix.org/onaptest/postgres:14.1
\ No newline at end of file