-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Acceptance test config files proof of concept (mq) #36719
base: main
Are you sure you want to change the base?
Conversation
Community NoteVoting for Prioritization
For Submitters
|
Thank you for your contribution! 🚀 A new usage of AWS SDK for Go V1 was detected. Please prefer AWS SDK for Go V2 for all net-new services. If this is an enhancement or bug fix to an existing AWS SDK Go V1 based resource, this comment can be safely ignored. For additional information refer to the AWS SDK for Go Versions page in the contributor guide. |
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.
I like the general direction of using Terraform configurations. I have a couple thoughts
@@ -0,0 +1,120 @@ | |||
variable "exclude_zone_ids" { |
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.
Small nit, the standard name for this file is variables.tf
//Config: testAccConfigurationConfig_tags1(rName, "key1", "value1"), | ||
ConfigDirectory: config.TestStepDirectory(), |
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.
In cases like this, where a particular configuration is reused, it might be worthwhile using a named configuration, with config.StaticDirectory
or a custom config.TestStepConfigFunc
ConfigVariables: map[string]config.Variable{ | ||
"exclude_zone_ids": config.ListVariable(config.StringVariable("usw2-az4"), config.StringVariable("usgw1-az2")), | ||
"state": config.StringVariable("available"), | ||
"name": config.StringVariable("opt-in-status"), | ||
"values": config.ListVariable(config.StringVariable("opt-in-not-required")), | ||
"cidr_block": config.StringVariable("10.0.0.0/16"), | ||
"random_name": config.StringVariable(rName), | ||
"vcount": config.IntegerVariable(2), | ||
"cidr_block_2": config.StringVariable("0.0.0.0/0"), | ||
"engine_type": config.StringVariable("ActiveMQ"), | ||
"engine_version": config.StringVariable("5.17.6"), | ||
"auto_minor_version_upgrade": config.BoolVariable(true), | ||
"apply_immediately": config.BoolVariable(true), | ||
"deployment_mode": config.StringVariable("ACTIVE_STANDBY_MULTI_AZ"), | ||
"host_instance_type": config.StringVariable("mq.t2.micro"), | ||
"day_of_week": config.StringVariable("TUESDAY"), | ||
"time_of_day": config.StringVariable("02:00"), | ||
"time_zone": config.StringVariable("CET"), | ||
"publicly_accessible": config.BoolVariable(true), | ||
"username": config.StringVariable("Ender"), | ||
"password": config.StringVariable("AndrewWiggin"), | ||
"username_2": config.StringVariable("Petra"), | ||
"password_2": config.StringVariable("PetraArkanian"), | ||
"console_access": config.BoolVariable(true), | ||
"groups": config.ListVariable(config.StringVariable("dragon"), config.StringVariable("salamander"), config.StringVariable("leopard")), | ||
}, |
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.
Do we need all of these variables, especially since the config is not being reused? The original testAccBrokerDataSourceConfig_byID
took one parameter
Description
TL;DR
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
supports acceptance testing using configuration files rather than strings. This PR takes an entire service, MQ, and converts all acceptance tests to use configuration files and shows what using config files entails. The tests run perfectly fine like this with a small hiccup (provider
blocks).Advantages of Config Files:
Challenges with Config Files:
Relations
Closes #0000
References
Output from Acceptance Testing