static TaskExecutorResourceSpec resourceSpecFromConfig(Configuration config) {
        try {
            checkTaskExecutorResourceConfigSet(config);
        } catch (IllegalConfigurationException e) {
            throw new IllegalConfigurationException("Failed to create TaskExecutorResourceSpec", e);
        }
        return new TaskExecutorResourceSpec(
                new CPUResource(config.get(TaskManagerOptions.CPU_CORES)),
                config.get(TaskManagerOptions.TASK_HEAP_MEMORY),
                config.get(TaskManagerOptions.TASK_OFF_HEAP_MEMORY),
                config.get(TaskManagerOptions.NETWORK_MEMORY_MIN),
                config.get(TaskManagerOptions.MANAGED_MEMORY_SIZE),
                ExternalResourceUtils.getExternalResourcesCollection(config));
    }
@Test
    void testResourceSpecFromConfigFailsIfNetworkSizeIsNotFixed() {
        Configuration configuration = createValidConfig();
        configuration.set(TaskManagerOptions.NETWORK_MEMORY_MIN, MemorySize.ofMebiBytes(1));
        configuration.set(TaskManagerOptions.NETWORK_MEMORY_MAX, MemorySize.ofMebiBytes(2));
        assertThatThrownBy(() -> TaskExecutorResourceUtils.resourceSpecFromConfig(configuration))
                .isInstanceOf(IllegalConfigurationException.class);
    }