Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Nov 26, 2024
1 parent 1ded1ea commit f44a9f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,27 @@

package io.seqera.wave.service.aws


import spock.lang.Requires
import spock.lang.Specification

import java.util.concurrent.Executors


import io.micronaut.test.extensions.spock.annotation.MicronautTest
import jakarta.inject.Inject
/**
*
* @author Paolo Di Tommaso <[email protected]>
*/
@MicronautTest
class AwsEcrServiceTest extends Specification {

@Inject
AwsEcrService provider

@Requires({System.getenv('AWS_ACCESS_KEY_ID') && System.getenv('AWS_SECRET_ACCESS_KEY')})
def 'should get registry token' () {
given:
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(ioExecutor: Executors.newCachedThreadPool())

when:
def creds = provider.getLoginToken(accessKey, secretKey, REGION, false).tokenize(":")
Expand All @@ -51,17 +52,15 @@ class AwsEcrServiceTest extends Specification {
thrown(Exception)
}

@Requires({System.getenv('AWS_ACCESS_KEY_ID') && System.getenv('AWS_SECRET_ACCESS_KEY')})
def 'should check registry info' () {
given:
def provider = new AwsEcrService(ioExecutor: Executors.newCachedThreadPool())
expect:
provider.getEcrHostInfo(null) == null
provider.getEcrHostInfo('foo') == null
provider.getEcrHostInfo('195996028523.dkr.ecr.eu-west-1.amazonaws.com') == new AwsEcrService.AwsEcrHostInfo('195996028523', 'eu-west-1')
provider.getEcrHostInfo('195996028523.dkr.ecr.eu-west-1.amazonaws.com/foo') == new AwsEcrService.AwsEcrHostInfo('195996028523', 'eu-west-1')
and:
provider.getEcrHostInfo('public.ecr.aws') == new AwsEcrService.AwsEcrHostInfo(null, 'us-east-1')

}

def 'should check ecr registry' () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import spock.lang.Specification

import java.time.Duration
import java.util.concurrent.CompletableFuture
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit

import io.micronaut.context.ApplicationContext
Expand Down Expand Up @@ -54,8 +55,9 @@ class AbstractMessageQueueRedisTest extends Specification implements RedisTestCo

def 'should send and consume a request'() {
given:
def executor = Executors.newCachedThreadPool()
def broker = context.getBean(RedisMessageQueue)
def queue = new PairingOutboundQueue(broker, Duration.ofMillis(100))
def queue = new PairingOutboundQueue(broker, Duration.ofMillis(100), executor)
and:
def result = new CompletableFuture<PairingMessage>()
when:
Expand All @@ -72,11 +74,12 @@ class AbstractMessageQueueRedisTest extends Specification implements RedisTestCo

def 'should send and consume a request across instances'() {
given:
def executor = Executors.newCachedThreadPool()
def broker1 = context.getBean(RedisMessageQueue)
def queue1 = new PairingOutboundQueue(broker1, Duration.ofMillis(100))
def queue1 = new PairingOutboundQueue(broker1, Duration.ofMillis(100), executor)
and:
def broker2 = context.getBean(RedisMessageQueue)
def queue2 = new PairingOutboundQueue(broker2, Duration.ofMillis(100))
def queue2 = new PairingOutboundQueue(broker2, Duration.ofMillis(100), executor)
and:
def result = new CompletableFuture<PairingMessage>()

Expand Down

0 comments on commit f44a9f1

Please sign in to comment.