Skip to content
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

rename randomseed to randomidentifier #35

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 0 additions & 65 deletions go.sum

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pkg/atmos/aws-component-helper/atmos.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import (

func GetAtmosOptions(t *testing.T, suite *TestSuite, componentName string, stackName string, vars map[string]interface{}) *atmos.Options {
mergedVars := map[string]interface{}{
"attributes": []string{suite.RandomSeed},
"attributes": []string{suite.RandomIdentifier},
"region": suite.AwsRegion,
}

// If we are not skipping the nuking of the test account, add the default tags
if !suite.SkipNukeTestAccount {
nukeVars := map[string]interface{}{
"default_tags": map[string]string{
"CreatedByTerratestRun": suite.RandomSeed,
"CreatedByTerratestRun": suite.RandomIdentifier,
},
}

Expand All @@ -38,7 +38,7 @@ func GetAtmosOptions(t *testing.T, suite *TestSuite, componentName string, stack
Stack: stackName,
NoColor: true,
BackendConfig: map[string]interface{}{
"workspace_key_prefix": strings.Join([]string{suite.RandomSeed, stackName}, "-"),
"workspace_key_prefix": strings.Join([]string{suite.RandomIdentifier, stackName}, "-"),
},
Vars: mergedVars,
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/atmos/aws-component-helper/setup_test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func readOrCreateTestSuiteFile(testSuite *TestSuite, testName string) (*TestSuit
return testSuite, nil
} else {
randID := random.UniqueId()
testSuite.RandomSeed = strings.ToLower(randID)
testSuite.RandomIdentifier = strings.ToLower(randID)

testSuite.TempDir, err = os.MkdirTemp("", testName)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions pkg/atmos/aws-component-helper/setup_test_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestReadOrCreateTestSuiteFile(t *testing.T) {

result, err := readOrCreateTestSuiteFile(ts, testName)
assert.NoError(t, err)
assert.NotEmpty(t, result.RandomSeed)
assert.NotEmpty(t, result.RandomIdentifier)
assert.NotEmpty(t, result.TempDir)

// Verify file was created
Expand All @@ -83,8 +83,8 @@ func TestReadOrCreateTestSuiteFile(t *testing.T) {
t.Run("read existing test suite file", func(t *testing.T) {
// Create a test suite file
existingTS := &TestSuite{
RandomSeed: "test-seed",
TempDir: "test-dir",
RandomIdentifier: "test-seed",
TempDir: "test-dir",
}
data, err := json.MarshalIndent(existingTS, "", " ")
assert.NoError(t, err)
Expand All @@ -95,10 +95,10 @@ func TestReadOrCreateTestSuiteFile(t *testing.T) {
ts := &TestSuite{}
result, err := readOrCreateTestSuiteFile(ts, "test_")
assert.NoError(t, err)
assert.Equal(t, existingTS.RandomSeed, result.RandomSeed)
assert.Equal(t, existingTS.RandomIdentifier, result.RandomIdentifier)
assert.Equal(t, existingTS.TempDir, result.TempDir)

// Clean up
os.Remove(testSuiteFile)
})
}
}
2 changes: 1 addition & 1 deletion pkg/atmos/aws-component-helper/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type TestSuite struct {
ComponentSrcPath string
Dependencies []*Dependency
FixturesPath string
RandomSeed string
RandomIdentifier string
SkipSetupComponentUnderTest bool
SkipDeployDependencies bool
SkipDeployComponentUnderTest bool
Expand Down
2 changes: 1 addition & 1 deletion test/aws-component-helper/test/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ func TestBasic(t *testing.T) {
require.NoError(t, err)

revision := atmos.Output(t, suite.AtmosOptions, "revision")
expected := fmt.Sprintf("%s-%s", strings.ToLower(suite.RandomSeed), additionalVars["revision"])
expected := fmt.Sprintf("%s-%s", strings.ToLower(suite.RandomIdentifier), additionalVars["revision"])
require.Equal(t, expected, revision)
}