Skip to content

Commit

Permalink
Feat: fix the integration test (#854)
Browse files Browse the repository at this point in the history
* Feat: fix the integration test

* modified test and added webhook support

* updated description
  • Loading branch information
TomerHeber committed May 21, 2024
1 parent 4c5ff4b commit 061c442
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions client/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package client
type NotificationType string

const (
NotificationTypeSlack NotificationType = "Slack"
NotificationTypeTeams NotificationType = "Teams"
NotificationTypeEmail NotificationType = "Email"
NotificationTypeSlack NotificationType = "Slack"
NotificationTypeTeams NotificationType = "Teams"
NotificationTypeEmail NotificationType = "Email"
NotificationTypeWebhook NotificationType = "Webhook"
)

type Notification struct {
Expand Down
4 changes: 2 additions & 2 deletions env0/resource_notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ func resourceNotification() *schema.Resource {
},
"type": {
Type: schema.TypeString,
Description: "'Slack', 'Teams' or 'Email'",
Description: "'Slack', 'Teams', 'Email' or 'Webhook'",
Required: true,
ValidateDiagFunc: func(i interface{}, path cty.Path) diag.Diagnostics {
notificationType := client.NotificationType(i.(string))
if notificationType != client.NotificationTypeSlack && notificationType != client.NotificationTypeTeams && notificationType != client.NotificationTypeEmail {
if notificationType != client.NotificationTypeSlack && notificationType != client.NotificationTypeTeams && notificationType != client.NotificationTypeEmail && notificationType != client.NotificationTypeWebhook {
return diag.Errorf("Invalid notification type")
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion env0/resource_notification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestUnitNotificationResource(t *testing.T) {

updatedNotification := client.Notification{
Id: notification.Id,
Type: client.NotificationTypeTeams,
Type: client.NotificationTypeWebhook,
Name: "name0-updated",
Value: "https://some.updated.url.1.com",
OrganizationId: notification.OrganizationId,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/025_notifications/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ locals {

resource "env0_notification" "test_notification_1" {
name = "${local.notification_name_prefix}-1-${random_string.random.result}"
type = "Slack"
type = "Webhook"
value = "https://someurl1.com"
webhook_secret = "my_little_secret"
}
Expand Down

0 comments on commit 061c442

Please sign in to comment.