public static TaskExecutorProcessSpec processSpecFromConfig(final Configuration config) {
        try {
            return createMemoryProcessSpec(
                    config, PROCESS_MEMORY_UTILS.memoryProcessSpecFromConfig(config));
        } catch (IllegalConfigurationException e) {
            throw new IllegalConfigurationException(
                    "TaskManager memory configuration failed: " + e.getMessage(), e);
        }
    }
@Test
    public void testConsistencyCheckOfDerivedNetworkMemoryDoesNotMatchLegacyConfigFails() {
        final int numberOfNetworkBuffers = 10;
        final int pageSizeMb = 16;
        // derive network memory which is bigger than the number of legacy network buffers
        final int networkMemorySizeMbToDerive = pageSizeMb * (numberOfNetworkBuffers + 1);
        final Configuration configuration =
                setupConfigWithFlinkAndTaskHeapToDeriveGivenNetworkMem(networkMemorySizeMbToDerive);
        configuration.set(
                TaskManagerOptions.MEMORY_SEGMENT_SIZE, MemorySize.ofMebiBytes(pageSizeMb));
        configuration.set(
                NettyShuffleEnvironmentOptions.NETWORK_NUM_BUFFERS, numberOfNetworkBuffers);
        // internal validation should fail
        assertThatExceptionOfType(IllegalConfigurationException.class)
                .isThrownBy(() -> TaskExecutorProcessUtils.processSpecFromConfig(configuration));
    }