Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion pkg/aws/amplify.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ func StartDeploymentJob(t *testing.T, ctx context.Context, client *amplify.Clien
require.NoError(t, err)
return jobStart.JobSummary.JobId
}

2 changes: 1 addition & 1 deletion pkg/aws/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

"github.com/aws/aws-sdk-go-v2/service/backup"
"github.com/stretchr/testify/require"
"github.com/gruntwork-io/terratest/modules/aws"
"github.com/stretchr/testify/require"
)

func NewBackupClient(t *testing.T, region string) *backup.Client {
Expand Down
3 changes: 2 additions & 1 deletion pkg/aws/documentdb.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package aws

import (
"testing"

"github.com/aws/aws-sdk-go-v2/service/docdb"
"github.com/gruntwork-io/terratest/modules/aws"
"github.com/stretchr/testify/require"
"testing"
)

func NewDocDBClient(t *testing.T, region string) *docdb.Client {
Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
awstypes "github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/aws/aws-sdk-go-v2/service/ec2/types"
"github.com/gruntwork-io/terratest/modules/aws"
"github.com/gruntwork-io/terratest/modules/aws"
"github.com/stretchr/testify/assert"
)

Expand Down
1 change: 0 additions & 1 deletion pkg/aws/efs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/stretchr/testify/require"
)


func NewEFSClient(t *testing.T, region string) *efs.Client {
client, err := NewEFSClientE(t, region)
require.NoError(t, err)
Expand Down
5 changes: 1 addition & 4 deletions pkg/aws/eks.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/eks"
"github.com/aws/aws-sdk-go-v2/service/eks/types"
terratestAWS "github.com/gruntwork-io/terratest/modules/aws"
"github.com/gruntwork-io/terratest/modules/testing"
terratestAWS "github.com/gruntwork-io/terratest/modules/aws"
"github.com/stretchr/testify/require"

"k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -53,7 +53,6 @@ func CreateEksClusterE(t testing.TestingT, ctx context.Context, region string, n
},
RoleArn: aws.String(roleArn),
})

if err != nil {
return nil, err
}
Expand Down Expand Up @@ -98,7 +97,6 @@ func NewEksClientE(t testing.TestingT, region string) (*eks.Client, error) {
return eks.NewFromConfig(*sess), nil
}


func NewK8SClientConfig(cluster *types.Cluster) (*rest.Config, error) {
gen, err := token.NewGenerator(true, false)
if err != nil {
Expand All @@ -125,7 +123,6 @@ func NewK8SClientConfig(cluster *types.Cluster) (*rest.Config, error) {
}, nil
}


func NewK8SClientset(cluster *types.Cluster) (*kubernetes.Clientset, error) {
config, err := NewK8SClientConfig(cluster)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/aws/eks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"time"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/eks/types"
"github.com/aws/aws-sdk-go-v2/service/iam"
"github.com/aws/aws-sdk-go-v2/service/eks/types"
"github.com/gruntwork-io/terratest/modules/retry"
terratestAWS "github.com/gruntwork-io/terratest/modules/aws"
"github.com/gruntwork-io/terratest/modules/retry"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -67,4 +67,4 @@ func TestEksCluster(t *testing.T) {

assert.Nil(t, err)
assert.Equal(t, "terratest", *c2.Name)
}
}
25 changes: 25 additions & 0 deletions pkg/aws/elasticache.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package aws

import (
"testing"

"github.com/aws/aws-sdk-go-v2/service/elasticache"

Check failure on line 6 in pkg/aws/elasticache.go

View workflow job for this annotation

GitHub Actions / Run Tests

no required module provides package github.com/aws/aws-sdk-go-v2/service/elasticache; to add it:
"github.com/gruntwork-io/terratest/modules/aws"
"github.com/stretchr/testify/require"
)

func NewElasticacheClient(t *testing.T, region string) *elasticache.Client {
client, err := NewElasticacheClientE(t, region)
require.NoError(t, err)

return client
}

func NewElasticacheClientE(t *testing.T, region string) (*elasticache.Client, error) {
sess, err := aws.NewAuthenticatedSession(region)
if err != nil {
return nil, err
}

return elasticache.NewFromConfig(*sess), nil
}
1 change: 0 additions & 1 deletion pkg/aws/elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/stretchr/testify/require"
)


func NewElbV2Client(t *testing.T, region string) *elasticloadbalancingv2.Client {
client, err := NewElbV2ClientE(t, region)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/msk.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

"github.com/aws/aws-sdk-go-v2/service/kafka"
"github.com/stretchr/testify/require"
"github.com/gruntwork-io/terratest/modules/aws"
"github.com/stretchr/testify/require"
)

func NewMSKClient(t *testing.T, region string) *kafka.Client {
Expand Down
10 changes: 2 additions & 8 deletions pkg/aws/rds.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package aws

import (
Expand All @@ -9,7 +8,6 @@ import (
"github.com/stretchr/testify/require"
)


func AssertPotgresqlDatabaseExists(t *testing.T, dbUrl string, dbPort int32, dbUsername string, dbPassword string, databaseName string) bool {
output, err := AssertPotgresqlDatabaseExistsE(t, dbUrl, dbPort, dbUsername, dbPassword, databaseName)
require.NoError(t, err)
Expand Down Expand Up @@ -43,9 +41,7 @@ func AssertPotgresqlSchemaExistsE(t *testing.T, dbUrl string, dbPort int32, dbUs
return false, connErr
}
defer db.Close()
var (
schemaName string
)
var schemaName string
sqlStatement := `SELECT "schema_name" FROM "information_schema"."schemata" where schema_name=$1`
row := db.QueryRow(sqlStatement, expectedSchemaName)
scanErr := row.Scan(&schemaName)
Expand All @@ -71,9 +67,7 @@ func AssertPotgresqlGrantsExistsE(t *testing.T, dbUrl string, dbPort int32, dbUs
return false, connErr
}
defer db.Close()
var (
schemaName string
)
var schemaName string
sqlStatement := `SELECT grantee AS user, CONCAT(table_schema, '.', table_name) AS table,
CASE
WHEN COUNT(privilege_type) = 7 THEN 'ALL'
Expand Down
6 changes: 2 additions & 4 deletions pkg/aws/route53.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"github.com/aws/aws-sdk-go-v2/aws"
)



func GetDNSZoneByNameE(t *testing.T, ctx context.Context, hostName string, awsRegion string) (*types.HostedZone, error) {
if hostName == "" {
return nil, fmt.Errorf("hostName cannot be empty")
Expand Down Expand Up @@ -49,8 +47,8 @@ func CleanDNSZoneID(t *testing.T, ctx context.Context, zoneID string, awsRegion
}

o, err := route53Client.ListResourceRecordSets(ctx, &route53.ListResourceRecordSetsInput{
HostedZoneId: &zoneID,
MaxItems: aws.Int32(100),
HostedZoneId: &zoneID,
MaxItems: aws.Int32(100),
})
if err != nil {
return err
Expand Down
2 changes: 0 additions & 2 deletions pkg/aws/ses.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"github.com/stretchr/testify/require"
)



// NewElbV2Client creates en ELB client.
func NewSESV2Client(t *testing.T, region string) *sesv2.Client {
client, err := NewSESV2ClientE(t, region)
Expand Down
2 changes: 0 additions & 2 deletions pkg/aws/waf.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/stretchr/testify/require"
)


func NewWAFClient(t *testing.T, region string) *wafv2.Client {
client, err := NewWAFClientE(t, region)
require.NoError(t, err)
Expand Down Expand Up @@ -83,4 +82,3 @@ func WafGetIPSetByARN(t *testing.T, client *wafv2.Client, arn string) *wafv2.Get
require.NotNil(t, ipSet.IPSet)
return ipSet
}

Loading