Skip to content

Commit

Permalink
fix: disable audit webhook in tests (#571)
Browse files Browse the repository at this point in the history
* fix: disable audit webhook in tests

* fix: disable audit webhook in string payload

* fix: use incorrect url for negative path
  • Loading branch information
ilya-hontarau authored Sep 23, 2024
1 parent 3d7ceb4 commit bf3e9c1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions spacelift/resource_audit_trail_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

const auditTrailWebhookSimple = `
resource "spacelift_audit_trail_webhook" "test" {
enabled = true
enabled = false
endpoint = "%s"
include_runs = true
secret = "secret"
Expand All @@ -21,7 +21,7 @@ resource "spacelift_audit_trail_webhook" "test" {

const auditTrailWebhookCustomHeaders = `
resource "spacelift_audit_trail_webhook" "test" {
enabled = true
enabled = false
endpoint = "%s"
include_runs = true
secret = "secret"
Expand All @@ -41,7 +41,7 @@ func Test_resourceAuditTrailWebhook(t *testing.T) {
Config: fmt.Sprintf(auditTrailWebhookSimple, "https://example.com"),
Check: Resource(
resourceName,
Attribute("enabled", Equals("true")),
Attribute("enabled", Equals("false")),
Attribute("endpoint", Equals("https://example.com")),
Attribute("include_runs", Equals("true")),
Attribute("secret", Equals("secret")),
Expand All @@ -56,7 +56,7 @@ func Test_resourceAuditTrailWebhook(t *testing.T) {
Config: fmt.Sprintf(auditTrailWebhookCustomHeaders, "https://example.com"),
Check: Resource(
resourceName,
Attribute("enabled", Equals("true")),
Attribute("enabled", Equals("false")),
Attribute("endpoint", Equals("https://example.com")),
Attribute("include_runs", Equals("true")),
Attribute("secret", Equals("secret")),
Expand All @@ -68,11 +68,11 @@ func Test_resourceAuditTrailWebhook(t *testing.T) {
})
})

t.Run("endpoint has to exist", func(t *testing.T) {
t.Run("endpoint has to be valid", func(t *testing.T) {
testSteps(t, []resource.TestStep{
{
Config: fmt.Sprintf(auditTrailWebhookSimple, "https://invalidendpoint.com/"),
ExpectError: regexp.MustCompile(`could not send webhook to given endpoint`),
Config: fmt.Sprintf(auditTrailWebhookSimple, "https:/invalidendpoint.com/"),
ExpectError: regexp.MustCompile(`endpoint must be a valid URL`),
},
})
})
Expand Down

0 comments on commit bf3e9c1

Please sign in to comment.