Skip to content
Open
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ components:
protocol: https
name: quarkus-debug
targetPort: 5005
- exposure: public
protocol: https
name: mockserver
targetPort: 9090
- volume:
size: 10Gi
name: projects
Expand Down Expand Up @@ -104,6 +108,18 @@ commands:
component: dev-tools
workingDir: "${PROJECTS_ROOT}/dev-workspace"
id: init-env
- exec:
commandLine: "./mockserver/scripts/load.sh"
component: dev-tools
workingDir: "${PROJECTS_ROOT}/dev-workspace"
label: "Reload Mock Server Data"
id: load-mock-data
- exec:
commandLine: "java -jar mockserver.jar -serverPort 9090"
component: dev-tools
workingDir: "${PROJECTS_ROOT}/dev-workspace"
label: "Start Prometheus mock server"
id: start-mock-server
events:
preStart:
- cp-oc-cli
Expand Down
Binary file added mockserver.jar
Binary file not shown.
49 changes: 49 additions & 0 deletions mockserver/mockdata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[{
"httpRequest" : {
"path" : "/some/path"
},
"httpResponse" : {
"body" : "some_response_body"
}
},
{
"httpRequest" : {
"path" : "/query",
"method": "GET"
},
"httpResponse" : {
"body" : {
"status": "success",
"data": {
"resultType": "fake",
"result" :
[
{ "metric": {
"name": "deploy_timestamp",
"app": "shop",
"commit": "commitsha",
"image_sha": "sha256:blehdik",
"issue_number": "3"
},
"values": [
[ 1435781451.781, "0" ]
],
"value": [ 1435781451.781, "0" ]
},
{ "metric": {
"name": "deploy_timestamp",
"app": "booking",
"commit": "commitsha",
"image_sha": "sha256:blehdik",
"issue_number": "3"
},
"values": [
[ 1435781451.781, "0" ]
],
"value": [ 1435781451.781, "0" ]
}
]
}
}
}
}]
6 changes: 6 additions & 0 deletions mockserver/scripts/load.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
# reset all data
curl -v -X PUT "http://localhost:9090/mockserver/reset"

# load data from json file
curl -v -X PUT "http://localhost:9090/mockserver/expectation" -d @${PROJECTS_ROOT}/dev-workspace/mockserver/mockdata.json