Open gdavison opened 4 years ago
When verifying that a precheck works properly, the test should be skipped when preconditions are not met. However, it is also important to ensure that the test is not skipped when preconditions are met. For example, if you add a precheck for a service and do not access to GovCloud, verifying that tests aren't skipped in the standard/AWS partition is sufficient.
What a skipped test will look like:
provider_test.go:511: skipping tests; partition aws-us-gov does not support codestar service
--- SKIP: TestAccAWSCodeStarNotificationsNotificationRule_Status (1.61s)
What a test looks like that is not skipped:
--- PASS: TestAccAWSCodeStarNotificationsNotificationRule_basic (18.75s)
Endpoints still failing (e.g., no such host):
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.
If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!
Community Note
Description
We currently use
PreCheck
functions in acceptance tests to ensure that acceptance tests can be executed in the current partition, account, and/or region. If an endpoint does not exist or a sample operation returns certain error values, the test is skipped.These are some examples of what a precheck looks for:
testAccPartitionHasServicePreCheck("codestar", t)
verifies that the CodeStar service is available.In the acceptance test, add a call to an endpoint precheck (e.g.,
testAccPartitionHasServicePreCheck("codestar", t)
below) and/or a custom precheck function that tests for necessary underlying conditions for the test to be run:An example of a custom precheck:
These checks can only run against the default provider configuration. In some cases, a
PreCheck
needs to run against an alternate provider configuration, such as for an alternate region or account.Add functions to the testing suite that will configure AWS API connections using the authentication configuration settings for acceptance tests.