From 1ded1eaa38e9704337105c7b86564ff1ff317ab8 Mon Sep 17 00:00:00 2001 From: Paolo Di Tommaso Date: Tue, 26 Nov 2024 15:27:39 +0100 Subject: [PATCH] Fix failing tests Signed-off-by: Paolo Di Tommaso --- .../wave/service/aws/AwsEcrServiceTest.groovy | 6 ++++-- .../data/queue/AbstractMessageQueueLocalTest.groovy | 13 +++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/test/groovy/io/seqera/wave/service/aws/AwsEcrServiceTest.groovy b/src/test/groovy/io/seqera/wave/service/aws/AwsEcrServiceTest.groovy index 20ce856ab..aea31a1bf 100644 --- a/src/test/groovy/io/seqera/wave/service/aws/AwsEcrServiceTest.groovy +++ b/src/test/groovy/io/seqera/wave/service/aws/AwsEcrServiceTest.groovy @@ -22,6 +22,8 @@ package io.seqera.wave.service.aws import spock.lang.Requires import spock.lang.Specification +import java.util.concurrent.Executors + /** * @@ -35,7 +37,7 @@ class AwsEcrServiceTest extends Specification { def accessKey = System.getenv('AWS_ACCESS_KEY_ID') def secretKey = System.getenv('AWS_SECRET_ACCESS_KEY') def REGION = 'eu-west-1' - def provider = new AwsEcrService() + def provider = new AwsEcrService(ioExecutor: Executors.newCachedThreadPool()) when: def creds = provider.getLoginToken(accessKey, secretKey, REGION, false).tokenize(":") @@ -51,7 +53,7 @@ class AwsEcrServiceTest extends Specification { def 'should check registry info' () { given: - def provider = new AwsEcrService() + def provider = new AwsEcrService(ioExecutor: Executors.newCachedThreadPool()) expect: provider.getEcrHostInfo(null) == null provider.getEcrHostInfo('foo') == null diff --git a/src/test/groovy/io/seqera/wave/service/data/queue/AbstractMessageQueueLocalTest.groovy b/src/test/groovy/io/seqera/wave/service/data/queue/AbstractMessageQueueLocalTest.groovy index 8923f6cf3..11a0fac6a 100644 --- a/src/test/groovy/io/seqera/wave/service/data/queue/AbstractMessageQueueLocalTest.groovy +++ b/src/test/groovy/io/seqera/wave/service/data/queue/AbstractMessageQueueLocalTest.groovy @@ -22,13 +22,17 @@ import spock.lang.Specification import java.time.Duration import java.util.concurrent.CompletableFuture +import java.util.concurrent.ExecutorService import java.util.concurrent.TimeUnit +import io.micronaut.scheduling.TaskExecutors import io.micronaut.test.extensions.spock.annotation.MicronautTest import io.seqera.wave.service.pairing.socket.PairingOutboundQueue import io.seqera.wave.service.pairing.socket.msg.PairingHeartbeat import io.seqera.wave.service.pairing.socket.msg.PairingMessage import jakarta.inject.Inject +import jakarta.inject.Named + /** * Test class {@link AbstractMessageQueue} using a {@link io.seqera.wave.service.data.queue.impl.LocalMessageQueue} * @@ -40,9 +44,12 @@ class AbstractMessageQueueLocalTest extends Specification { @Inject private MessageQueue broker + @Named(TaskExecutors.BLOCKING) + private ExecutorService ioExecutor + def 'should send and consume a request'() { given: - def queue = new PairingOutboundQueue(broker, Duration.ofMillis(100)) + def queue = new PairingOutboundQueue(broker, Duration.ofMillis(100), ioExecutor) when: def result = new CompletableFuture() @@ -58,7 +65,7 @@ class AbstractMessageQueueLocalTest extends Specification { def 'should validate '() { given: - def queue = new PairingOutboundQueue(broker, Duration.ofMillis(100)) + def queue = new PairingOutboundQueue(broker, Duration.ofMillis(100), ioExecutor) expect: queue.targetKey('foo') == 'pairing-outbound-queue/v1:foo' @@ -68,6 +75,4 @@ class AbstractMessageQueueLocalTest extends Specification { queue.close() } - - }