Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable audit webhook in tests #571

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading