Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: Auto tuning disable model unit test failure #343

Merged
merged 1 commit into from
Mar 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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