bzhaoopenstack commented on code in PR #20498:
URL: https://github.com/apache/flink/pull/20498#discussion_r990964999
##########
flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/Fabric8FlinkKubeClientTest.java:
##########
@@ -630,4 +630,37 @@ private KubernetesConfigMap buildTestingConfigMap() {
.withData(data)
.build());
}
+
+ @Test
+ void testMockPrePreparedResources() throws Exception {
+ // regenerate a test JM spec
+ Deployment testDeployment =
kubernetesJobManagerSpecification.getDeployment();
+ List<HasMetadata> testAccompanyingResources =
+ kubernetesJobManagerSpecification.getAccompanyingResources();
+ List<HasMetadata> mockPrePreparedResources = new ArrayList<>();
+ for (int i = 0; i < 3; i++) {
+ Pod mockPod =
+ new PodBuilder()
+ .editOrNewMetadata()
+
.withName(String.format("mock-pod-preprepared-resource%d", i))
+ .endMetadata()
+ .editOrNewSpec()
+ .endSpec()
+ .build();
+ mockPrePreparedResources.add(mockPod);
+ }
+ KubernetesJobManagerSpecification
testKubernetesJobManagerSpecification =
+ new KubernetesJobManagerSpecification(
+ testDeployment, testAccompanyingResources,
mockPrePreparedResources);
+
flinkKubeClient.createJobManagerComponent(testKubernetesJobManagerSpecification);
+
+ // check the preprepared resources had been created.
+ final List<Pod> resultPods =
kubeClient.pods().inNamespace(NAMESPACE).list().getItems();
+ assertThat(resultPods).hasSize(3);
Review Comment:
This is UT, it won't create any real Pods, just a k8s models objects.
Actually, JM will be created by K8S deployment, the real env, that's true it
should be 4 pods.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]