Skip to content

Commit 8843df8

Browse files
authored
fix: Addressing stricter lint findings (#4090)
1 parent eb50f47 commit 8843df8

3 files changed

Lines changed: 24 additions & 16 deletions

File tree

awshelper/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ func TestAwsSessionValidationFail(t *testing.T) {
5353
func TestAwsNegativePublicAccessResponse(t *testing.T) {
5454
t.Parallel()
5555
testCases := []struct {
56-
name string
5756
response *s3.GetPublicAccessBlockOutput
57+
name string
5858
}{
5959
{
6060
name: "nil-response",

test/integration_aws_test.go

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,32 +57,38 @@ func TestAwsBootstrapBackend(t *testing.T) {
5757
t.Parallel()
5858

5959
testCases := []struct {
60+
checkExpectedResultFn func(t *testing.T, err error, output string, s3BucketName, dynamoDBName string)
6061
name string
6162
args string
62-
checkExpectedResultFn func(t *testing.T, err error, output string, s3BucketName, dynamoDBName string)
6363
}{
6464
{
65-
"no bootstrap s3 backend without flag",
66-
"run apply",
67-
func(t *testing.T, err error, output string, s3BucketName, dynamoDBName string) {
65+
name: "no bootstrap s3 backend without flag",
66+
args: "run apply",
67+
checkExpectedResultFn: func(t *testing.T, err error, output string, s3BucketName, dynamoDBName string) {
68+
t.Helper()
69+
6870
require.Error(t, err)
6971
assert.Regexp(t, "(S3 bucket must have been previously created)|(S3 bucket does not exist)", output)
7072
},
7173
},
7274
{
73-
"bootstrap s3 backend with flag",
74-
"run apply --backend-bootstrap",
75-
func(t *testing.T, err error, output string, s3BucketName, dynamoDBName string) {
75+
name: "bootstrap s3 backend with flag",
76+
args: "run apply --backend-bootstrap",
77+
checkExpectedResultFn: func(t *testing.T, err error, output string, s3BucketName, dynamoDBName string) {
78+
t.Helper()
79+
7680
require.NoError(t, err)
7781

7882
validateS3BucketExistsAndIsTagged(t, helpers.TerraformRemoteStateS3Region, s3BucketName, nil)
7983
validateDynamoDBTableExistsAndIsTagged(t, helpers.TerraformRemoteStateS3Region, dynamoDBName, nil)
8084
},
8185
},
8286
{
83-
"bootstrap s3 backend by backend command",
84-
"backend bootstrap",
85-
func(t *testing.T, err error, output string, s3BucketName, dynamoDBName string) {
87+
name: "bootstrap s3 backend by backend command",
88+
args: "backend bootstrap",
89+
checkExpectedResultFn: func(t *testing.T, err error, output string, s3BucketName, dynamoDBName string) {
90+
t.Helper()
91+
8692
require.NoError(t, err)
8793

8894
validateS3BucketExistsAndIsTagged(t, helpers.TerraformRemoteStateS3Region, s3BucketName, nil)
@@ -92,7 +98,7 @@ func TestAwsBootstrapBackend(t *testing.T) {
9298
}
9399

94100
for _, tc := range testCases {
95-
t.Run(fmt.Sprintf(tc.name), func(t *testing.T) {
101+
t.Run(tc.name, func(t *testing.T) {
96102
t.Parallel()
97103

98104
helpers.CleanupTerraformFolder(t, testFixtureBootstrapS3Backend)
@@ -1523,6 +1529,8 @@ func createS3Bucket(t *testing.T, awsRegion string, bucketName string) {
15231529
}
15241530

15251531
func deleteS3Bucket(t *testing.T, bucketName string, awsRegion string) {
1532+
t.Helper()
1533+
15261534
helpers.DeleteS3Bucket(t, awsRegion, bucketName)
15271535
}
15281536

test/integration_serial_aws_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ func TestTerragruntParallelism(t *testing.T) {
2525
t.Parallel()
2626

2727
testCases := []struct {
28+
expectedTimings []int
2829
parallelism int
2930
numberOfModules int
3031
timeToDeployEachModule time.Duration
31-
expectedTimings []int
3232
}{
33-
{1, 10, 5 * time.Second, []int{5, 10, 15, 20, 25, 30, 35, 40, 45, 50}},
34-
{3, 10, 5 * time.Second, []int{5, 5, 5, 10, 10, 10, 15, 15, 15, 20}},
35-
{5, 10, 5 * time.Second, []int{5, 5, 5, 5, 5, 5, 5, 5, 5, 5}},
33+
{parallelism: 1, numberOfModules: 10, timeToDeployEachModule: 5 * time.Second, expectedTimings: []int{5, 10, 15, 20, 25, 30, 35, 40, 45, 50}},
34+
{parallelism: 3, numberOfModules: 10, timeToDeployEachModule: 5 * time.Second, expectedTimings: []int{5, 5, 5, 10, 10, 10, 15, 15, 15, 20}},
35+
{parallelism: 5, numberOfModules: 10, timeToDeployEachModule: 5 * time.Second, expectedTimings: []int{5, 5, 5, 5, 5, 5, 5, 5, 5, 5}},
3636
}
3737
for _, tc := range testCases {
3838

0 commit comments

Comments
 (0)