diff options
Diffstat (limited to 'src/test/groovy/org')
2 files changed, 5 insertions, 9 deletions
diff --git a/src/test/groovy/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListenerIntegrationSpec.groovy b/src/test/groovy/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListenerIntegrationSpec.groovy index 4c362ad..2ba011f 100644 --- a/src/test/groovy/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListenerIntegrationSpec.groovy +++ b/src/test/groovy/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListenerIntegrationSpec.groovy @@ -29,6 +29,7 @@ import org.springframework.kafka.core.KafkaTemplate import org.springframework.test.context.DynamicPropertyRegistry import org.springframework.test.context.DynamicPropertySource import org.testcontainers.containers.KafkaContainer +import org.testcontainers.spock.Testcontainers import spock.lang.Shared import spock.lang.Specification import spock.util.concurrent.PollingConditions @@ -40,19 +41,18 @@ import java.util.concurrent.TimeUnit * This integration test is running database and kafka dependencies as docker containers. */ @SpringBootTest +@Testcontainers @Slf4j class DataUpdatedEventListenerIntegrationSpec extends Specification { @Shared - def databaseTestContainer = TimescaleContainer.getInstance() + TimescaleContainer databaseTestContainer = TimescaleContainer.getInstance() static kafkaTestContainer = new KafkaContainer() static { Runtime.getRuntime().addShutdownHook(new Thread(kafkaTestContainer::stop)) } - def setupSpec() { - databaseTestContainer.start() kafkaTestContainer.start() } diff --git a/src/test/groovy/org/onap/cps/temporal/repository/NetworkDataRepositorySpec.groovy b/src/test/groovy/org/onap/cps/temporal/repository/NetworkDataRepositorySpec.groovy index f66b35e..c23015c 100644 --- a/src/test/groovy/org/onap/cps/temporal/repository/NetworkDataRepositorySpec.groovy +++ b/src/test/groovy/org/onap/cps/temporal/repository/NetworkDataRepositorySpec.groovy @@ -23,7 +23,7 @@ import org.onap.cps.temporal.domain.NetworkData import org.onap.cps.temporal.repository.containers.TimescaleContainer import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest -import org.testcontainers.junit.jupiter.Testcontainers +import org.testcontainers.spock.Testcontainers import spock.lang.Shared import spock.lang.Specification @@ -49,11 +49,7 @@ class NetworkDataRepositorySpec extends Specification { .schemaSet(schemaSetName).anchor(anchorName).payload(payload).build() @Shared - def databaseTestContainer = TimescaleContainer.getInstance() - - def setupSpec() { - databaseTestContainer.start() - } + TimescaleContainer databaseTestContainer = TimescaleContainer.getInstance() def 'Store latest network data in timeseries database.'() { when: 'a new Network Data is stored' |