Skip to content

Commit

Permalink
Use my own email for email notification integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-asawicki committed Dec 20, 2023
1 parent 2e2387b commit 4cc17d4
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions pkg/resources/email_notification_integration_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package resources_test

import (
"fmt"
"os"
"strings"
"testing"

Expand All @@ -11,12 +10,8 @@ import (
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)

// TODO: use email of our service user
func TestAcc_EmailNotificationIntegration(t *testing.T) {
env := os.Getenv("SKIP_EMAIL_INTEGRATION_TESTS")
if env != "" {
t.Skip("Skipping TestAcc_EmailNotificationIntegration")
}

emailIntegrationName := strings.ToUpper(acctest.RandStringFromCharSet(10, acctest.CharSetAlpha))
verifiedEmail := "[email protected]"

Expand Down Expand Up @@ -62,6 +57,8 @@ Either these email addresses are not yet validated or do not belong to any user
// Snowflake allowed empty allowed recipients in https://docs.snowflake.com/en/release-notes/2023/7_40#email-notification-integrations-allowed-recipients-no-longer-required.
func TestAcc_EmailNotificationIntegration_issue2223(t *testing.T) {
emailIntegrationName := strings.ToUpper(acctest.RandStringFromCharSet(10, acctest.CharSetAlpha))
verifiedEmail := "[email protected]"

resource.Test(t, resource.TestCase{
Providers: acc.TestAccProviders(),
PreCheck: func() { acc.TestAccPreCheck(t) },
Expand All @@ -71,7 +68,21 @@ func TestAcc_EmailNotificationIntegration_issue2223(t *testing.T) {
Config: emailNotificationIntegrationWithoutRecipientsConfig(emailIntegrationName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("snowflake_email_notification_integration.test", "name", emailIntegrationName),
resource.TestCheckNoResourceAttr("snowflake_email_notification_integration.test", "allowed_recipients"),
resource.TestCheckResourceAttr("snowflake_email_notification_integration.test", "allowed_recipients.#", "0"),
),
},
{
Config: emailNotificationIntegrationConfig(emailIntegrationName, verifiedEmail),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("snowflake_email_notification_integration.test", "name", emailIntegrationName),
resource.TestCheckResourceAttr("snowflake_email_notification_integration.test", "allowed_recipients.0", verifiedEmail),
),
},
{
Config: emailNotificationIntegrationWithoutRecipientsConfig(emailIntegrationName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("snowflake_email_notification_integration.test", "name", emailIntegrationName),
resource.TestCheckResourceAttr("snowflake_email_notification_integration.test", "allowed_recipients.#", "0"),
),
},
},
Expand Down

0 comments on commit 4cc17d4

Please sign in to comment.