mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-28 17:51:06 -06:00
misc naming, typo and formatting improvements
This commit is contained in:
parent
1816381f97
commit
077b41a3c6
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.engine.core.lifecycle;
|
||||
package io.nosqlbench.engine.core.lifecycle.activity;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@ -23,9 +23,9 @@ public class ActivityExceptionHandler implements Thread.UncaughtExceptionHandler
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(ActivityExceptionHandler.class);
|
||||
|
||||
private final ActivityThreadsManager executor;
|
||||
private final ActivityExecutor executor;
|
||||
|
||||
public ActivityExceptionHandler(ActivityThreadsManager executor) {
|
||||
public ActivityExceptionHandler(ActivityExecutor executor) {
|
||||
this.executor = executor;
|
||||
logger.debug(() -> "Activity exception handler starting up for executor '" + executor + "'");
|
||||
}
|
||||
@ -33,7 +33,7 @@ public class ActivityExceptionHandler implements Thread.UncaughtExceptionHandler
|
||||
|
||||
@Override
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
logger.error("Uncaught exception in thread '" + t.getName() + ", state[" + t.getState() + "], notifying executor '" + executor + "'");
|
||||
logger.error("Uncaught exception in thread '" + t.getName() + ", state[" + t.getState() + "], notifying executor '" + executor + "': " + e);
|
||||
executor.notifyException(t, e);
|
||||
}
|
||||
}
|
@ -124,10 +124,10 @@ public class ScenarioController {
|
||||
/**
|
||||
* Synchronously run the defined activity with a timeout in seconds.
|
||||
*
|
||||
* @param timeout seconds to await completion of the activity.
|
||||
* @param timeoutMs seconds to await completion of the activity.
|
||||
* @param activityDef A definition for an activity to run
|
||||
*/
|
||||
public synchronized void run(int timeout, ActivityDef activityDef) {
|
||||
public synchronized void run(ActivityDef activityDef, long timeoutMs) {
|
||||
Annotators.recordAnnotation(Annotation.newBuilder()
|
||||
.session(sessionId)
|
||||
.now()
|
||||
@ -143,7 +143,7 @@ public class ScenarioController {
|
||||
|
||||
public synchronized void run(int timeout, String activityDefString) {
|
||||
ActivityDef activityDef = ActivityDef.parseActivityDef(activityDefString);
|
||||
run(timeout, activityDef);
|
||||
run(activityDef, timeout);
|
||||
}
|
||||
|
||||
public synchronized void run(Map<String, String> activityDefMap) {
|
||||
@ -156,7 +156,7 @@ public class ScenarioController {
|
||||
|
||||
|
||||
public synchronized void run(ActivityDef activityDef) {
|
||||
run(Integer.MAX_VALUE, activityDef);
|
||||
run(activityDef, Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class ScenariosExecutor {
|
||||
if (submitted.get(scenario.getScenarioName()) != null) {
|
||||
throw new BasicError("Scenario " + scenario.getScenarioName() + " is already defined. Remove it first to reuse the name.");
|
||||
}
|
||||
Future<ExecMetricsResult> future = executor.submit(scenario);
|
||||
Future<ExecutionMetricsResult> future = executor.submit(scenario);
|
||||
SubmittedScenario s = new SubmittedScenario(scenario, future);
|
||||
submitted.put(s.getName(), s);
|
||||
}
|
||||
@ -108,7 +108,7 @@ public class ScenariosExecutor {
|
||||
throw new RuntimeException("executor still runningScenarios after awaiting all results for " + timeout
|
||||
+ "ms. isTerminated:" + executor.isTerminated() + " isShutdown:" + executor.isShutdown());
|
||||
}
|
||||
Map<Scenario, ExecMetricsResult> scenarioResultMap = new LinkedHashMap<>();
|
||||
Map<Scenario, ExecutionMetricsResult> scenarioResultMap = new LinkedHashMap<>();
|
||||
getAsyncResultStatus()
|
||||
.entrySet()
|
||||
.forEach(
|
||||
@ -135,26 +135,26 @@ public class ScenariosExecutor {
|
||||
* All submitted scenarios are included. Those which are still pending
|
||||
* are returned with an empty option.</p>
|
||||
*
|
||||
* <p>Results may be exceptional. If {@link ExecMetricsResult#getException()} is present,
|
||||
* <p>Results may be exceptional. If {@link ExecutionMetricsResult#getException()} is present,
|
||||
* then the result did not complete normally.</p>
|
||||
*
|
||||
* @return map of async results, with incomplete results as Optional.empty()
|
||||
*/
|
||||
public Map<Scenario, Optional<ExecMetricsResult>> getAsyncResultStatus() {
|
||||
public Map<Scenario, Optional<ExecutionMetricsResult>> getAsyncResultStatus() {
|
||||
|
||||
Map<Scenario, Optional<ExecMetricsResult>> optResults = new LinkedHashMap<>();
|
||||
Map<Scenario, Optional<ExecutionMetricsResult>> optResults = new LinkedHashMap<>();
|
||||
|
||||
for (SubmittedScenario submittedScenario : submitted.values()) {
|
||||
Future<ExecMetricsResult> resultFuture = submittedScenario.getResultFuture();
|
||||
Future<ExecutionMetricsResult> resultFuture = submittedScenario.getResultFuture();
|
||||
|
||||
Optional<ExecMetricsResult> oResult = Optional.empty();
|
||||
Optional<ExecutionMetricsResult> oResult = Optional.empty();
|
||||
if (resultFuture.isDone()) {
|
||||
try {
|
||||
oResult = Optional.of(resultFuture.get());
|
||||
} catch (Exception e) {
|
||||
long now = System.currentTimeMillis();
|
||||
logger.debug("creating exceptional scenario result from getAsyncResultStatus");
|
||||
oResult = Optional.of(new ExecMetricsResult(now, now, "errored output", e));
|
||||
oResult = Optional.of(new ExecutionMetricsResult(now, now, "errored output", e));
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ public class ScenariosExecutor {
|
||||
* @param scenarioName the scenario name of interest
|
||||
* @return an optional result
|
||||
*/
|
||||
public Optional<Future<ExecMetricsResult>> getPendingResult(String scenarioName) {
|
||||
public Optional<Future<ExecutionMetricsResult>> getPendingResult(String scenarioName) {
|
||||
return Optional.ofNullable(submitted.get(scenarioName)).map(s -> s.resultFuture);
|
||||
}
|
||||
|
||||
@ -226,9 +226,9 @@ public class ScenariosExecutor {
|
||||
|
||||
private static class SubmittedScenario {
|
||||
private final Scenario scenario;
|
||||
private final Future<ExecMetricsResult> resultFuture;
|
||||
private final Future<ExecutionMetricsResult> resultFuture;
|
||||
|
||||
SubmittedScenario(Scenario scenario, Future<ExecMetricsResult> resultFuture) {
|
||||
SubmittedScenario(Scenario scenario, Future<ExecutionMetricsResult> resultFuture) {
|
||||
this.scenario = scenario;
|
||||
this.resultFuture = resultFuture;
|
||||
}
|
||||
@ -237,7 +237,7 @@ public class ScenariosExecutor {
|
||||
return scenario;
|
||||
}
|
||||
|
||||
Future<ExecMetricsResult> getResultFuture() {
|
||||
Future<ExecutionMetricsResult> getResultFuture() {
|
||||
return resultFuture;
|
||||
}
|
||||
|
||||
|
@ -27,14 +27,14 @@ public class ScenariosResults {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(ScenariosResults.class);
|
||||
private final String scenariosExecutorName;
|
||||
private final Map<Scenario, ExecMetricsResult> scenarioResultMap = new LinkedHashMap<>();
|
||||
private final Map<Scenario, ExecutionMetricsResult> scenarioResultMap = new LinkedHashMap<>();
|
||||
|
||||
|
||||
public ScenariosResults(ScenariosExecutor scenariosExecutor) {
|
||||
this.scenariosExecutorName = scenariosExecutor.getName();
|
||||
}
|
||||
|
||||
public ScenariosResults(ScenariosExecutor scenariosExecutor, Map<Scenario, ExecMetricsResult> map) {
|
||||
public ScenariosResults(ScenariosExecutor scenariosExecutor, Map<Scenario, ExecutionMetricsResult> map) {
|
||||
this.scenariosExecutorName = scenariosExecutor.getName();
|
||||
scenarioResultMap.putAll(map);
|
||||
}
|
||||
@ -46,7 +46,7 @@ public class ScenariosResults {
|
||||
return sb;
|
||||
}
|
||||
|
||||
public ExecMetricsResult getOne() {
|
||||
public ExecutionMetricsResult getOne() {
|
||||
if (this.scenarioResultMap.size() != 1) {
|
||||
throw new RuntimeException("getOne found " + this.scenarioResultMap.size() + " results instead of 1.");
|
||||
}
|
||||
@ -55,9 +55,9 @@ public class ScenariosResults {
|
||||
}
|
||||
|
||||
public void reportToLog() {
|
||||
for (Map.Entry<Scenario, ExecMetricsResult> entry : this.scenarioResultMap.entrySet()) {
|
||||
for (Map.Entry<Scenario, ExecutionMetricsResult> entry : this.scenarioResultMap.entrySet()) {
|
||||
Scenario scenario = entry.getKey();
|
||||
ExecMetricsResult oresult = entry.getValue();
|
||||
ExecutionMetricsResult oresult = entry.getValue();
|
||||
|
||||
logger.info("results for scenario: " + scenario);
|
||||
|
||||
|
@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.nosqlbench.engine.core.script;
|
||||
package io.nosqlbench.engine.core.lifecycle.scenario.script.bindings;
|
||||
|
||||
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.engine.core.lifecycle.ScenarioController;
|
||||
import io.nosqlbench.engine.core.lifecycle.scenario.ScenarioController;
|
||||
import org.graalvm.polyglot.Value;
|
||||
import org.graalvm.polyglot.proxy.ProxyObject;
|
||||
|
||||
@ -27,12 +27,12 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* Provide a bindings wrapper around a ScenarioController,
|
||||
*/
|
||||
public class NashornActivityBindings implements Bindings, ProxyObject {
|
||||
public class ActivityBindings implements Bindings, ProxyObject {
|
||||
|
||||
private final ScenarioController scenario;
|
||||
private final Map<String, Bindings> elementMap = new HashMap<String, Bindings>();
|
||||
|
||||
public NashornActivityBindings(ScenarioController scenarioController) {
|
||||
public ActivityBindings(ScenarioController scenarioController) {
|
||||
this.scenario = scenarioController;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class PolyglotScenarioController {
|
||||
private synchronized void runValue(int timeout, Value spec) {
|
||||
logger.debug("run(Value) called with:" + spec);
|
||||
if (spec.isHostObject()) {
|
||||
controller.run(timeout, (ActivityDef) spec.asHostObject());
|
||||
controller.run(spec.asHostObject(),timeout);
|
||||
} else if (spec.isString()) {
|
||||
controller.run(timeout, spec.asString());
|
||||
} else if (spec.hasMembers()) {
|
||||
@ -89,7 +89,7 @@ public class PolyglotScenarioController {
|
||||
} else if (spec.isHostObject()) {
|
||||
Object o = spec.asHostObject();
|
||||
if (o instanceof ActivityDef) {
|
||||
controller.run(timeout, (ActivityDef) o);
|
||||
controller.run((ActivityDef) o, timeout);
|
||||
} else {
|
||||
throw new RuntimeException("unrecognized polyglot host object type for run: " + spec);
|
||||
}
|
||||
@ -165,7 +165,7 @@ public class PolyglotScenarioController {
|
||||
|
||||
private synchronized void awaitValue(Value spec) {
|
||||
if (spec.isHostObject()) {
|
||||
controller.await((ActivityDef) spec.asHostObject());
|
||||
controller.await(spec.asHostObject(), Long.MAX_VALUE);
|
||||
} else if (spec.hasMembers()) {
|
||||
controller.await(spec.as(Map.class));
|
||||
} else if (spec.isString()) {
|
||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.core.metadata;
|
||||
|
||||
import io.nosqlbench.engine.api.activityapi.core.ActivityType;
|
||||
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.engine.core.lifecycle.ActivityTypeLoader;
|
||||
import io.nosqlbench.engine.core.lifecycle.activity.ActivityTypeLoader;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import io.nosqlbench.api.content.Content;
|
||||
import io.nosqlbench.api.content.NBIO;
|
||||
@ -28,20 +28,20 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class MarkdownDocInfo {
|
||||
private final static Logger logger = LogManager.getLogger(MarkdownDocInfo.class);
|
||||
public class MarkdownFinder {
|
||||
private final static Logger logger = LogManager.getLogger(MarkdownFinder.class);
|
||||
|
||||
public static Optional<String> forHelpTopic(String topic) {
|
||||
String help = null;
|
||||
try {
|
||||
help = new MarkdownDocInfo().forActivityInstance(topic);
|
||||
help = new MarkdownFinder().forActivityInstance(topic);
|
||||
return Optional.ofNullable(help);
|
||||
} catch (Exception e) {
|
||||
logger.debug("Did not find help topic for activity instance: " + topic);
|
||||
}
|
||||
|
||||
try {
|
||||
help = new MarkdownDocInfo().forResourceMarkdown(topic, "docs/");
|
||||
help = new MarkdownFinder().forResourceMarkdown(topic, "docs/");
|
||||
return Optional.ofNullable(help);
|
||||
} catch (Exception e) {
|
||||
logger.debug("Did not find help topic for generic markdown file: " + topic + "(.md)");
|
@ -17,12 +17,12 @@
|
||||
package io.nosqlbench.engine.core.script;
|
||||
|
||||
import io.nosqlbench.api.errors.BasicError;
|
||||
import io.nosqlbench.engine.core.lifecycle.scenario.script.ScriptParams;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
public class ScriptParamsTest {
|
||||
|
@ -234,8 +234,8 @@ public class ScenarioExecutorEndpoint implements WebServiceObject {
|
||||
Optional<Scenario> pendingScenario = executor.getPendingScenario(scenarioName);
|
||||
|
||||
if (pendingScenario.isPresent()) {
|
||||
Optional<Future<ExecMetricsResult>> pendingResult = executor.getPendingResult(scenarioName);
|
||||
Future<ExecMetricsResult> scenarioResultFuture = pendingResult.get();
|
||||
Optional<Future<ExecutionMetricsResult>> pendingResult = executor.getPendingResult(scenarioName);
|
||||
Future<ExecutionMetricsResult> scenarioResultFuture = pendingResult.get();
|
||||
return new LiveScenarioView(pendingScenario.get());
|
||||
} else {
|
||||
throw new RuntimeException("Scenario name '" + scenarioName + "' not found.");
|
||||
|
@ -16,18 +16,18 @@
|
||||
|
||||
package io.nosqlbench.engine.rest.transfertypes;
|
||||
|
||||
import io.nosqlbench.engine.core.lifecycle.ExecMetricsResult;
|
||||
import io.nosqlbench.engine.core.lifecycle.ExecutionMetricsResult;
|
||||
|
||||
public class ResultView {
|
||||
|
||||
private final ExecMetricsResult result;
|
||||
private final ExecutionMetricsResult result;
|
||||
|
||||
public ResultView(ExecMetricsResult result) {
|
||||
public ResultView(ExecutionMetricsResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getIOLog() {
|
||||
if (result!=null) {
|
||||
if (result != null) {
|
||||
return result.getIOLog();
|
||||
} else {
|
||||
return "";
|
||||
@ -35,8 +35,8 @@ public class ResultView {
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
if (result!=null && result.getException().isPresent()) {
|
||||
return result.getException().get().getMessage();
|
||||
if (result != null && result.getException()!=null) {
|
||||
return result.getException().getMessage();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -16,10 +16,10 @@
|
||||
|
||||
package io.nosqlbench.nbr.examples;
|
||||
|
||||
import io.nosqlbench.engine.core.lifecycle.ExecMetricsResult;
|
||||
import io.nosqlbench.engine.core.lifecycle.ScenariosResults;
|
||||
import io.nosqlbench.engine.core.script.Scenario;
|
||||
import io.nosqlbench.engine.core.script.ScenariosExecutor;
|
||||
import io.nosqlbench.engine.core.lifecycle.ExecutionMetricsResult;
|
||||
import io.nosqlbench.engine.core.lifecycle.scenario.ScenariosResults;
|
||||
import io.nosqlbench.engine.core.lifecycle.scenario.Scenario;
|
||||
import io.nosqlbench.engine.core.lifecycle.scenario.ScenariosExecutor;
|
||||
import io.nosqlbench.nb.annotations.Maturity;
|
||||
import org.apache.commons.compress.utils.IOUtils;
|
||||
import org.assertj.core.data.Offset;
|
||||
@ -41,7 +41,7 @@ import java.util.stream.Collectors;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class ScriptExampleTests {
|
||||
|
||||
public static ExecMetricsResult runScenario(String scriptname, String... params) {
|
||||
public static ExecutionMetricsResult runScenario(String scriptname, String... params) {
|
||||
if ((params.length % 2) != 0) {
|
||||
throw new RuntimeException("params must be pairwise key, value, ...");
|
||||
}
|
||||
@ -74,7 +74,7 @@ public class ScriptExampleTests {
|
||||
// s.addScriptText("load('classpath:scripts/async/" + scriptname + ".js');");
|
||||
executor.execute(s);
|
||||
ScenariosResults scenariosResults = executor.awaitAllResults();
|
||||
ExecMetricsResult scenarioResult = scenariosResults.getOne();
|
||||
ExecutionMetricsResult scenarioResult = scenariosResults.getOne();
|
||||
executor.shutdownNow();
|
||||
return scenarioResult;
|
||||
}
|
||||
@ -86,7 +86,7 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testLinkedInput() {
|
||||
ExecMetricsResult scenarioResult = runScenario("linkedinput");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("linkedinput");
|
||||
Pattern p = Pattern.compile(".*started leader.*started follower.*stopped leader.*stopped follower.*",
|
||||
Pattern.DOTALL);
|
||||
assertThat(p.matcher(scenarioResult.getIOLog()).matches()).isTrue();
|
||||
@ -94,14 +94,14 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testExceptionPropagationFromMotorThread() {
|
||||
ExecMetricsResult scenarioResult = runScenario("activityerror");
|
||||
assertThat(scenarioResult.getException()).isPresent();
|
||||
assertThat(scenarioResult.getException().get().getMessage()).contains("For input string: \"unparsable\"");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("activityerror");
|
||||
assertThat(scenarioResult.getException()).isNotNull();
|
||||
assertThat(scenarioResult.getException().getMessage()).contains("For input string: \"unparsable\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCycleRate() {
|
||||
ExecMetricsResult scenarioResult = runScenario("cycle_rate");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("cycle_rate");
|
||||
String iolog = scenarioResult.getIOLog();
|
||||
System.out.println("iolog\n" + iolog);
|
||||
Pattern p = Pattern.compile(".*mean cycle rate = (\\d[.\\d]+).*", Pattern.DOTALL);
|
||||
@ -116,13 +116,13 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testExtensionPoint() {
|
||||
ExecMetricsResult scenarioResult = runScenario("extensions");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("extensions");
|
||||
assertThat(scenarioResult.getIOLog()).contains("sum is 46");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOptimo() {
|
||||
ExecMetricsResult scenarioResult = runScenario("optimo");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("optimo");
|
||||
String iolog = scenarioResult.getIOLog();
|
||||
System.out.println("iolog\n" + iolog);
|
||||
assertThat(iolog).contains("map of result was");
|
||||
@ -130,14 +130,14 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testExtensionCsvLogger() {
|
||||
ExecMetricsResult scenarioResult = runScenario("extension_csvmetrics");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("extension_csvmetrics");
|
||||
assertThat(scenarioResult.getIOLog()).contains("started new " +
|
||||
"csvlogger: logs/csvmetricstestdir");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScriptParamsVariable() {
|
||||
ExecMetricsResult scenarioResult = runScenario("params_variable", "one", "two", "three", "four");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("params_variable", "one", "two", "three", "four");
|
||||
assertThat(scenarioResult.getIOLog()).contains("params[\"one\"]='two'");
|
||||
assertThat(scenarioResult.getIOLog()).contains("params[\"three\"]='four'");
|
||||
assertThat(scenarioResult.getIOLog()).contains("overridden[\"three\"] [overridden-three-five]='five'");
|
||||
@ -146,7 +146,7 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testScriptParamsUndefVariableWithOverride() {
|
||||
ExecMetricsResult scenarioResult = runScenario("undef_param", "one", "two", "three", "four");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("undef_param", "one", "two", "three", "four");
|
||||
assertThat(scenarioResult.getIOLog()).contains("before: params[\"three\"]:four");
|
||||
assertThat(scenarioResult.getIOLog()).contains("before: params.three:four");
|
||||
assertThat(scenarioResult.getIOLog()).contains("after: params[\"three\"]:undefined");
|
||||
@ -155,7 +155,7 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testExtensionHistoStatsLogger() throws IOException {
|
||||
ExecMetricsResult scenarioResult = runScenario("extension_histostatslogger");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("extension_histostatslogger");
|
||||
assertThat(scenarioResult.getIOLog()).contains("stdout started " +
|
||||
"logging to logs/histostats.csv");
|
||||
List<String> strings = Files.readAllLines(Paths.get(
|
||||
@ -167,7 +167,7 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testExtensionCsvOutput() throws IOException {
|
||||
ExecMetricsResult scenarioResult = runScenario("extension_csvoutput");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("extension_csvoutput");
|
||||
List<String> strings = Files.readAllLines(Paths.get(
|
||||
"logs/csvoutputtestfile.csv"));
|
||||
String logdata = strings.stream().collect(Collectors.joining("\n"));
|
||||
@ -177,7 +177,7 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testExtensionHistogramLogger() throws IOException {
|
||||
ExecMetricsResult scenarioResult = runScenario("extension_histologger");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("extension_histologger");
|
||||
assertThat(scenarioResult.getIOLog()).contains("stdout started logging to hdrhistodata.log");
|
||||
List<String> strings = Files.readAllLines(Paths.get("hdrhistodata.log"));
|
||||
String logdata = strings.stream().collect(Collectors.joining("\n"));
|
||||
@ -187,7 +187,7 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testBlockingRun() {
|
||||
ExecMetricsResult scenarioResult = runScenario("blockingrun");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("blockingrun");
|
||||
int a1end = scenarioResult.getIOLog().indexOf("blockingactivity1 finished");
|
||||
int a2start = scenarioResult.getIOLog().indexOf("running blockingactivity2");
|
||||
assertThat(a1end).isLessThan(a2start);
|
||||
@ -195,12 +195,12 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testAwaitFinished() {
|
||||
ExecMetricsResult scenarioResult = runScenario("awaitfinished");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("awaitfinished");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartStop() {
|
||||
ExecMetricsResult scenarioResult = runScenario("startstopdiag");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("startstopdiag");
|
||||
int startedAt = scenarioResult.getIOLog().indexOf("starting activity teststartstopdiag");
|
||||
int stoppedAt = scenarioResult.getIOLog().indexOf("stopped activity teststartstopdiag");
|
||||
assertThat(startedAt).isGreaterThan(0);
|
||||
@ -210,7 +210,7 @@ public class ScriptExampleTests {
|
||||
// TODO: find out why this causes a long delay after stop is called.
|
||||
@Test
|
||||
public void testThreadChange() {
|
||||
ExecMetricsResult scenarioResult = runScenario("threadchange");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("threadchange");
|
||||
int changedTo1At = scenarioResult.getIOLog().indexOf("threads now 1");
|
||||
int changedTo5At = scenarioResult.getIOLog().indexOf("threads now 5");
|
||||
System.out.println("IOLOG:\n"+scenarioResult.getIOLog());
|
||||
@ -220,13 +220,13 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testReadMetric() {
|
||||
ExecMetricsResult scenarioResult = runScenario("readmetrics");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("readmetrics");
|
||||
assertThat(scenarioResult.getIOLog()).contains("count: ");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShutdownHook() {
|
||||
ExecMetricsResult scenarioResult = runScenario("extension_shutdown_hook");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("extension_shutdown_hook");
|
||||
assertThat(scenarioResult.getIOLog()).doesNotContain("shutdown hook running").describedAs(
|
||||
"shutdown hooks should not run in the same IO context as the main scenario"
|
||||
);
|
||||
@ -234,15 +234,15 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testExceptionPropagationFromActivityInit() {
|
||||
ExecMetricsResult scenarioResult = runScenario("activityiniterror");
|
||||
assertThat(scenarioResult.getException()).isPresent();
|
||||
assertThat(scenarioResult.getException().get().getMessage()).contains("Unable to convert end cycle from invalid");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("activityiniterror");
|
||||
assertThat(scenarioResult.getException()).isNotNull();
|
||||
assertThat(scenarioResult.getException().getMessage()).contains("Unable to convert end cycle from invalid");
|
||||
assertThat(scenarioResult.getException()).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReportedCoDelayBursty() {
|
||||
ExecMetricsResult scenarioResult = runScenario("cocycledelay_bursty");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("cocycledelay_bursty");
|
||||
assertThat(scenarioResult.getIOLog()).contains("step1 metrics.waittime=");
|
||||
assertThat(scenarioResult.getIOLog()).contains("step2 metrics.waittime=");
|
||||
String iolog = scenarioResult.getIOLog();
|
||||
@ -252,7 +252,7 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testReportedCoDelayStrict() {
|
||||
ExecMetricsResult scenarioResult = runScenario("cocycledelay_strict");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("cocycledelay_strict");
|
||||
assertThat(scenarioResult.getIOLog()).contains("step1 cycles.waittime=");
|
||||
assertThat(scenarioResult.getIOLog()).contains("step2 cycles.waittime=");
|
||||
String iolog = scenarioResult.getIOLog();
|
||||
@ -263,14 +263,14 @@ public class ScriptExampleTests {
|
||||
|
||||
@Test
|
||||
public void testCycleRateChangeNewMetrics() {
|
||||
ExecMetricsResult scenarioResult = runScenario("cycle_rate_change");
|
||||
ExecutionMetricsResult scenarioResult = runScenario("cycle_rate_change");
|
||||
String ioLog = scenarioResult.getIOLog();
|
||||
assertThat(ioLog).contains("cycles adjusted, exiting on iteration");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExitLogic() {
|
||||
ExecMetricsResult scenarioResult = runScenario(
|
||||
ExecutionMetricsResult scenarioResult = runScenario(
|
||||
"basicdiag",
|
||||
"type", "diag", "cyclerate", "5", "erroroncycle", "10", "cycles", "2000"
|
||||
);
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package io.nosqlbench.nbr.examples;
|
||||
|
||||
import io.nosqlbench.engine.core.lifecycle.ExecMetricsResult;
|
||||
import io.nosqlbench.engine.core.lifecycle.ExecutionMetricsResult;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@ -30,14 +30,14 @@ public class SpeedCheckIntegrationTests {
|
||||
@Disabled
|
||||
// Verified as working
|
||||
public void testSpeedSanity() {
|
||||
ExecMetricsResult scenarioResult = ScriptExampleTests.runScenario("speedcheck");
|
||||
ExecutionMetricsResult scenarioResult = ScriptExampleTests.runScenario("speedcheck");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
// This seems incomplete
|
||||
public void testThreadSpeeds() {
|
||||
ExecMetricsResult scenarioResult = ScriptExampleTests.runScenario("threadspeeds");
|
||||
ExecutionMetricsResult scenarioResult = ScriptExampleTests.runScenario("threadspeeds");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user