/** * Test Cluster.getAssignedMemoryForSlot with a single config value set. * @param key - the config key to set * @param value - the config value to set * @param expectedValue - the expected result */ private void singleValueTest(String key, String value, double expectedValue) { Map<String, Object> topConf = getConfig(key, value); Assert.assertEquals(expectedValue, Cluster.getAssignedMemoryForSlot(topConf), 0); }
@Test public void getAssignedMemoryForSlot_allNull() { Map<String, Object> topConf = getEmptyConfig(); Assert.assertEquals(TOPOLOGY_WORKER_DEFAULT_MEMORY_ALLOCATION, Cluster.getAssignedMemoryForSlot(topConf), 0); }
@Test public void getAssignedMemoryForSlot_workerHeapMemoryMb() { Map<String, Object> topConf = getConfig(Config.WORKER_HEAP_MEMORY_MB, 1024); Assert.assertEquals(1024.0, Cluster.getAssignedMemoryForSlot(topConf), 0); }
@Test public void getAssignedMemoryForSlot_all() { Map<String, Object> topConf = getPopulatedConfig(); Assert.assertEquals(128.0 + 64.0, Cluster.getAssignedMemoryForSlot(topConf), 0); } }
Double assignedMemPerSlot = getAssignedMemoryForSlot(topConf);