-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Paolo Di Tommaso <[email protected]>
- Loading branch information
1 parent
1ded1ea
commit f44a9f1
Showing
2 changed files
with
13 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(":") | ||
|
@@ -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' () { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters