-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #261 from dbt-labs/update-testing-ci
- Loading branch information
Showing
13 changed files
with
169 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,16 @@ import ( | |
|
||
func TestAccDbtCloudNotificationDataSource(t *testing.T) { | ||
|
||
var userID string | ||
if acctest_helper.IsDbtCloudPR() { | ||
userID = "1" | ||
} else { | ||
userID = "100" | ||
} | ||
|
||
randomProjectName := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) | ||
|
||
config := notification(randomProjectName) | ||
config := notification(randomProjectName, userID) | ||
|
||
check := resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr( | ||
|
@@ -43,7 +50,7 @@ func TestAccDbtCloudNotificationDataSource(t *testing.T) { | |
}) | ||
} | ||
|
||
func notification(projectName string) string { | ||
func notification(projectName, userID string) string { | ||
return fmt.Sprintf(` | ||
resource "dbtcloud_project" "test_notification_project" { | ||
name = "%s" | ||
|
@@ -71,7 +78,7 @@ func notification(projectName string) string { | |
} | ||
resource "dbtcloud_notification" "test_notification_external" { | ||
user_id = 100 | ||
user_id = %s | ||
on_failure = [dbtcloud_job.test_notification_job_1.id] | ||
notification_type = 4 | ||
external_email = "[email protected]" | ||
|
@@ -80,5 +87,5 @@ func notification(projectName string) string { | |
data "dbtcloud_notification" "test_notification_external" { | ||
notification_id = dbtcloud_notification.test_notification_external.id | ||
} | ||
`, projectName, acctest_helper.DBT_CLOUD_VERSION) | ||
`, projectName, acctest_helper.DBT_CLOUD_VERSION, userID) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,13 @@ import ( | |
|
||
func TestAccDbtCloudNotificationResource(t *testing.T) { | ||
|
||
var userID string | ||
if acctest_helper.IsDbtCloudPR() { | ||
userID = "1" | ||
} else { | ||
userID = "100" | ||
} | ||
|
||
projectName := strings.ToUpper(acctest.RandStringFromCharSet(10, acctest.CharSetAlpha)) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
|
@@ -23,7 +30,7 @@ func TestAccDbtCloudNotificationResource(t *testing.T) { | |
CheckDestroy: testAccCheckDbtCloudNotificationDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccDbtCloudNotificationResourceCreateNotifications(projectName), | ||
Config: testAccDbtCloudNotificationResourceCreateNotifications(projectName, userID), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckDbtCloudNotificationExists( | ||
"dbtcloud_notification.test_notification_internal", | ||
|
@@ -71,7 +78,7 @@ func TestAccDbtCloudNotificationResource(t *testing.T) { | |
}, | ||
// MODIFY | ||
{ | ||
Config: testAccDbtCloudNotificationResourceModifyNotifications(projectName), | ||
Config: testAccDbtCloudNotificationResourceModifyNotifications(projectName, userID), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckDbtCloudNotificationExists( | ||
"dbtcloud_notification.test_notification_internal", | ||
|
@@ -150,46 +157,46 @@ resource "dbtcloud_job" "test_notification_job_2" { | |
`, projectName, acctest_helper.DBT_CLOUD_VERSION) | ||
} | ||
|
||
func testAccDbtCloudNotificationResourceCreateNotifications(projectName string) string { | ||
func testAccDbtCloudNotificationResourceCreateNotifications(projectName, userID string) string { | ||
|
||
notificationsConfig := ` | ||
notificationsConfig := fmt.Sprintf(` | ||
resource "dbtcloud_notification" "test_notification_internal" { | ||
user_id = 100 | ||
user_id = %s | ||
on_success = [dbtcloud_job.test_notification_job_1.id] | ||
on_failure = [dbtcloud_job.test_notification_job_2.id] | ||
on_cancel = [dbtcloud_job.test_notification_job_1.id, dbtcloud_job.test_notification_job_2.id] | ||
notification_type = 1 | ||
} | ||
resource "dbtcloud_notification" "test_notification_external" { | ||
user_id = 100 | ||
user_id = %s | ||
on_failure = [dbtcloud_job.test_notification_job_2.id] | ||
notification_type = 4 | ||
external_email = "[email protected]" | ||
} | ||
` | ||
`, userID, userID) | ||
return testAccDbtCloudNotificationResourceBasicConfig(projectName) + "\n" + notificationsConfig | ||
} | ||
|
||
func testAccDbtCloudNotificationResourceModifyNotifications(projectName string) string { | ||
func testAccDbtCloudNotificationResourceModifyNotifications(projectName, userID string) string { | ||
|
||
notificationsConfig := ` | ||
notificationsConfig := fmt.Sprintf(` | ||
resource "dbtcloud_notification" "test_notification_internal" { | ||
user_id = 100 | ||
user_id = %s | ||
on_success = [dbtcloud_job.test_notification_job_1.id] | ||
on_failure = [dbtcloud_job.test_notification_job_2.id] | ||
on_cancel = [] | ||
notification_type = 1 | ||
} | ||
resource "dbtcloud_notification" "test_notification_external" { | ||
user_id = 100 | ||
user_id = %s | ||
on_failure = [dbtcloud_job.test_notification_job_2.id] | ||
on_cancel = [dbtcloud_job.test_notification_job_1.id] | ||
notification_type = 4 | ||
external_email = "[email protected]" | ||
} | ||
` | ||
`, userID, userID) | ||
return testAccDbtCloudNotificationResourceBasicConfig(projectName) + "\n" + notificationsConfig | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,13 @@ import ( | |
|
||
func TestAccDbtCloudPartialNotificationResource(t *testing.T) { | ||
|
||
var userID string | ||
if acctest_helper.IsDbtCloudPR() { | ||
userID = "1" | ||
} else { | ||
userID = "100" | ||
} | ||
|
||
projectName := strings.ToUpper(acctest.RandStringFromCharSet(10, acctest.CharSetAlpha)) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
|
@@ -24,6 +31,7 @@ func TestAccDbtCloudPartialNotificationResource(t *testing.T) { | |
{ | ||
Config: testAccDbtCloudPartialNotificationResourceCreatePartialNotifications( | ||
projectName, | ||
userID, | ||
), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckDbtCloudPartialNotificationExists( | ||
|
@@ -74,6 +82,7 @@ func TestAccDbtCloudPartialNotificationResource(t *testing.T) { | |
{ | ||
Config: testAccDbtCloudPartialNotificationResourceModifyPartialNotifications( | ||
projectName, | ||
userID, | ||
), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckDbtCloudPartialNotificationExists( | ||
|
@@ -150,59 +159,59 @@ resource "dbtcloud_job" "test_notification_job_2" { | |
} | ||
|
||
func testAccDbtCloudPartialNotificationResourceCreatePartialNotifications( | ||
projectName string, | ||
projectName, userID string, | ||
) string { | ||
|
||
notificationsConfig := ` | ||
notificationsConfig := fmt.Sprintf(` | ||
resource "dbtcloud_partial_notification" "test_notification_internal" { | ||
user_id = 100 | ||
user_id = %s | ||
on_success = [dbtcloud_job.test_notification_job_1.id] | ||
on_failure = [dbtcloud_job.test_notification_job_2.id] | ||
on_cancel = [dbtcloud_job.test_notification_job_1.id, dbtcloud_job.test_notification_job_2.id] | ||
notification_type = 1 | ||
} | ||
resource "dbtcloud_partial_notification" "test_notification_external" { | ||
user_id = 100 | ||
user_id = %s | ||
on_failure = [dbtcloud_job.test_notification_job_2.id] | ||
notification_type = 4 | ||
external_email = "[email protected]" | ||
} | ||
` | ||
`, userID, userID) | ||
return testAccDbtCloudPartialNotificationResourceBasicConfig( | ||
projectName, | ||
) + "\n" + notificationsConfig | ||
} | ||
|
||
func testAccDbtCloudPartialNotificationResourceModifyPartialNotifications( | ||
projectName string, | ||
projectName, userID string, | ||
) string { | ||
|
||
notificationsConfig := ` | ||
notificationsConfig := fmt.Sprintf(` | ||
resource "dbtcloud_partial_notification" "test_notification_internal" { | ||
user_id = 100 | ||
user_id = %s | ||
on_success = [dbtcloud_job.test_notification_job_1.id] | ||
on_failure = [dbtcloud_job.test_notification_job_2.id] | ||
on_cancel = [] | ||
notification_type = 1 | ||
} | ||
resource "dbtcloud_partial_notification" "test_notification_external" { | ||
user_id = 100 | ||
user_id = %s | ||
on_failure = [dbtcloud_job.test_notification_job_2.id] | ||
on_cancel = [dbtcloud_job.test_notification_job_1.id] | ||
notification_type = 4 | ||
external_email = "[email protected]" | ||
} | ||
resource "dbtcloud_partial_notification" "test_notification_external2" { | ||
user_id = 100 | ||
user_id = %s | ||
on_success = [dbtcloud_job.test_notification_job_1.id, dbtcloud_job.test_notification_job_2.id] | ||
notification_type = 4 | ||
external_email = "[email protected]" | ||
depends_on = [dbtcloud_partial_notification.test_notification_external] | ||
} | ||
` | ||
`, userID, userID, userID) | ||
return testAccDbtCloudPartialNotificationResourceBasicConfig( | ||
projectName, | ||
) + "\n" + notificationsConfig | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.