diff --git a/test/com/linkedin/drelephant/tuning/PSOParamGeneratorTest.java b/test/com/linkedin/drelephant/tuning/PSOParamGeneratorTest.java index 7dcc2061e..8696e3194 100644 --- a/test/com/linkedin/drelephant/tuning/PSOParamGeneratorTest.java +++ b/test/com/linkedin/drelephant/tuning/PSOParamGeneratorTest.java @@ -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; @@ -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.*; @@ -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() { diff --git a/test/resources/AutoTuningConf.xml b/test/resources/AutoTuningConf.xml index 7797f2045..b505e52ed 100644 --- a/test/resources/AutoTuningConf.xml +++ b/test/resources/AutoTuningConf.xml @@ -19,7 +19,7 @@ autotuning.enabled - true + false Auto Tuning is enabled or not @@ -55,7 +55,7 @@ - + \ No newline at end of file diff --git a/test/rest/RestAPITest.java b/test/rest/RestAPITest.java index 951760053..0a4b44330 100644 --- a/test/rest/RestAPITest.java +++ b/test/rest/RestAPITest.java @@ -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; @@ -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; @@ -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(); @@ -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();