diff options
author | 2025-01-30 16:37:18 +0000 | |
---|---|---|
committer | 2025-01-30 16:38:49 +0000 | |
commit | c628217048b06eb91359aa6cf4758e6de05425a7 (patch) | |
tree | d4fe1096cdc0997d7ced03df8e28e77fc705bc4f | |
parent | dfb5651ab58e15dd683e111156d7a22687e79a01 (diff) |
Fix deprecation issue related to KafkaContainer
- Replaced KafkaContainer with ConfluentKafkaContainer to fix the
deprecation issue
- Bumped the version of cp-kafka and cp-zookeeper to 7.8.0
- Removing reference of registry.nordix as the NCMP internal pipeline is no
longer used
Issue-ID: CPS-2608
Change-Id: Ic1f3edbc06d63c5f00c1ecb901e07a6bc17ae6eb
Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
3 files changed, 10 insertions, 12 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/utils/events/MessagingBaseSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/utils/events/MessagingBaseSpec.groovy index 377a1a6637..d38d5442f2 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/utils/events/MessagingBaseSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/utils/events/MessagingBaseSpec.groovy @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (c) 2023 Nordix Foundation. + * Copyright (c) 2023-2025 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,8 +29,7 @@ import org.springframework.kafka.core.KafkaTemplate import org.springframework.kafka.support.serializer.JsonSerializer import org.springframework.test.context.DynamicPropertyRegistry import org.springframework.test.context.DynamicPropertySource -import org.testcontainers.containers.KafkaContainer -import org.testcontainers.utility.DockerImageName +import org.testcontainers.kafka.ConfluentKafkaContainer import spock.lang.Specification class MessagingBaseSpec extends Specification { @@ -43,7 +42,7 @@ class MessagingBaseSpec extends Specification { kafkaTestContainer.stop() } - static kafkaTestContainer = new KafkaContainer(DockerImageName.parse('registry.nordix.org/onaptest/confluentinc/cp-kafka:6.2.1').asCompatibleSubstituteFor('confluentinc/cp-kafka')) + static kafkaTestContainer = new ConfluentKafkaContainer("confluentinc/cp-kafka:7.8.0") def legacyEventKafkaTemplate = new KafkaTemplate<>(new DefaultKafkaProducerFactory<String, String>(eventProducerConfigProperties(JsonSerializer))) diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index fe6966005f..5b7db6839d 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -96,7 +96,7 @@ services: ### if kafka is not required comment out zookeeper and kafka ### zookeeper: - image: confluentinc/cp-zookeeper:6.2.1 + image: confluentinc/cp-zookeeper:7.8.0 container_name: ${ZOOKEEPER_CONTAINER_NAME:-zookeeper} ports: - ${ZOOKEEPER_PORT:-2181}:2181 @@ -104,7 +104,7 @@ services: ZOOKEEPER_CLIENT_PORT: 2181 kafka: - image: confluentinc/cp-kafka:6.2.1 + image: confluentinc/cp-kafka:7.8.0 container_name: ${KAFKA_CONTAINER_NAME:-kafka} ports: - ${KAFKA_PORT:-9092}:9092 diff --git a/integration-test/src/test/java/org/onap/cps/integration/KafkaTestContainer.java b/integration-test/src/test/java/org/onap/cps/integration/KafkaTestContainer.java index ff4aec4175..60c1637c5a 100644 --- a/integration-test/src/test/java/org/onap/cps/integration/KafkaTestContainer.java +++ b/integration-test/src/test/java/org/onap/cps/integration/KafkaTestContainer.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2024 Nordix Foundation. + * Copyright (C) 2024-2025 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.clients.consumer.KafkaConsumer; import org.apache.kafka.common.serialization.StringDeserializer; -import org.testcontainers.containers.KafkaContainer; -import org.testcontainers.utility.DockerImageName; +import org.testcontainers.kafka.ConfluentKafkaContainer; /** * The Apache Kafka test container wrapper. @@ -35,14 +34,14 @@ import org.testcontainers.utility.DockerImageName; * Avoid unnecessary resource and time consumption. */ @Slf4j -public class KafkaTestContainer extends KafkaContainer { +public class KafkaTestContainer extends ConfluentKafkaContainer { - private static final String IMAGE_NAME_AND_VERSION = "registry.nordix.org/onaptest/confluentinc/cp-kafka:6.2.1"; + private static final String IMAGE_NAME_AND_VERSION = "confluentinc/cp-kafka:7.8.0"; private static volatile KafkaTestContainer kafkaTestContainer; private KafkaTestContainer() { - super(DockerImageName.parse(IMAGE_NAME_AND_VERSION).asCompatibleSubstituteFor("confluentinc/cp-kafka")); + super(IMAGE_NAME_AND_VERSION); } /** |