github.com/wata727/tflint@v0.12.2-0.20191013070026-96dd0d36f385/rules/awsrules/models/aws_efs_file_system_invalid_throughput_mode_test.go (about)

     1  // This file generated by `tools/model-rule-gen/main.go`. DO NOT EDIT
     2  
     3  package models
     4  
     5  import (
     6  	"testing"
     7  
     8  	"github.com/wata727/tflint/tflint"
     9  )
    10  
    11  func Test_AwsEfsFileSystemInvalidThroughputModeRule(t *testing.T) {
    12  	cases := []struct {
    13  		Name     string
    14  		Content  string
    15  		Expected tflint.Issues
    16  	}{
    17  		{
    18  			Name: "It includes invalid characters",
    19  			Content: `
    20  resource "aws_efs_file_system" "foo" {
    21  	throughput_mode = "generalPurpose"
    22  }`,
    23  			Expected: tflint.Issues{
    24  				{
    25  					Rule:    NewAwsEfsFileSystemInvalidThroughputModeRule(),
    26  					Message: `throughput_mode is not a valid value`,
    27  				},
    28  			},
    29  		},
    30  		{
    31  			Name: "It is valid",
    32  			Content: `
    33  resource "aws_efs_file_system" "foo" {
    34  	throughput_mode = "bursting"
    35  }`,
    36  			Expected: tflint.Issues{},
    37  		},
    38  	}
    39  
    40  	rule := NewAwsEfsFileSystemInvalidThroughputModeRule()
    41  
    42  	for _, tc := range cases {
    43  		runner := tflint.TestRunner(t, map[string]string{"resource.tf": tc.Content})
    44  
    45  		if err := rule.Check(runner); err != nil {
    46  			t.Fatalf("Unexpected error occurred: %s", err)
    47  		}
    48  
    49  		tflint.AssertIssuesWithoutRange(t, tc.Expected, runner.Issues)
    50  	}
    51  }