Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ecr): lookup existing repository #33662

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
test: add unit test
  • Loading branch information
badmintoncryer committed Mar 3, 2025
commit e7d5229f591bd17cc3823fb5d098c74d2e5e6090
6 changes: 6 additions & 0 deletions packages/aws-cdk-lib/aws-ecr/test/repository.test.ts
Original file line number Diff line number Diff line change
@@ -107,6 +107,12 @@ describe('repository', () => {
repositoryArn: tokenName.valueAsString,
})).toThrow('Cannot look up a repository with a tokenized name or ARN.');
});

test('throw error if neither repository name nor arn is provided', () => {
// GIVEN
const stack = new cdk.Stack(undefined, undefined, { env: { region: 'us-east-1', account: '123456789012' } });
expect(() => ecr.Repository.fromLookup(stack, 'MyRepository', {})).toThrow('At least one of `repositoryName` or `repositoryArn` must be provided.');
});
});

test('construct repository', () => {