Skip to content

Commit

Permalink
Fix rules tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wata727 committed Jul 14, 2019
1 parent 2712e34 commit b772561
Show file tree
Hide file tree
Showing 195 changed files with 808 additions and 202 deletions.
10 changes: 8 additions & 2 deletions rules/awsrules/aws_alb_invalid_security_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ resource "aws_alb" "balancer" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsALBInvalidSecurityGroupRule()

mock := client.NewMockEC2API(ctrl)
Expand Down Expand Up @@ -239,7 +242,10 @@ resource "aws_alb" "balancer" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsALBInvalidSecurityGroupRule()

mock := client.NewMockEC2API(ctrl)
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_alb_invalid_subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ resource "aws_alb" "balancer" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsALBInvalidSubnetRule()

mock := client.NewMockEC2API(ctrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ resource "aws_db_instance" "db" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsDBInstanceDefaultParameterGroupRule()

if err = rule.Check(runner); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ resource "aws_db_instance" "mysql" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsDBInstanceInvalidDBSubnetGroupRule()

mock := client.NewMockRDSAPI(ctrl)
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_db_instance_invalid_option_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ resource "aws_db_instance" "mysql" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsDBInstanceInvalidOptionGroupRule()

mock := client.NewMockRDSAPI(ctrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ resource "aws_db_instance" "mysql" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsDBInstanceInvalidParameterGroupRule()

mock := client.NewMockRDSAPI(ctrl)
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_db_instance_invalid_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ resource "aws_db_instance" "mysql" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsDBInstanceInvalidTypeRule()

if err = rule.Check(runner); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ resource "aws_db_instance" "mysql" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsDBInstanceInvalidVPCSecurityGroupRule()

mock := client.NewMockEC2API(ctrl)
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_db_instance_previous_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ resource "aws_db_instance" "mysql" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsDBInstancePreviousTypeRule()

if err = rule.Check(runner); err != nil {
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_db_instance_readable_password_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ resource "aws_db_instance" "mysql" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsDBInstanceReadablePasswordRule()

if err = rule.Check(runner); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ resource "aws_elasticache_cluster" "cache" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsElastiCacheClusterDefaultParameterGroupRule()

if err = rule.Check(runner); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ resource "aws_elasticache_cluster" "redis" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsElastiCacheClusterInvalidParameterGroupRule()

mock := client.NewMockElastiCacheAPI(ctrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ resource "aws_elasticache_cluster" "redis" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsElastiCacheClusterInvalidSecurityGroupRule()

mock := client.NewMockEC2API(ctrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ resource "aws_elasticache_cluster" "redis" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsElastiCacheClusterInvalidSubnetGroupRule()

mock := client.NewMockElastiCacheAPI(ctrl)
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_elasticache_cluster_invalid_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ resource "aws_elasticache_cluster" "redis" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsElastiCacheClusterInvalidTypeRule()

if err = rule.Check(runner); err != nil {
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_elasticache_cluster_previous_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ resource "aws_elasticache_cluster" "redis" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsElastiCacheClusterPreviousTypeRule()

if err = rule.Check(runner); err != nil {
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_elb_invalid_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ resource "aws_elb" "balancer" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsELBInvalidInstanceRule()

mock := client.NewMockEC2API(ctrl)
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_elb_invalid_security_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ resource "aws_elb" "balancer" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsELBInvalidSecurityGroupRule()

mock := client.NewMockEC2API(ctrl)
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_elb_invalid_subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ resource "aws_elb" "balancer" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsELBInvalidSubnetRule()

mock := client.NewMockEC2API(ctrl)
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_instance_default_standard_volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ resource "aws_instance" "web" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsInstanceDefaultStandardVolumeRule()

if err = rule.Check(runner); err != nil {
Expand Down
20 changes: 16 additions & 4 deletions rules/awsrules/aws_instance_invalid_ami_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ resource "aws_instance" "invalid" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsInstanceInvalidAMIRule()

ec2mock := client.NewMockEC2API(ctrl)
Expand Down Expand Up @@ -136,7 +139,10 @@ resource "aws_instance" "valid" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsInstanceInvalidAMIRule()

ec2mock := client.NewMockEC2API(ctrl)
Expand Down Expand Up @@ -245,7 +251,10 @@ resource "aws_instance" "valid" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsInstanceInvalidAMIRule()

ec2mock := client.NewMockEC2API(ctrl)
Expand Down Expand Up @@ -398,7 +407,10 @@ resource "aws_instance" "unavailable" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsInstanceInvalidAMIRule()

ec2mock := client.NewMockEC2API(ctrl)
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_instance_invalid_iam_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ resource "aws_instance" "web" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsInstanceInvalidIAMProfileRule()

mock := client.NewMockIAMAPI(ctrl)
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_instance_invalid_key_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ resource "aws_instance" "web" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsInstanceInvalidKeyNameRule()

mock := client.NewMockEC2API(ctrl)
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_instance_invalid_subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ resource "aws_instance" "web" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsInstanceInvalidSubnetRule()

mock := client.NewMockEC2API(ctrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ resource "aws_instance" "web" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsInstanceInvalidVPCSecurityGroupRule()

mock := client.NewMockEC2API(ctrl)
Expand Down
5 changes: 4 additions & 1 deletion rules/awsrules/aws_instance_previous_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ resource "aws_instance" "web" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsInstancePreviousTypeRule()

if err = rule.Check(runner); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ resource "aws_launch_configuration" "web" {
t.Fatal(tfdiags)
}

runner := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
runner, err := tflint.NewRunner(tflint.EmptyConfig(), map[string]tflint.Annotations{}, cfg, map[string]*terraform.InputValue{})
if err != nil {
t.Fatal(err)
}
rule := NewAwsLaunchConfigurationInvalidIAMProfileRule()

mock := client.NewMockIAMAPI(ctrl)
Expand Down
Loading

0 comments on commit b772561

Please sign in to comment.