Skip to content
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 @@ -24,7 +24,9 @@
import org.apache.hadoop.yarn.server.resourcemanager.monitor.invariants.MetricsInvariantChecker;
import org.junit.After;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
Expand All @@ -35,6 +37,8 @@
import java.util.List;
import java.util.UUID;

import javax.script.ScriptEngineManager;

/**
* This is a base class to ease the implementation of SLS-based tests.
*/
Expand All @@ -59,6 +63,12 @@ public abstract class BaseSLSRunnerTest {
protected String ongoingInvariantFile;
protected String exitInvariantFile;

@BeforeClass
public static void checkForJavaScript() {
Assume.assumeNotNull("JavaScript engine not available (JEP 372)",
new ScriptEngineManager().getEngineByName("JavaScript"));
}

@Before
public abstract void setup();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@
import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
import org.apache.log4j.Logger;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;

import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assumptions.assumeFalse;

import javax.script.ScriptEngineManager;

/**
* This class tests the {@code MetricsInvariantChecker} by running it multiple
Expand All @@ -45,6 +49,12 @@ public class TestMetricsInvariantChecker {
private MetricsInvariantChecker ic;
private Configuration conf;

@BeforeAll
public static void checkForJavaScript() {
assumeFalse(new ScriptEngineManager().getEngineByName("JavaScript") == null,
"JavaScript engine not available (JEP 372)");
}

@BeforeEach
public void setup() {
this.metricsSystem = DefaultMetricsSystem.instance();
Expand Down