@@ -12,82 +12,83 @@ import (
1212 "github.com/hashicorp/terraform-plugin-testing/terraform"
1313)
1414
15- func TestAccDbtCloudWebhookResource (t * testing.T ) {
16- if acctest_config .IsDbtCloudPR () {
17- t .Skip ("Skipping webhooks acceptance in dbt Cloud CI for now" )
18- }
19- webhookName := acctest .RandStringFromCharSet (10 , acctest .CharSetAlpha )
20- webhookName2 := acctest .RandStringFromCharSet (10 , acctest .CharSetAlpha )
21- projectName := acctest .RandStringFromCharSet (10 , acctest .CharSetAlpha )
22-
23- var basicConfigTestStep = resource.TestStep {
24- Config : testAccDbtCloudWebhookResourceBasicConfig (webhookName , projectName ),
25- Check : resource .ComposeTestCheckFunc (
26- testAccCheckDbtCloudWebhookExists ("dbtcloud_webhook.test_webhook" ),
27- resource .TestCheckResourceAttr (
28- "dbtcloud_webhook.test_webhook" ,
29- "name" ,
30- webhookName ,
31- ),
32- resource .TestCheckResourceAttrSet (
33- "dbtcloud_webhook.test_webhook" ,
34- "hmac_secret" ,
35- ),
36- resource .TestCheckResourceAttrSet (
37- "dbtcloud_webhook.test_webhook" ,
38- "account_identifier" ,
39- ),
40- resource .TestCheckResourceAttr (
41- "dbtcloud_webhook.test_webhook" ,
42- "event_types.#" ,
43- "2" ,
44- ),
45- resource .TestCheckResourceAttr (
46- "dbtcloud_webhook.test_webhook" ,
47- "job_ids.#" ,
48- "0" ,
49- ),
50- resource .TestCheckResourceAttr (
51- "dbtcloud_webhook.test_webhook" ,
52- "client_url" ,
53- "https://example.com" ,
54- ),
15+ var webhookName = acctest .RandStringFromCharSet (10 , acctest .CharSetAlpha )
16+ var webhookName2 = acctest .RandStringFromCharSet (10 , acctest .CharSetAlpha )
17+ var projectName = acctest .RandStringFromCharSet (10 , acctest .CharSetAlpha )
18+
19+ var basicConfigTestStep = resource.TestStep {
20+ Config : testAccDbtCloudWebhookResourceBasicConfig (webhookName , projectName ),
21+ Check : resource .ComposeTestCheckFunc (
22+ testAccCheckDbtCloudWebhookExists ("dbtcloud_webhook.test_webhook" ),
23+ resource .TestCheckResourceAttr (
24+ "dbtcloud_webhook.test_webhook" ,
25+ "name" ,
26+ webhookName ,
5527 ),
56- }
28+ resource .TestCheckResourceAttrSet (
29+ "dbtcloud_webhook.test_webhook" ,
30+ "hmac_secret" ,
31+ ),
32+ resource .TestCheckResourceAttrSet (
33+ "dbtcloud_webhook.test_webhook" ,
34+ "account_identifier" ,
35+ ),
36+ resource .TestCheckResourceAttr (
37+ "dbtcloud_webhook.test_webhook" ,
38+ "event_types.#" ,
39+ "2" ,
40+ ),
41+ resource .TestCheckResourceAttr (
42+ "dbtcloud_webhook.test_webhook" ,
43+ "job_ids.#" ,
44+ "0" ,
45+ ),
46+ resource .TestCheckResourceAttr (
47+ "dbtcloud_webhook.test_webhook" ,
48+ "client_url" ,
49+ "https://example.com" ,
50+ ),
51+ ),
52+ }
5753
58- var modifyConfigTestStep = resource.TestStep {
59- Config : testAccDbtCloudWebhookResourceFullConfig (webhookName2 , projectName ),
60- Check : resource .ComposeTestCheckFunc (
61- testAccCheckDbtCloudWebhookExists ("dbtcloud_webhook.test_webhook" ),
62- resource .TestCheckResourceAttr (
63- "dbtcloud_webhook.test_webhook" ,
64- "name" ,
65- webhookName2 ,
66- ),
67- resource .TestCheckResourceAttrSet (
68- "dbtcloud_webhook.test_webhook" ,
69- "hmac_secret" ,
70- ),
71- resource .TestCheckResourceAttrSet (
72- "dbtcloud_webhook.test_webhook" ,
73- "account_identifier" ,
74- ),
75- resource .TestCheckResourceAttr (
76- "dbtcloud_webhook.test_webhook" ,
77- "event_types.#" ,
78- "1" ,
79- ),
80- resource .TestCheckResourceAttr (
81- "dbtcloud_webhook.test_webhook" ,
82- "job_ids.#" ,
83- "1" ,
84- ),
85- resource .TestCheckResourceAttr (
86- "dbtcloud_webhook.test_webhook" ,
87- "client_url" ,
88- "https://example.com/test" ,
89- ),
54+ var modifyConfigTestStep = resource.TestStep {
55+ Config : testAccDbtCloudWebhookResourceFullConfig (webhookName2 , projectName ),
56+ Check : resource .ComposeTestCheckFunc (
57+ testAccCheckDbtCloudWebhookExists ("dbtcloud_webhook.test_webhook" ),
58+ resource .TestCheckResourceAttr (
59+ "dbtcloud_webhook.test_webhook" ,
60+ "name" ,
61+ webhookName2 ,
62+ ),
63+ resource .TestCheckResourceAttrSet (
64+ "dbtcloud_webhook.test_webhook" ,
65+ "hmac_secret" ,
66+ ),
67+ resource .TestCheckResourceAttrSet (
68+ "dbtcloud_webhook.test_webhook" ,
69+ "account_identifier" ,
70+ ),
71+ resource .TestCheckResourceAttr (
72+ "dbtcloud_webhook.test_webhook" ,
73+ "event_types.#" ,
74+ "1" ,
75+ ),
76+ resource .TestCheckResourceAttr (
77+ "dbtcloud_webhook.test_webhook" ,
78+ "job_ids.#" ,
79+ "1" ,
9080 ),
81+ resource .TestCheckResourceAttr (
82+ "dbtcloud_webhook.test_webhook" ,
83+ "client_url" ,
84+ "https://example.com/test" ,
85+ ),
86+ ),
87+ }
88+
89+ func TestAccDbtCloudWebhookResource (t * testing.T ) {
90+ if acctest_config .IsDbtCloudPR () {
91+ t .Skip ("Skipping webhooks acceptance in dbt Cloud CI for now" )
9192 }
9293
9394 importStateTestStep := resource.TestStep {
@@ -111,6 +112,9 @@ func TestAccDbtCloudWebhookResource(t *testing.T) {
111112 },
112113 })
113114
115+ }
116+
117+ func TestConfDbtCloudWebhookResource (t * testing.T ) {
114118 // NOTE: we're breaking these down into separate resource.Test()s due to a bug in Terraform test plugin
115119 // Namely, the provider at the step level breaks down, if you try to define the same provider in multiple steps
116120
@@ -133,7 +137,6 @@ func TestAccDbtCloudWebhookResource(t *testing.T) {
133137 acctest_helper .MakeCurrentProviderNoOpTestStep (modifyConfigTestStep ),
134138 },
135139 })
136-
137140}
138141
139142func testAccDbtCloudWebhookResourceBasicConfig (webhookName , projectName string ) string {
0 commit comments