Skip to content

chore(servicecatalog): cleanup unit tests for TagOptions#18672

Merged
mergify[bot] merged 2 commits intoaws:masterfrom
arcrank:cleanup_force
Jan 27, 2022
Merged

chore(servicecatalog): cleanup unit tests for TagOptions#18672
mergify[bot] merged 2 commits intoaws:masterfrom
arcrank:cleanup_force

Conversation

@arcrank
Copy link
Copy Markdown
Contributor

@arcrank arcrank commented Jan 26, 2022

We implemented TagOptions as a full construct, and created its own unit test suite. We are moving
some of the basic validation tests out of the other resources unit tests, and then the cross resource association
tests as well. The only TagOption tests that remain in portfolio/product are for testing the association and adding
as a prop, validation and multi resource tests will be in the tag-option test suite.

The removed validation tests are already in the tag-option test suite.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

We implemented TagOptions as a full construct, and created its own unit test suite. We are moving
some of the basic validation tests out of the other resources unit tests, and then the cross resource association
tests as well.  The only TagOption tests that remain in portfolio/product are for testing the association and adding
as a prop, validation and multi resource tests will be in the `tag-option` test suite.
@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Jan 26, 2022

@github-actions github-actions bot added the @aws-cdk/aws-servicecatalog Related to AWS Service Catalog label Jan 26, 2022
Template.fromStack(stack).resourceCountIs('AWS::ServiceCatalog::TagOptionAssociation', 3);
}),

test('fails to create and then add tag options with invalid minimum key length', () => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see

test('fails to create tag option with invalid minimum key length', () => {
expect(() => {
new servicecatalog.TagOptions(stack, 'TagOptions', {
allowedValuesForTags: {
'': ['value1', 'value2'],
},
});
}).toThrowError(/Invalid TagOption key for resource/);
}),

Comment on lines -366 to -373
test('fails to create and then add tag options with invalid maxium key length', () => {
expect(() => {
const tagOptions = new servicecatalog.TagOptions(stack, 'TagOptions', {
allowedValuesForTags: {
['key1'.repeat(1000)]: ['value1', 'value2'],
key2: ['value1'],
},
});
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see

test('fails to create tag option with invalid maxium key length', () => {
expect(() => {
new servicecatalog.TagOptions(stack, 'TagOptions', {
allowedValuesForTags: {
['longKey'.repeat(1000)]: ['value1', 'value2'],
},
});
}).toThrowError(/Invalid TagOption key for resource/);
}),

Comment on lines -379 to -388
test('fails to create and then add tag options with invalid value length', () => {
expect(() => {
const tagOptions = new servicecatalog.TagOptions(stack, 'TagOptions', {
allowedValuesForTags: {
key1: ['value1'.repeat(1000), 'value2'],
key2: ['value1'],
},
});
portfolio.associateTagOptions(tagOptions);
}).toThrowError(/Invalid TagOption value for resource/);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see

test('fails to create tag option with invalid value length', () => {
expect(() => {
new servicecatalog.TagOptions(stack, 'TagOptions', {
allowedValuesForTags: {
key: ['tagOptionValue'.repeat(1000)],
},
});
}).toThrowError(/Invalid TagOption value for resource/);
}),

Copy link
Copy Markdown
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Much tidier and easier to review than putting everything into one PR. I hope you agree 🙂.

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 27, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 0707b71
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 554645d into aws:master Jan 27, 2022
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 27, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
We implemented TagOptions as a full construct, and created its own unit test suite. We are moving
some of the basic validation tests out of the other resources unit tests, and then the cross resource association
tests as well.  The only TagOption tests that remain in portfolio/product are for testing the association and adding
as a prop, validation and multi resource tests will be in the `tag-option` test suite.

The removed validation tests are already in the `tag-option` test suite. 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@aws-cdk/aws-servicecatalog Related to AWS Service Catalog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants