@@ -20,14 +20,31 @@ func TestAccAWSDbEventCategories_basic(t *testing.T) {
20
20
{
21
21
Config : testAccCheckAwsDbEventCategoriesConfig ,
22
22
Check : resource .ComposeTestCheckFunc (
23
- testAccAwsDbEventCategoriesAttrCheck ("data.aws_db_event_categories.example" ),
23
+ testAccAwsDbEventCategoriesAttrCheck ("data.aws_db_event_categories.example" ,
24
+ completeEventCategoriesList ),
24
25
),
25
26
},
26
27
},
27
28
})
28
29
}
29
30
30
- func testAccAwsDbEventCategoriesAttrCheck (n string ) resource.TestCheckFunc {
31
+ func TestAccAWSDbEventCategories_sourceType (t * testing.T ) {
32
+ resource .Test (t , resource.TestCase {
33
+ PreCheck : func () { testAccPreCheck (t ) },
34
+ Providers : testAccProviders ,
35
+ Steps : []resource.TestStep {
36
+ {
37
+ Config : testAccCheckAwsDbEventCategoriesConfig_sourceType ,
38
+ Check : resource .ComposeTestCheckFunc (
39
+ testAccAwsDbEventCategoriesAttrCheck ("data.aws_db_event_categories.example" ,
40
+ DbSnapshotEventCategoriesList ),
41
+ ),
42
+ },
43
+ },
44
+ })
45
+ }
46
+
47
+ func testAccAwsDbEventCategoriesAttrCheck (n string , expected []string ) resource.TestCheckFunc {
31
48
return func (s * terraform.State ) error {
32
49
rs , ok := s .RootModule ().Resources [n ]
33
50
if ! ok {
@@ -43,23 +60,6 @@ func testAccAwsDbEventCategoriesAttrCheck(n string) resource.TestCheckFunc {
43
60
return err
44
61
}
45
62
46
- expected := []string {
47
- "notification" ,
48
- "deletion" ,
49
- "failover" ,
50
- "maintenance" ,
51
- "availability" ,
52
- "read replica" ,
53
- "failure" ,
54
- "configuration change" ,
55
- "recovery" ,
56
- "low storage" ,
57
- "backup" ,
58
- "creation" ,
59
- "backtrack" ,
60
- "restoration" ,
61
- }
62
-
63
63
sort .Strings (actual )
64
64
sort .Strings (expected )
65
65
if reflect .DeepEqual (expected , actual ) != true {
@@ -98,3 +98,33 @@ func testAccCheckAwsDbEventCategoriesBuild(attrs map[string]string) ([]string, e
98
98
var testAccCheckAwsDbEventCategoriesConfig = `
99
99
data "aws_db_event_categories" "example" {}
100
100
`
101
+
102
+ var completeEventCategoriesList = []string {
103
+ "notification" ,
104
+ "deletion" ,
105
+ "failover" ,
106
+ "maintenance" ,
107
+ "availability" ,
108
+ "read replica" ,
109
+ "failure" ,
110
+ "configuration change" ,
111
+ "recovery" ,
112
+ "low storage" ,
113
+ "backup" ,
114
+ "creation" ,
115
+ "backtrack" ,
116
+ "restoration" ,
117
+ }
118
+
119
+ var testAccCheckAwsDbEventCategoriesConfig_sourceType = `
120
+ data "aws_db_event_categories" "example" {
121
+ source_type = "db-snapshot"
122
+ }
123
+ `
124
+
125
+ var DbSnapshotEventCategoriesList = []string {
126
+ "notification" ,
127
+ "deletion" ,
128
+ "creation" ,
129
+ "restoration" ,
130
+ }
0 commit comments