Skip to content

Commit

Permalink
Bug fix: Auto tuning disable model unit test failure (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
arpang authored and akshayrai committed Mar 1, 2018
1 parent 79bb59f commit fe076f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.linkedin.drelephant.DrElephant;
import com.linkedin.drelephant.ElephantContext;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -35,6 +37,8 @@
import play.GlobalSettings;
import play.libs.Json;
import play.test.FakeApplication;
import org.apache.hadoop.conf.Configuration;


import static common.DBTestUtil.*;
import static common.TestConstants.*;
Expand Down Expand Up @@ -64,6 +68,9 @@ public void onStart(Application app) {
};

fakeApp = fakeApplication(dbConn, gs);
Configuration configuration = ElephantContext.instance().getAutoTuningConf();
Boolean autoTuningEnabled = configuration.getBoolean(DrElephant.AUTO_TUNING_ENABLED, false);
org.junit.Assume.assumeTrue(autoTuningEnabled);
}

private void populateTestData() {
Expand Down
4 changes: 2 additions & 2 deletions test/resources/AutoTuningConf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<configuration>
<property>
<name>autotuning.enabled</name>
<value>true</value>
<value>false</value>
<description>Auto Tuning is enabled or not</description>
</property>
<property>
Expand Down Expand Up @@ -55,7 +55,7 @@
<!--The below property is optional-->
<!--<property>-->
<!--<name>python.path</name>-->
<!--<value>/usr/bin/python</value>-->
<!--<value>/path/to/python/binary</value>-->
<!--<description>Root directory for python</description>-->
<!--</property>-->
</configuration>
11 changes: 11 additions & 0 deletions test/rest/RestAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.linkedin.drelephant.AutoTuner;
import com.linkedin.drelephant.DrElephant;
import com.linkedin.drelephant.ElephantContext;
import com.linkedin.drelephant.tuning.BaselineComputeUtil;
import com.linkedin.drelephant.tuning.FitnessComputeUtil;
import com.linkedin.drelephant.tuning.JobCompleteDetector;
Expand All @@ -44,6 +46,7 @@
import models.TuningJobExecution;
import models.TuningJobExecution.ParamSetStatus;

import org.apache.hadoop.conf.Configuration;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -128,6 +131,10 @@ public void run() {

@Test
public void testRestGetCurrentRunParameters() {
Configuration configuration = ElephantContext.instance().getAutoTuningConf();
Boolean autoTuningEnabled = configuration.getBoolean(DrElephant.AUTO_TUNING_ENABLED, false);
org.junit.Assume.assumeTrue(autoTuningEnabled);

running(testServer(TEST_SERVER_PORT, fakeApp), new Runnable() {
public void run() {
populateAutoTuningTestData1();
Expand Down Expand Up @@ -178,6 +185,10 @@ public void run() {

@Test
public void testRestGetCurrentRunParametersNewJob() {
Configuration configuration = ElephantContext.instance().getAutoTuningConf();
Boolean autoTuningEnabled = configuration.getBoolean(DrElephant.AUTO_TUNING_ENABLED, false);
org.junit.Assume.assumeTrue(autoTuningEnabled);

running(testServer(TEST_SERVER_PORT, fakeApp), new Runnable() {
public void run() {
populateAutoTuningTestData1();
Expand Down

0 comments on commit fe076f7

Please sign in to comment.