Skip to content

Commit 278a497

Browse files
add remaining acceptance tests
1 parent 4d339f7 commit 278a497

File tree

1 file changed

+49
-19
lines changed

1 file changed

+49
-19
lines changed

aws/data_source_aws_db_event_categories_test.go

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,31 @@ func TestAccAWSDbEventCategories_basic(t *testing.T) {
2020
{
2121
Config: testAccCheckAwsDbEventCategoriesConfig,
2222
Check: resource.ComposeTestCheckFunc(
23-
testAccAwsDbEventCategoriesAttrCheck("data.aws_db_event_categories.example"),
23+
testAccAwsDbEventCategoriesAttrCheck("data.aws_db_event_categories.example",
24+
completeEventCategoriesList),
2425
),
2526
},
2627
},
2728
})
2829
}
2930

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 {
3148
return func(s *terraform.State) error {
3249
rs, ok := s.RootModule().Resources[n]
3350
if !ok {
@@ -43,23 +60,6 @@ func testAccAwsDbEventCategoriesAttrCheck(n string) resource.TestCheckFunc {
4360
return err
4461
}
4562

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-
6363
sort.Strings(actual)
6464
sort.Strings(expected)
6565
if reflect.DeepEqual(expected, actual) != true {
@@ -98,3 +98,33 @@ func testAccCheckAwsDbEventCategoriesBuild(attrs map[string]string) ([]string, e
9898
var testAccCheckAwsDbEventCategoriesConfig = `
9999
data "aws_db_event_categories" "example" {}
100100
`
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

Comments
 (0)