Skip to content

Commit

Permalink
Unit testing for IPSO Manager
Browse files Browse the repository at this point in the history
  • Loading branch information
pralabhkumar committed Jul 27, 2018
1 parent 2580abc commit 028321d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.linkedin.drelephant.tuning;

import java.util.List;
import java.util.Map;
import models.AppResult;
import models.JobDefinition;
import models.JobSuggestedParamSet;
Expand All @@ -39,7 +40,7 @@ public interface AutoTuningOptimizeManager {
Extract parameter Information of previous executions
calls after each exectuion of flow
*/
public void extractParameterInformation(List<AppResult> appResults);
public Map<String, Map<String, Double>> extractParameterInformation(List<AppResult> appResults);

/*
Optimize search space
Expand Down
3 changes: 2 additions & 1 deletion app/com/linkedin/drelephant/tuning/IPSOManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void setDefaultParameterValues(TuningAlgorithm tuningAlgorithm, JobSugge
}

@Override
public void extractParameterInformation(List<AppResult> appResults) {
public Map<String, Map<String, Double>> extractParameterInformation(List<AppResult> appResults) {
logger.info(" Extract Parameter Information");
usageDataGlobal = new HashMap<String, Map<String, Double>>();
intialize();
Expand All @@ -90,6 +90,7 @@ public void extractParameterInformation(List<AppResult> appResults) {
}
logger.debug("Usage Values Global ");
printInformation(usageDataGlobal);
return usageDataGlobal;
}

private void intialize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,19 @@ public class ConfigurationHeuristicTest extends TestCase {
paramMap));

@Test
public void testRuntimeCritical() throws IOException {
public void testConfigurations() throws IOException {
List<HeuristicResultDetails> results = analyzeJob().getHeuristicResultDetails();
assertTrue(
results.get(0).getName().equals(CommonConstantsHeuristic.ParameterKeys.MAPPER_MEMORY_HEURISTICS_CONF.getValue())
&& results.get(0).getValue().equals("2048"));
assertTrue(
results.get(1).getName().equals(CommonConstantsHeuristic.ParameterKeys.MAPPER_HEAP_HEURISTICS_CONF.getValue())
&& results.get(1).getValue().equals("1536"));
assertTrue(
results.get(2).getName().equals(CommonConstantsHeuristic.ParameterKeys.REDUCER_MEMORY_HEURISTICS_CONF.getValue())
&& results.get(2).getValue().equals("3072"));
assertTrue(results.get(2)
.getName()
.equals(CommonConstantsHeuristic.ParameterKeys.REDUCER_MEMORY_HEURISTICS_CONF.getValue()) && results.get(2)
.getValue()
.equals("3072"));
assertTrue(
results.get(3).getName().equals(CommonConstantsHeuristic.ParameterKeys.REDUCER_HEAP_HEURISTICS_CONF.getValue())
&& results.get(3).getValue().equals("2536"));
Expand Down
8 changes: 6 additions & 2 deletions test/common/DBTestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@
import play.db.DB;

import static common.TestConstants.TEST_DATA_FILE;
import static common.TestConstants.TEST_AUTO_TUNING_DATA_FILE1;;

import static common.TestConstants.TEST_AUTO_TUNING_DATA_FILE1;
import static common.TestConstants.TEST_IPSO_DATA_FILE;

public class DBTestUtil {

public static void initDBIPSO() throws IOException, SQLException {
initDBUtil(TEST_IPSO_DATA_FILE);
}

public static void initDB() throws IOException, SQLException {
initDBUtil(TEST_DATA_FILE);
}
Expand Down
1 change: 1 addition & 0 deletions test/common/TestConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class TestConstants {
public static final int TEST_SERVER_PORT = 9001;
public static final String BASE_URL = "http://localhost:" + TEST_SERVER_PORT;
public static final String TEST_DATA_FILE = "test/resources/test-init.sql";
public static final String TEST_IPSO_DATA_FILE = "test/resources/test-init-ipso.sql";
public static final String TEST_AUTO_TUNING_DATA_FILE1 = "test/resources/tunein-test1.sql";

public static final int RESPONSE_TIMEOUT = 3000; // milliseconds
Expand Down

0 comments on commit 028321d

Please sign in to comment.