File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 20
20
URL = "https://sagemaker-integ-tests-data.s3.us-east-1.amazonaws.com/cat.jpeg"
21
21
22
22
REPOSITORY_NAME = "serverless-integ-test"
23
+ REPOSITORY_REGION = "us-west-2"
23
24
ROLE_NAME = "LambdaExecutionRole"
24
- REGION = "us-west-2"
25
25
26
26
27
27
@pytest .fixture (name = "image_uri" , scope = "module" )
28
28
def fixture_image_uri (account ):
29
- return f"{ account } .dkr.ecr.{ REGION } .amazonaws.com/{ REPOSITORY_NAME } :latest"
29
+ return f"{ account } .dkr.ecr.{ REPOSITORY_REGION } .amazonaws.com/{ REPOSITORY_NAME } :latest"
30
30
31
31
32
32
@pytest .fixture (name = "role" , scope = "module" )
@@ -41,9 +41,12 @@ def fixture_client(boto_session):
41
41
42
42
@pytest .fixture (name = "repository_exists" , scope = "module" )
43
43
def fixture_repository_exists (boto_session ):
44
- client = boto_session .client ("ecr" )
45
- client .describe_repositories (repositoryNames = [REPOSITORY_NAME ])
46
- return True
44
+ client = boto_session .client ("ecr" , region_name = REPOSITORY_REGION )
45
+ try :
46
+ client .describe_repositories (repositoryNames = [REPOSITORY_NAME ])
47
+ return True
48
+ except client .exceptions .RepositoryNotFoundException :
49
+ return False
47
50
48
51
49
52
def test_lambda (image_uri , role , client , repository_exists ):
You can’t perform that action at this time.
0 commit comments