Merge pull request #1335 from snyk/chore/rename-acc-tests

AWS acceptance tests
main
William BEUIL 2022-02-03 17:45:09 +01:00 committed by GitHub
commit 66baef7a63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 65 additions and 25 deletions

View File

@ -7,7 +7,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsDynamoDBTable(t *testing.T) {
func TestAcc_Aws_DynamoDBTable(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_dynamodb_table"},

View File

@ -15,7 +15,7 @@ import (
"github.com/snyk/driftctl/test/acceptance/awsutils"
)
func TestAcc_AwsECRRepository(t *testing.T) {
func TestAcc_Aws_ECRRepository(t *testing.T) {
var mutatedRepositoryID string
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",

View File

@ -22,6 +22,17 @@ func TestAcc_Aws_Eip(t *testing.T) {
Env: map[string]string{
"AWS_REGION": "us-east-1",
},
// New resources are not visible immediately through AWS API after an apply operation
// (e.g. error attaching EC2 Internet Gateway)
// Logic below retries driftctl scan using a back-off strategy of retrying 'n' times
// and doubling the amount of time waited after each one.
ShouldRetry: func(result *test.ScanResult, retryDuration time.Duration, retryCount uint8) bool {
if result.IsSync() || retryDuration > 10*time.Minute {
return false
}
time.Sleep((2 * time.Duration(retryCount)) * time.Minute)
return true
},
Check: func(result *test.ScanResult, stdout string, err error) {
if err != nil {
t.Fatal(err)

View File

@ -7,13 +7,16 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsIamPolicyAttachment_WithGroupsUsers(t *testing.T) {
func TestAcc_Aws_IamPolicyAttachment_WithGroupsUsers(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_iam_policy_attachment"},
Args: []string{"scan", "--deep"},
Checks: []acceptance.AccCheck{
{
Env: map[string]string{
"AWS_REGION": "us-east-1",
},
Check: func(result *test.ScanResult, stdout string, err error) {
if err != nil {
t.Fatal(err)

View File

@ -14,7 +14,7 @@ import (
"github.com/snyk/driftctl/test/acceptance/awsutils"
)
func TestAcc_AwsInstance(t *testing.T) {
func TestAcc_Aws_Instance(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_instance_default"},
@ -39,7 +39,7 @@ func TestAcc_AwsInstance(t *testing.T) {
})
}
func TestAcc_AwsInstance_WithBlockDevices(t *testing.T) {
func TestAcc_Aws_Instance_WithBlockDevices(t *testing.T) {
var mutatedInstanceId string
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",

View File

@ -8,7 +8,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsInternetGateway(t *testing.T) {
func TestAcc_Aws_InternetGateway(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_internet_gateway"},
@ -22,6 +22,17 @@ func TestAcc_AwsInternetGateway(t *testing.T) {
Env: map[string]string{
"AWS_REGION": "us-east-1",
},
// New resources are not visible immediately through AWS API after an apply operation
// (e.g. InvalidVpcID.NotFound)
// Logic below retries driftctl scan using a back-off strategy of retrying 'n' times
// and doubling the amount of time waited after each one.
ShouldRetry: func(result *test.ScanResult, retryDuration time.Duration, retryCount uint8) bool {
if result.IsSync() || retryDuration > 10*time.Minute {
return false
}
time.Sleep((2 * time.Duration(retryCount)) * time.Minute)
return true
},
Check: func(result *test.ScanResult, stdout string, err error) {
if err != nil {
t.Fatal(err)

View File

@ -10,7 +10,7 @@ import (
// aws lambda list-event-source-mappings to list all event source mappings
// aws lambda delete-event-source-mapping --uuid xxx to delete a specific event source mapping
func TestAcc_AwsLambdaEventSourceMapping(t *testing.T) {
func TestAcc_Aws_LambdaEventSourceMapping(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_lambda_event_source_mapping"},

View File

@ -7,7 +7,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsLaunchConfiguration(t *testing.T) {
func TestAcc_Aws_LaunchConfiguration(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_launch_configuration"},

View File

@ -7,7 +7,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsLaunchTemplate(t *testing.T) {
func TestAcc_Aws_LaunchTemplate(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_launch_template"},

View File

@ -7,7 +7,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsNATGateway(t *testing.T) {
func TestAcc_Aws_NATGateway(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_nat_gateway"},

View File

@ -2,6 +2,7 @@ package aws_test
import (
"testing"
"time"
"github.com/snyk/driftctl/test"
"github.com/snyk/driftctl/test/acceptance"
@ -41,6 +42,17 @@ func TestAcc_Aws_NetworkAcl_NonDeep(t *testing.T) {
Env: map[string]string{
"AWS_REGION": "us-east-1",
},
// New resources are not visible immediately through AWS API after an apply operation
// (e.g. InvalidNetworkAclID.NotFound)
// Logic below retries driftctl scan using a back-off strategy of retrying 'n' times
// and doubling the amount of time waited after each one.
ShouldRetry: func(result *test.ScanResult, retryDuration time.Duration, retryCount uint8) bool {
if result.IsSync() || retryDuration > 10*time.Minute {
return false
}
time.Sleep((2 * time.Duration(retryCount)) * time.Minute)
return true
},
Check: func(result *test.ScanResult, stdout string, err error) {
if err != nil {
t.Fatal(err)

View File

@ -14,7 +14,7 @@ import (
"github.com/snyk/driftctl/test/acceptance/awsutils"
)
func TestAcc_AwsRoute53HealthCheck(t *testing.T) {
func TestAcc_Aws_Route53HealthCheck(t *testing.T) {
var mutatedHealthCheckID string
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",

View File

@ -7,7 +7,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsRoute53Record_WithFQDNAsId(t *testing.T) {
func TestAcc_Aws_Route53Record_WithFQDNAsId(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_route53_record"},
@ -30,13 +30,16 @@ func TestAcc_AwsRoute53Record_WithFQDNAsId(t *testing.T) {
})
}
func TestAcc_AwsRoute53Record_WithAlias(t *testing.T) {
func TestAcc_Aws_Route53Record_WithAlias(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_route53_record_with_alias"},
Args: []string{"scan", "--deep"},
Checks: []acceptance.AccCheck{
{
Env: map[string]string{
"AWS_REGION": "us-east-1",
},
Check: func(result *test.ScanResult, stdout string, err error) {
if err != nil {
t.Fatal(err)

View File

@ -8,7 +8,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsRouteTableAssociation(t *testing.T) {
func TestAcc_Aws_RouteTableAssociation(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_route_table_association"},

View File

@ -7,7 +7,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsRouteTable(t *testing.T) {
func TestAcc_Aws_RouteTable(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_route_table"},

View File

@ -8,7 +8,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsRoute(t *testing.T) {
func TestAcc_Aws_Route(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_route"},

View File

@ -7,7 +7,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsS3Bucket_BucketInUsEast1(t *testing.T) {
func TestAcc_Aws_S3Bucket_BucketInUsEast1(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_s3_bucket"},

View File

@ -7,7 +7,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsSecurityGroup(t *testing.T) {
func TestAcc_Aws_SecurityGroup(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_security_group"},

View File

@ -12,7 +12,7 @@ import (
"github.com/snyk/driftctl/test/acceptance/awsutils"
)
func TestAcc_AwsSNSTopicPolicy(t *testing.T) {
func TestAcc_Aws_SNSTopicPolicy(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_sns_topic_policy"},

View File

@ -12,7 +12,7 @@ import (
"github.com/snyk/driftctl/test/acceptance/awsutils"
)
func TestAcc_AwsSNSTopicSubscription(t *testing.T) {
func TestAcc_Aws_SNSTopicSubscription(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_sns_topic_subscription"},

View File

@ -21,7 +21,7 @@ import (
"github.com/snyk/driftctl/test/acceptance/awsutils"
)
func TestAcc_AwsSNSTopic(t *testing.T) {
func TestAcc_Aws_SNSTopic(t *testing.T) {
var mutatedTopicArn string
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",

View File

@ -12,7 +12,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsSQSQueuePolicy(t *testing.T) {
func TestAcc_Aws_SQSQueuePolicy(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_sqs_queue_policy"},

View File

@ -19,7 +19,7 @@ import (
"github.com/snyk/driftctl/test/acceptance/awsutils"
)
func TestAcc_AwsSQSQueue(t *testing.T) {
func TestAcc_Aws_SQSQueue(t *testing.T) {
var mutatedQueue string
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",

View File

@ -7,7 +7,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsSubnet(t *testing.T) {
func TestAcc_Aws_Subnet(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_subnet"},

View File

@ -8,7 +8,7 @@ import (
"github.com/snyk/driftctl/test/acceptance"
)
func TestAcc_AwsVPC(t *testing.T) {
func TestAcc_Aws_VPC(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/aws_vpc"},