Releases: cloudposse/test-helpers
v0.17.0
v0.16.0
Added GetAtmosOptions method @goruha (#52)
what
- Added GetAtmosOptions method
- Added
ATMOS_CLI_CONFIG_PATH
env vars - Fix
VerifyEnabledFlag
- Add
DriftTest
- Moved helpers functions to
pkg/aws
why
- Allow to get options for dependencies
- Fix remote state terraform read
- OpenTofu and Terraform handle detailed exit codes differently
- Test drifts
- Consolidate helper functions
references
v0.15.0
v0.14.0
add -only-deploy-dependencies flag @mcalhoun (#50)
what
- Added new flags
-only-deploy-dependencies
and-skip-deploy-component
to control test execution phases - Enhanced logging for component destruction phase with status updates
- Added phase status tracking for destroy operations
why
- Provides more granular control over which test phases are executed
- Enables users to run only dependency deployments when needed
- Improves visibility into test execution progress with better logging
- Makes test debugging easier by allowing specific phase isolation
references
- Related to test suite configuration improvements
- Enhances test execution flexibility described in component-helper README.md
v0.13.2
🐛 Bug Fixes
set COMPONENT_HELPER_STATE_DIR env var for atmos commands @mcalhoun (#48)
what
- Added
ATMOS_TEST_HELPER_STATE_DIR
environment variable to the Atmos options configuration, pointing to the temporary directory
why
- Allow the state directory to be set to a well known path via
--state-dir
and also work with the terraform-provider-utils provider.
v0.13.1
🐛 Bug Fixes
set ATMOS_BASE_PATH in test helper @mcalhoun (#47)
what
When running atmos
commands with the test-helper
, set the ATMOS_BASE_PATH
env variable
why
This is required for the terraform-provider-utils provider to work properly
v0.13.0
refactor test helpers @mcalhoun (#44)
what
- Refactor the
atmos/component-helper
package to better handle running suites of component tests
why
After multiple attempts at creating a set of helpers for running atmos
component tests while reducing the amount of boilerplate code we needed to write and balancing ease of use (simple API) for new Go developers, we arrived at the current version of the helpers. The previous version still required significant code, relied on TestMain (which although idiomatic, still was confusing for newer Go devs) and didn't handle concurrency well. This updated version should address those issues.
references
v0.12.0
allow skipping test runs @mcalhoun (#40)
what
- allow skipping test runs with the
-skip-tests
flag
why
- to give the developer more flexibility when iterating locally
allow multiple test suites @mcalhoun (#39)
what
- Allow multiple test suites
why
- To allow users to run multiple test suites at the same time
rename randomseed to randomidentifier @mcalhoun (#35)
what
- Rename
RandomSeed
toRandomIdentifier
in theTestSuite
struct
why
- As @Nuru pointed out, the
seed
term makes it confusion and indicates some kind of encryption is taking place, when it's literally just a random ID to prevent resource collision.
implement aws-component-helper @mcalhoun (#30)
what
- Add a new
aws-component-helper
package to allow consumers to easily test Cloud Posse flavored AWS components (root modules) with atmos.
why
- To allow components to be tested using
atmos
stacks, which is generally how they are deployed, especially when deployed within the Cloud Posse Reference Architecture.
how
The new package is meant to be used within go
tests and allows a fairly simple way to test a component:
package test
import (
"fmt"
"testing"
"github.com/cloudposse/test-helpers/pkg/atmos"
helper "github.com/cloudposse/test-helpers/pkg/atmos/aws-component-helper"
"github.com/stretchr/testify/require"
)
var suite *helper.TestSuite
// TestMain is the entry point for the test suite. It initializes the test
// suite and runs the tests.
func TestMain(m *testing.M) {
var err error
// Configure the test suite
suite, err = helper.NewTestSuite("us-east-2", "bastion", "test")
if err != nil {
panic(err)
}
// Add dependencies for the component under test in the same stack. If you
// want to add dependencies in different stacks, use AddCrossStackDependencies.
//
// Dependencies are deployed in serial in the order they are added.
suite.AddDependencies([]string{"vpc"})
// Create a new testing object since TestMain doesn't have one and we need
// one to call the Setup and Teardown functions
t := &testing.T{}
defer suite.TearDown(t)
suite.Setup(t)
m.Run()
}
func TestBastion(t *testing.T) {
additionalVars := map[string]interface{}{}
defer suite.DestroyComponentUnderTest(t, additionalVars)
_, err := suite.DeployComponentUnderTest(t, additionalVars)
require.NoError(t, err)
instanceProfile := atmos.Output(t, suite.AtmosOptions, "iam_instance_profile")
require.Equal(t, instanceProfile, fmt.Sprintf("eg-cptest-ue2-test-bastion-%s", suite.RandomSeed))
}
references
- Cloud Posse's components are located in the https://github.com/cloudposse-terraform-components GitHub Org. Any AWS component that follows the same convention can be tested using this package.
v0.11.0
fix atmos pkg version @Cerebrovinny (#31)
what
- Fix breaking change in atmos version
why
- version pkg has been moved under version folder