Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Option to use Terraform Configuration in TestStep (#153)
* Adding ConfigDirectory to TestStep (#150) * Add teststep.Config interface so that logic that examines the contents of TestStep.Config or TestStep.Directory can be encapsulated in teststep.config struct (#150) * Update TestStep.Validate() to use teststep.Config interface implementation (#150) * Switching to using a teststep.ConfigurationRequest struct for use in instantiating implementations of teststep.Config (#150) * Refactoring to use type implementing teststep.Config interface (#150) * Refactoring testStepNewImportState() to use type implementing teststep.Config interface for applied configuration (#150) * Switching to using type implementing teststep.Config interface (#150) * Moved TestStep.configHasProviderBlock(), TestStep.configHasTerraformBlock and TestStep.mergedConfig() to configuration.HasProviderBlock(), configuration.hasTerraformBlock and configuration.MergedConfig(), respectively (#150) * Fix validation error message to include ConfigDirectory (#150) * Added testCaseProviderConfig and testStepProviderConfig as fields on configuration struct to simplify processing during GetRaw() and the equivalent function(s) for processing Directory and File (#150) * Add initial implementation of copying files from ConfigDirectory into wd.baseDir (#150) * Switch to using WriteDirectory() method on configuration to make management of writing test case provider config or test step provider config simpler when handling copying of files from configuration.directory (#150) * Adding tests to verify that the ExternalProviders specified in a TestCase or TestStep are being used when TestStep.ConfigDirectory is specified (#150) * Extending implementation of HasProviderBlock() to include detection of provider blocks in configuration files within the configuration directory (#150) * Moving writing of raw config or copy of config directory files internally to configuration struct. (#150) * Removing writing of configuration files for external providers (contained within testCaseProviderConfig and testStepProvider config fields) when processing config directory as the expectation is that external providers will be specified directly in the terraform configuration files within the config directory (#150) * Adding HasConfigurationFiles() func to Config interface to be able to validate that when ConfigDirectory is defined that ExternalProviders cannot be specified for either TestCase or TestStep (#150) * Reinstating TestStep.mergedConfig() method as terraform and provider blocks are only written when using TestStep.Config. The expectation is that when using TestStep.ConfigDirectoy, the terraform files within the configuration directory will specify the terraform and/or provider blocks as necessary (#150) * Adding a couple of tests to verify behaviour when using multiple terraform configuration files in TestStep.ConfigDirectory (#150) * Switching to using TestStepConfigFunc type for TestStep.ConfigDirectory (#150) * Adding acceptance test coverage for StaticDirectory(), TestNameDirectory() and TestStepDirectory() (#150) * Adding Exec() method to TestStepConfigFunc type and removing ExecuteTestStepConfigFunc (#150) * Adding ConfigVariables to allow defining of Terraform variables within a TestStep (#150) * Adding docs for config directory and variables (#150) * Adding tests for TestStepConfigFunc.Exec() method (#150) * Adding tests for config<Type>Variable and Variables.Write() func (#150) * Adding copyright headers (#150) * Unmarshalling before comparing (#150) * Apply suggestions from code review Co-authored-by: Brian Flad <[email protected]> * Adding TestName to TestStepConfigRequest and updating TestStepDirectory() func to use TestName (#150) * Switching to supplying t.Name() to TestStepConfigRequest (#150) * Moving all test fixtures for ConfigDirectory to resource/testdata * Marshalling Variables directly (#150) * Adding comment to explain the usage of Unwrap() (#150) * Adding FloatVariable and IntegerVariable and removing NumberVariable (#150) * Changing ConfigurationRequest fields Directory and Raw to *string to make it clear that they are optional (#150) * Adding Validate() func to ConfigurationRequest along with test coverage (#150) * Adding configurationDirectory and configurationString types (#150) * Configuration() now returns the Config interface to accommodate the different types that could be returned (e.g., configurationDirectory, configurationString) * Renaming raw.go to string.go to match type defined therein (#150) * Adding support for TestStep.ConfigFile field (#150) * Updating docs for config pkg (#150) * Adding documentation into teststep/config.go and tests for exported methods/funcs in teststep/config.go (#150) * Includes refactoring of Configuration func to remove error returned as this was always nil and the returned Config interface needs to be checked for nil in any case. * Adding checks for absolute filepath in configurationDirectory and configurationFile HasProviderBlock, HasTerraformBlock and Write methods (#150) * Adding test coverage for configurationDirectory and configurationFile HasProviderBlock method * Adding tests configurationDirectory, configurationFile and configurationString HasTerraformBlock methods (#150) * Adding test coverage for error conditions and configurationDirectory, configurationFile and configurationString Write methods (#150) * Adding empty dir for tests to git (#150) * Adding a page on usage of Terraform configuration to the website docs (#150) * Adding changelog entries (#150) * Adding test to demonstrate that the TestStep number is being used dynamically to determine the directory containing the Terraform configuration (#150) * Removing unneeded elsif conditional (#150) * Updating docs (#150) * Removing any configuration or variables files from previous test steps prior to copy configuration and variables for current test step (#150) * Updating docs (#150) * Apply suggestions from code review Co-authored-by: Brian Flad <[email protected]> * Update .changes/unreleased/FEATURES-20230728-152822.yaml Co-authored-by: Brian Flad <[email protected]> * Removing unneeded changelog entries (#150) * Reusing stepNumber variable (#150) --------- Co-authored-by: Brian Flad <[email protected]>
- Loading branch information