I am facing Mocking issue when i am trying to use exec method to run command facing challenges while mocking, pls help on it its blocking us to move to next step #5807
Labels
Waiting on feedback
Issues that require feedback from User/Other community members
Describe the bug
Below is the snippet of code , please suggest me how to mock for below code
public String execCommandOnPod(String podName, String namespace, String... cmd) {
Pod pod = client.pods().inNamespace(namespace).withName(podName).get();
System.out.printf("Running command: [%s] on pod [%s] in namespace [%s]%n",
Arrays.toString(cmd), pod.getMetadata().getName(), namespace);
}
private ExecWatch execCmd(Pod pod, CompletableFuture data, String... command) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
return client.pods()
.inNamespace(pod.getMetadata().getNamespace())
.withName(pod.getMetadata().getName())
.writingOutput(baos)
.writingError(baos)
.usingListener(new SimpleListener(data, baos))
.exec(command);
}
static class SimpleListener implements ExecListener {
}
Fabric8 Kubernetes Client version
6.0.0
Steps to reproduce
unable to mock exec result for mentioned snippet of code
Expected behavior
should get output
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
1.25.3@latest
Environment
Windows
Fabric8 Kubernetes Client Logs
Additional context
No response
The text was updated successfully, but these errors were encountered: