git clone --branch feature/wiremock-tests https://github.com/martinda/http-request-plugin.git
mvn -Dtest=HttpRequestTestWireMock#testWithMock testmvn \
-Dorg.eclipse.jetty.LEVEL=ALL \
-Dorg.apache.commons.logging.simplelog.log.org.apache.http=DEBUG \
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog \
-Dtest=HttpRequestTestWireMock#testWithMock \
testCan you post the stub details, the request you're making and the log output?
wireMockServer.stubFor(get(urlEqualTo("path"))
.willReturn(aResponse()
.withHeader("Content-Type", "text/plain")
.withBody("Hello World")));
// The following is NOT apache's HttpRequest
// It is from: https://github.com/martinda/http-request-plugin/blob/feature/wiremock-tests/src/main/java/jenkins/plugins/http_request/HttpRequest.java
project.getBuildersList().add(new HttpRequest(urlForTest+"path",
HttpMode.GET, "", MimeType.NOT_SET, MimeType.NOT_SET, "",
null, true, false, null, 0, "", ""));
Failed tests:
HttpRequestTestWireMock.testWithMock:96 unexpected build status; build log was:
------
Legacy code started this job. No cause information is available
Building in workspace /tmp/hudson6469019283126156188test/workspace/test0
HttpMode: GET
URL: http://localhost:49152/path
Sending request to url: http://localhost:49152/path
Response Code: HTTP/1.1 404 Not Found
Response:
<html>
<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/path. Reason:
<pre> Not Found</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>
Fail: Any code list ([[100?399]]) match the returned code 404
Build step 'HTTP Request' marked build as failure
Finished: FAILURE
------
Expected: is <SUCCESS>
but: was <FAILURE>
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
Try /path in the stub definition