|
67 | 67 | import java.util.Collections; |
68 | 68 | import java.util.List; |
69 | 69 | import java.util.Map; |
| 70 | +import java.util.stream.Stream; |
70 | 71 |
|
71 | 72 | import static org.apache.flink.configuration.DeploymentOptions.SHUTDOWN_ON_APPLICATION_FINISH; |
72 | 73 | import static org.apache.flink.kubernetes.operator.api.utils.BaseTestUtils.IMAGE; |
@@ -381,14 +382,27 @@ private PodTemplateSpec getTmPod(Configuration configuration) throws IOException |
381 | 382 | PodTemplateSpec.class); |
382 | 383 | } |
383 | 384 |
|
384 | | - @Test |
385 | | - public void testApplyIngressDomain() { |
| 385 | + @ParameterizedTest |
| 386 | + @MethodSource("serviceExposedTypes") |
| 387 | + public void testApplyIngressDomain( |
| 388 | + KubernetesConfigOptions.ServiceExposedType serviceExposedType) { |
| 389 | + |
386 | 390 | final Configuration configuration = |
387 | | - new FlinkConfigBuilder(flinkDeployment, new Configuration()) |
| 391 | + new FlinkConfigBuilder( |
| 392 | + flinkDeployment, |
| 393 | + serviceExposedType == null |
| 394 | + ? new Configuration() |
| 395 | + : new Configuration() |
| 396 | + .set( |
| 397 | + KubernetesConfigOptions |
| 398 | + .REST_SERVICE_EXPOSED_TYPE, |
| 399 | + serviceExposedType)) |
388 | 400 | .applyIngressDomain() |
389 | 401 | .build(); |
390 | 402 | assertEquals( |
391 | | - KubernetesConfigOptions.ServiceExposedType.ClusterIP, |
| 403 | + serviceExposedType == null |
| 404 | + ? KubernetesConfigOptions.ServiceExposedType.ClusterIP |
| 405 | + : serviceExposedType, |
392 | 406 | configuration.get(KubernetesConfigOptions.REST_SERVICE_EXPOSED_TYPE)); |
393 | 407 | } |
394 | 408 |
|
@@ -961,4 +975,13 @@ private PodTemplateSpec createTestPodWithContainers() { |
961 | 975 | TestUtils.getTestPodTemplate("hostname", List.of(mainContainer, sideCarContainer)); |
962 | 976 | return pod; |
963 | 977 | } |
| 978 | + |
| 979 | + private static Stream<KubernetesConfigOptions.ServiceExposedType> serviceExposedTypes() { |
| 980 | + return Stream.of( |
| 981 | + null, |
| 982 | + KubernetesConfigOptions.ServiceExposedType.ClusterIP, |
| 983 | + KubernetesConfigOptions.ServiceExposedType.LoadBalancer, |
| 984 | + KubernetesConfigOptions.ServiceExposedType.Headless_ClusterIP, |
| 985 | + KubernetesConfigOptions.ServiceExposedType.NodePort); |
| 986 | + } |
964 | 987 | } |
0 commit comments