public static long calculateTotalFlinkMemoryFromComponents(Configuration config) {
        Preconditions.checkArgument(config.contains(TaskManagerOptions.TASK_HEAP_MEMORY));
        Preconditions.checkArgument(config.contains(TaskManagerOptions.TASK_OFF_HEAP_MEMORY));
        Preconditions.checkArgument(config.contains(TaskManagerOptions.NETWORK_MEMORY_MAX));
        Preconditions.checkArgument(config.contains(TaskManagerOptions.NETWORK_MEMORY_MIN));
        Preconditions.checkArgument(config.contains(TaskManagerOptions.MANAGED_MEMORY_SIZE));
        Preconditions.checkArgument(config.contains(TaskManagerOptions.FRAMEWORK_HEAP_MEMORY));
        Preconditions.checkArgument(config.contains(TaskManagerOptions.FRAMEWORK_OFF_HEAP_MEMORY));
        Preconditions.checkArgument(
                config.get(TaskManagerOptions.NETWORK_MEMORY_MAX)
                        .equals(config.get(TaskManagerOptions.NETWORK_MEMORY_MIN)));
        return config.get(TaskManagerOptions.TASK_HEAP_MEMORY)
                .add(config.get(TaskManagerOptions.TASK_OFF_HEAP_MEMORY))
                .add(config.get(TaskManagerOptions.NETWORK_MEMORY_MAX))
                .add(config.get(TaskManagerOptions.MANAGED_MEMORY_SIZE))
                .add(config.get(TaskManagerOptions.FRAMEWORK_HEAP_MEMORY))
                .add(config.get(TaskManagerOptions.FRAMEWORK_OFF_HEAP_MEMORY))
                .getBytes();
    }
@Test
    void testCalculateTotalFlinkMemoryWithMissingFactors() {
        Configuration config = new Configuration();

        config.set(TaskManagerOptions.FRAMEWORK_HEAP_MEMORY, new MemorySize(1));
        config.set(TaskManagerOptions.FRAMEWORK_OFF_HEAP_MEMORY, new MemorySize(3));
        config.set(TaskManagerOptions.TASK_OFF_HEAP_MEMORY, new MemorySize(4));
        config.set(TaskManagerOptions.MANAGED_MEMORY_SIZE, new MemorySize(7));

        assertThatThrownBy(
                        () ->
                                TaskExecutorResourceUtils.calculateTotalFlinkMemoryFromComponents(
                                        config))
                .isInstanceOf(IllegalArgumentException.class);
    }