use of com.github.tomakehurst.wiremock.matching.AnythingPattern in project java by kubernetes-client.
the class CopyTest method testUrl.
@Test
public void testUrl() throws IOException, ApiException, InterruptedException {
Copy copy = new Copy(client);
V1Pod pod = new V1Pod().metadata(new V1ObjectMeta().name(podName).namespace(namespace));
wireMockRule.stubFor(get(urlPathEqualTo("/api/v1/namespaces/" + namespace + "/pods/" + podName + "/exec")).willReturn(aResponse().withStatus(404).withHeader("Content-Type", "application/json").withBody("{}")));
try {
InputStream inputStream = copy.copyFileFromPod(pod, "container", "/some/path/to/file");
// block until the connection is established
inputStream.read();
inputStream.close();
} catch (IOException | ApiException | IllegalStateException e) {
e.printStackTrace();
}
wireMockRule.verify(getRequestedFor(urlPathEqualTo("/api/v1/namespaces/" + namespace + "/pods/" + podName + "/exec")).withQueryParam("stdin", equalTo("false")).withQueryParam("stdout", equalTo("true")).withQueryParam("stderr", equalTo("true")).withQueryParam("tty", equalTo("false")).withQueryParam("command", new AnythingPattern()));
}
Aggregations