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
chore: Reuses project in tests for network_container
resource
#2039
Conversation
ab08357
to
b53628e
Compare
resource.TestCheckResourceAttrSet(dataSourceName, "project_id"), | ||
resource.TestCheckResourceAttr(dataSourceName, "provider_name", constant.AWS), | ||
resource.TestCheckResourceAttrSet(dataSourceName, "provisioned"), | ||
|
||
resource.TestCheckResourceAttrWith(dataSourcePluralName, "results.#", acc.IntGreatThan(0)), | ||
resource.TestCheckResourceAttrSet(dataSourcePluralName, "results.0.id"), | ||
resource.TestCheckResourceAttrSet(dataSourcePluralName, "results.0.atlas_cidr_block"), | ||
resource.TestCheckResourceAttrSet(dataSourcePluralName, "results.0.provider_name"), | ||
resource.TestCheckResourceAttrSet(dataSourcePluralName, "results.0.provisioned"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a trend we're going to use in all resources? testing data sources within the resource test? Or is there something special about this?
Depending on the answer: could we have some comments? (always having in mind readability)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not really a new pattern, we have both approaches depending on the resource. We do the same tests to the resource and datasource (checking the same attributes) and we create the same resource to test the datasource as the "resource basic test".
i'll take it to the tech meeting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small detail to consider it that when we have acceptance tests that test both the resource and data source you will notice that the test name does not include TestAcc*RS_*, and instead defines TestAcc*_* (example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx, good point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - only one minor comment regarding this new pattern of testing data source into resource
resource.TestCheckResourceAttr(dataSourceName, "provider_name", constant.AWS), | ||
resource.TestCheckResourceAttrSet(dataSourceName, "provisioned"), | ||
|
||
resource.TestCheckResourceAttrWith(dataSourcePluralName, "results.#", acc.IntGreatThan(0)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcosuma this follows your idea of doing more generic tests on plural ds (like checking that there is more than 1 as opposed to to a fix number) so they can run in parallel
Description
Reuses project in tests for
network_container
resource.The data sources are tested with the test resources so no need to create the same resources twice.
Link to any related issue(s): CLOUDP-237991
Type of change:
Required Checklist:
Further comments