Skip to content

Commit

Permalink
Refactor WireMock mappings/files, reset before tests
Browse files Browse the repository at this point in the history
  • Loading branch information
impl committed Apr 10, 2022
1 parent c3898c9 commit 86a763b
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 87 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ test-unit: ## Run unit tests

test-acc: dev-up ## Run acceptance tests
${call print, "Running acceptance tests"}
@docker-compose exec -- auth0 curl -4 -sS -o /dev/null -X POST http://localhost:8080/__admin/scenarios/reset
@TF_ACC=1 go test ${GO_PACKAGES} -v $(TESTARGS) -timeout 120m -coverprofile="${GO_TEST_COVERAGE_FILE}"

test-sweep: ## Clean up test tenant
Expand All @@ -118,6 +119,7 @@ test-sweep: ## Clean up test tenant
dev-up: ## Bootstrap the development containers
${call print, "Starting development containers"}
@docker-compose up -d
@docker-compose exec -- auth0 curl -4 --retry-connrefused --retry 15 --retry-delay 2 -sS -o /dev/null -X POST http://localhost:8080/__admin/mappings/reset

dev-down: ## Bring down the development containers
${call print, "Bringing the development containers down"}
Expand Down
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ version: "3.8"

services:
auth0:
build:
context: .
dockerfile: dockerfiles/wiremock/Dockerfile
command: --port 8080 --verbose
image: wiremock/wiremock:2.30.0
volumes:
- ./dockerfiles/wiremock/__files:/home/wiremock/__files
- ./dockerfiles/wiremock/mappings:/home/wiremock/mappings
command: --port 8080 --verbose --global-response-templating
expose:
- "8080"
ports:
Expand Down
5 changes: 0 additions & 5 deletions dockerfiles/wiremock/Dockerfile

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"custom_domain_id": "cd_auth0managed",
"domain": "terraform-provider.auth0.com",
"primary": true,
"status": "{{parameters.status}}",
"type": "auth0_managed_certs",
{{#eq parameters.status "ready"}}
"origin_domain_name": "terraform-provider-cd-auth0managed.edge.tenants.eu.auth0.com",
{{/eq}}
"verification": {
"methods": [
{
"name": "cname",
"record": "terraform-provider-cd-auth0managed.edge.tenants.eu.auth0.com"
}
]
},
"tls_policy": "recommended"
}
16 changes: 0 additions & 16 deletions dockerfiles/wiremock/__files/custom_domain_verified.json

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"request": {
"method": "DELETE",
"url": "/api/v2/custom-domains/cd_fakecustomdomain"
"url": "/api/v2/custom-domains/cd_auth0managed"
},
"response": {
"status": 204
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"scenarioName": "Custom domain verification with Auth0-managed certificates",
"requiredScenarioState": "Started",
"request": {
"method": "GET",
"url": "/api/v2/custom-domains/cd_auth0managed"
},
"response": {
"status": 200,
"bodyFileName": "custom_domain_verification/cd_auth0managed.json",
"headers": {
"Content-Type": "application/json"
},
"transformerParameters": {
"status": "pending_verification"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"scenarioName": "Custom domain verification with Auth0-managed certificates",
"requiredScenarioState": "Verified",
"request": {
"method": "GET",
"url": "/api/v2/custom-domains/cd_auth0managed"
},
"response": {
"status": 200,
"bodyFileName": "custom_domain_verification/cd_auth0managed.json",
"headers": {
"Content-Type": "application/json"
},
"transformerParameters": {
"status": "ready"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
},
"response": {
"status": 201,
"bodyFileName": "custom_domain_with_pending_verification.json",
"bodyFileName": "custom_domain_verification/cd_auth0managed.json",
"headers": {
"Content-Type": "application/json"
},
"transformerParameters": {
"status": "pending_verification"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"scenarioName": "Custom domain verification with Auth0-managed certificates",
"requiredScenarioState": "Started",
"newScenarioState": "Verified",
"request": {
"method": "POST",
"url": "/api/v2/custom-domains/cd_auth0managed/verify"
},
"response": {
"status": 201,
"bodyFileName": "custom_domain_verification/cd_auth0managed.json",
"headers": {
"Content-Type": "application/json"
},
"transformerParameters": {
"status": "ready"
}
}
}
16 changes: 0 additions & 16 deletions dockerfiles/wiremock/mappings/get_custom_domain_pending_200.json

This file was deleted.

15 changes: 0 additions & 15 deletions dockerfiles/wiremock/mappings/get_custom_domain_ready_200.json

This file was deleted.

13 changes: 0 additions & 13 deletions dockerfiles/wiremock/mappings/post_custom_domain_verify_200.json

This file was deleted.

0 comments on commit 86a763b

Please sign in to comment.