Venkatesh Babu
08/16/2023, 6:43 PM- name: Download WireMock
run: |
wget -O wiremock-standalone.jar <https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-standalone/2.9.0/wiremock-standalone-2.9.0.jar>
- name: Build project with Maven
run: mvn clean install -DskipTests
- name: Start WireMock
id: start-wiremock
run: java -jar wiremock-standalone.jar --port 8081 --root-dir ${{ github.workspace }}/src/main/resources/mappings --verbose --local-response-templating &
# Add additional steps for your tests, if needed
- name: Test Simple Endpoint
run: |
curl <http://localhost:8081/__admin>
curl <http://localhost:8081/__admin/mappings>
curl <http://localhost:8081/simple-endpoint>
continue-on-error: true
I could see in the github actions log that wiremock instance is starting in port 8081 (image has the log confirmation that my wiremock instance has started)
I have the mappings in the directory mentioned /src/main/resources/mappings
contents of the mapping file in the above mentioned directory: simple-mapping.json
{
"request": {
"method": "GET",
"urlPattern": "/simple-endpoint"
},
"response": {
"status": 200,
"body": "This is a simple response from WireMock"
}
}
when I try to hit the urls:
curl <http://localhost:8081/__admin>
curl <http://localhost:8081/__admin/mappings>
curl <http://localhost:8081/simple-endpoint>
I could see that the admin urls are accessible but the mappings are not set and in the logs, I get 404 not found which is reasonable as the mappings are not set but why is it referring to /__files/simple-endpoint
<html>
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 404 </title>
</head>
<body>
<h2>HTTP ERROR: 404</h2>
<p>Problem accessing /__files/simple-endpoint. Reason:
<pre> Not Found</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>
also let me know how can I fix this issue.Tom
08/16/2023, 7:19 PMroot-dir
parameter 1 level too deep. Try chopping the mappings
part of the end.Venkatesh Babu
08/16/2023, 8:13 PM"request": {
"method": "GET",
"urlPattern": "/test-in-int/cars?limit=300"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": "{\n \"limit\":1,\n \"offset\":0,\n \"count\":1,\n \"total\":441,\n \"results\":[\n {\n \"id\":\"e4841772-bb61-4a5d-8715-98c844667a2d\",\n \"version\":474,\n ........
but when I try to call the mock using the pattern mapped, I get the following error (in image).
I do not seem to find answers online except changing urlPattern to urlPathPattern. Do you know what could be the issue with this?Tom
08/16/2023, 8:19 PM"url"
instead of "urlPattern"
Venkatesh Babu
08/16/2023, 8:28 PM