Skip to content

Commit

Permalink
adicionado mockserver
Browse files Browse the repository at this point in the history
  • Loading branch information
JailtonJunior94 committed Mar 1, 2024
1 parent 5a89a57 commit 60fbe62
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 6 deletions.
3 changes: 0 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ func main() {
}

logger := logger.NewLogger(config)
if err != nil {
panic(err)
}
defer logger.Sync()

router := chi.NewRouter()
Expand Down
2 changes: 2 additions & 0 deletions deployment/address-api/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-address-api
annotations:
ingress.kubernetes.io/service-upstream : "true"
spec:
selector:
app: {{ .Release.Name }}-address-api
Expand Down
4 changes: 2 additions & 2 deletions deployment/address-api/values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
application:
replicas: 1
image:
name: "jailtonjunior/address-api"
tag: "v2"
name: jailtonjunior/address-api
tag: v1
configMap:
server:
port: "3000"
Expand Down
49 changes: 49 additions & 0 deletions deployment/config/expectationInitialiser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[
{
"httpRequest": {
"method": "GET",
"path": "/view/cart",
"queryStringParameters": {
"cartId": [
"055CA455-1DF7-45BB-8535-4F83E7266092"
]
}
},
"httpResponse": {
"body": "some_response_body"
}
},
{
"httpRequest": {
"path": "/somePathOne"
},
"httpResponse": {
"statusCode": 200,
"body": {
"value": "one"
}
}
},
{
"httpRequest": {
"path": "/somePathTwo"
},
"httpResponse": {
"statusCode": 200,
"body": {
"value": "Two"
}
}
},
{
"httpRequest": {
"path": "/somePathThree"
},
"httpResponse": {
"statusCode": 200,
"body": {
"value": "Three"
}
}
}
]
15 changes: 14 additions & 1 deletion deployment/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,17 @@ services:
HTTP_SERVER_PORT: "3000"
HTTP_CLIENT_TIMEOUT_MS: 60000
CORREIOS_BASE_URL: https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente?wsdl
VIACEP_BASE_URL: https://viacep.com.br/ws/%s/json/
VIACEP_BASE_URL: https://viacep.com.br/ws/%s/json/

mockserver:
image: mockserver/mockserver
ports:
- "1080:1090"
environment:
MOCKSERVER_LOG_LEVEL: DEBUG
MOCKSERVER_SERVER_PORT: 1090
PROXY_REMOTE_HOST: mockserver-target
PROXY_REMOTE_PORT: 4567
MOCKSERVER_INITIALIZATION_JSON_PATH: /config/expectationInitialiser.json
volumes:
- ./config:/config

0 comments on commit 60fbe62

Please sign in to comment.