Skip to content

Commit 892fc25

Browse files
AchoArnoldCopilot
andcommitted
fix: use wiremock.local alias to pass URL validation in webhook tests
The govalidator URL regex requires at least one dot in the hostname. Use a Docker network alias 'wiremock.local' for webhook URLs so they pass validation and remain reachable from the API container. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e912092 commit 892fc25

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

tests/docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ services:
3131
- "8080:8080"
3232
volumes:
3333
- ./wiremock/mappings:/home/wiremock/mappings:ro
34+
networks:
35+
default:
36+
aliases:
37+
- wiremock.local
3438
healthcheck:
3539
test: ["CMD", "curl", "-f", "http://localhost:8080/__admin/health"]
3640
interval: 5s

tests/helpers_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ import (
2222
)
2323

2424
const (
25-
apiBaseURL = "http://localhost:8000"
26-
wiremockURL = "http://localhost:8080"
27-
userAPIKey = "test-user-api-key"
25+
apiBaseURL = "http://localhost:8000"
26+
wiremockURL = "http://localhost:8080"
27+
wiremockWebhookURL = "http://wiremock.local:8080" // reachable from API container, passes URL validation (needs a dot)
28+
userAPIKey = "test-user-api-key"
2829
)
2930

3031
type testPhone struct {
@@ -119,7 +120,7 @@ func setupWebhook(ctx context.Context, t *testing.T, phoneNumber string, events
119120

120121
signingKey = randomEncryptionKey()
121122
webhookPath = "/webhooks/" + uuid.New().String()
122-
webhookURL := wiremockURL + webhookPath
123+
webhookURL := wiremockWebhookURL + webhookPath
123124

124125
client := newAPIClient()
125126
_, resp, err := client.Webhooks.Store(ctx, &httpsms.WebhookStoreParams{

0 commit comments

Comments
 (0)