未验证 提交 c7b91192 编写于 作者: S Sanjeev Kulkarni 提交者: GitHub

Mock out the settting up k8 client part (#2726)

上级 90c365c1
......@@ -141,7 +141,8 @@ public class KubernetesRuntimeFactory implements RuntimeFactory {
KubernetesRuntime.doChecks(functionDetails);
}
private void setupClient() throws Exception {
@VisibleForTesting
void setupClient() throws Exception {
if (appsClient == null) {
if (k8Uri == null) {
log.info("k8Uri is null thus going by defaults");
......
......@@ -32,6 +32,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.powermock.api.mockito.PowerMockito.doNothing;
import static org.powermock.api.mockito.PowerMockito.spy;
import static org.testng.Assert.assertEquals;
/**
......@@ -67,8 +69,9 @@ public class KubernetesRuntimeTest {
this.pulsarAdminUrl = "http://localhost:8080";
this.stateStorageServiceUrl = "bk://localhost:4181";
this.logDirectory = "logs/functions";
this.factory = new KubernetesRuntimeFactory(null, null, null, null,
false, null, pulsarServiceUrl, pulsarAdminUrl, stateStorageServiceUrl, null);
this.factory = spy(new KubernetesRuntimeFactory(null, null, null, null,
false, null, pulsarServiceUrl, pulsarAdminUrl, stateStorageServiceUrl, null));
doNothing().when(this.factory).setupClient();
}
@AfterMethod
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册