use of org.apache.flink.kubernetes.kubeclient.FlinkPod in project flink by apache.
the class CmdTaskManagerDecoratorTest method testTaskManagerJvmMemOptsEnv.
@Test
public void testTaskManagerJvmMemOptsEnv() {
final FlinkPod resultFlinkPod = cmdTaskManagerDecorator.decorateFlinkPod(baseFlinkPod);
assertThat(resultFlinkPod.getMainContainer().getEnv(), contains(new EnvVarBuilder().withName(Constants.ENV_TM_JVM_MEM_OPTS).withValue(JVM_MEM_OPTS_ENV).build()));
}
use of org.apache.flink.kubernetes.kubeclient.FlinkPod in project flink by apache.
the class CmdTaskManagerDecoratorTest method testTaskManagerStartCommandsAndArgs.
@Test
public void testTaskManagerStartCommandsAndArgs() {
final FlinkPod resultFlinkPod = cmdTaskManagerDecorator.decorateFlinkPod(baseFlinkPod);
final String entryCommand = flinkConfig.get(KubernetesConfigOptions.KUBERNETES_ENTRY_PATH);
assertThat(resultFlinkPod.getMainContainer().getCommand(), containsInAnyOrder(entryCommand));
List<String> flinkCommands = KubernetesUtils.getStartCommandWithBashWrapper(Constants.KUBERNETES_TASK_MANAGER_SCRIPT_PATH + " " + DYNAMIC_PROPERTIES + " " + mainClassArgs);
assertThat(resultFlinkPod.getMainContainer().getArgs(), contains(flinkCommands.toArray()));
}
use of org.apache.flink.kubernetes.kubeclient.FlinkPod in project flink by apache.
the class EnvSecretsDecoratorTest method testWhetherPodOrContainerIsDecorated.
@Test
public void testWhetherPodOrContainerIsDecorated() {
final FlinkPod resultFlinkPod = envSecretsDecorator.decorateFlinkPod(baseFlinkPod);
List<EnvVar> envVarList = resultFlinkPod.getMainContainer().getEnv();
assertEquals(1, envVarList.size());
assertEquals(ENV_NAME, envVarList.get(0).getName());
}
use of org.apache.flink.kubernetes.kubeclient.FlinkPod in project flink by apache.
the class FlinkConfMountDecoratorTest method testDecoratedFlinkPodWithLog4jAndLogback.
@Test
public void testDecoratedFlinkPodWithLog4jAndLogback() throws IOException {
KubernetesTestUtils.createTemporyFile("some data", flinkConfDir, CONFIG_FILE_LOG4J_NAME);
KubernetesTestUtils.createTemporyFile("some data", flinkConfDir, CONFIG_FILE_LOGBACK_NAME);
final FlinkPod resultFlinkPod = flinkConfMountDecorator.decorateFlinkPod(baseFlinkPod);
final List<KeyToPath> expectedKeyToPaths = Arrays.asList(new KeyToPathBuilder().withKey(CONFIG_FILE_LOGBACK_NAME).withPath(CONFIG_FILE_LOGBACK_NAME).build(), new KeyToPathBuilder().withKey(CONFIG_FILE_LOG4J_NAME).withPath(CONFIG_FILE_LOG4J_NAME).build(), new KeyToPathBuilder().withKey(FLINK_CONF_FILENAME).withPath(FLINK_CONF_FILENAME).build());
final List<Volume> expectedVolumes = Collections.singletonList(new VolumeBuilder().withName(Constants.FLINK_CONF_VOLUME).withNewConfigMap().withName(getFlinkConfConfigMapName(CLUSTER_ID)).withItems(expectedKeyToPaths).endConfigMap().build());
assertEquals(expectedVolumes, resultFlinkPod.getPodWithoutMainContainer().getSpec().getVolumes());
}
use of org.apache.flink.kubernetes.kubeclient.FlinkPod in project flink by apache.
the class FlinkConfMountDecoratorTest method testDecoratedFlinkPodWithLog4j.
@Test
public void testDecoratedFlinkPodWithLog4j() throws IOException {
KubernetesTestUtils.createTemporyFile("some data", flinkConfDir, CONFIG_FILE_LOG4J_NAME);
final FlinkPod resultFlinkPod = flinkConfMountDecorator.decorateFlinkPod(baseFlinkPod);
final List<KeyToPath> expectedKeyToPaths = Arrays.asList(new KeyToPathBuilder().withKey(CONFIG_FILE_LOG4J_NAME).withPath(CONFIG_FILE_LOG4J_NAME).build(), new KeyToPathBuilder().withKey(FLINK_CONF_FILENAME).withPath(FLINK_CONF_FILENAME).build());
final List<Volume> expectedVolumes = Collections.singletonList(new VolumeBuilder().withName(Constants.FLINK_CONF_VOLUME).withNewConfigMap().withName(getFlinkConfConfigMapName(CLUSTER_ID)).withItems(expectedKeyToPaths).endConfigMap().build());
assertEquals(expectedVolumes, resultFlinkPod.getPodWithoutMainContainer().getSpec().getVolumes());
}
Aggregations