Skip to content

Releases: cloudposse/test-helpers

v0.17.0

18 Feb 23:42
b7c452d
Compare
Choose a tag to compare
Extend aws package @goruha (#54)

what

  • Added GetDNSZoneByNameE

why

  • Required for dns-delegated component tests

v0.16.0

13 Feb 14:09
2fd3da0
Compare
Choose a tag to compare
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

06 Feb 19:28
c0777cb
Compare
Choose a tag to compare
Fix atmos terraform output json @goruha (#51)

what

  • Fix json flag.

why

  • The json flag should be applied to terraform flag not to atmos, so the flag should be after atmos stacks flag

v0.14.0

06 Feb 16:07
83e256a
Compare
Choose a tag to compare
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

29 Jan 19:12
4674e3f
Compare
Choose a tag to compare

🐛 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

29 Jan 15:59
11aea8b
Compare
Choose a tag to compare

🐛 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

28 Jan 18:42
5d6e52c
Compare
Choose a tag to compare
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

26 Nov 16:31
c751907
Compare
Choose a tag to compare
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 to RandomIdentifier in the TestSuite 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

v0.11.0

29 Oct 18:56
7cf3356
Compare
Choose a tag to compare
fix atmos pkg version @Cerebrovinny (#31)

what

  • Fix breaking change in atmos version

why

  • version pkg has been moved under version folder

references

rename package to test-helpers @mcalhoun (#29)

what

  • Rename from terratest-helpers to test-helpers

why

  • Make the repo name better reflect the broader scope of the package.

v0.10.0

10 Oct 17:27
e791235
Compare
Choose a tag to compare
add atmos vendor test helpers @mcalhoun (#28)

what

Add atmos vendor test helpers

why

To allow atmos vendor to be called from within component tests to vendor in dependent components.