This commit is contained in:
Jonathan Shook
2021-02-04 17:47:29 -06:00
43 changed files with 194 additions and 130 deletions

View File

@@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>4.15.12-SNAPSHOT</version>
<version>4.15.13-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@@ -23,13 +23,13 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-core</artifactId>
<version>4.15.12-SNAPSHOT</version>
<version>4.15.13-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-docker</artifactId>
<version>4.15.12-SNAPSHOT</version>
<version>4.15.13-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -208,6 +208,11 @@ public class NBCLI {
System.exit(0);
}
if (options.wantsScriptList()) {
NBCLIScripts.printScripts(true, options.wantsIncludes());
System.exit(0);
}
if (options.wantsToCopyResource()) {
String resourceToCopy = options.wantsToCopyResourceNamed();
logger.debug("user requests to copy out " + resourceToCopy);

View File

@@ -46,6 +46,7 @@ public class NBCLIOptions {
private static final String LIST_METRICS = "--list-metrics";
private static final String LIST_DRIVERS = "--list-drivers";
private static final String LIST_ACTIVITY_TYPES = "--list-activity-types";
private static final String LIST_SCRIPTS = "--list-scripts";
private static final String LIST_WORKLOADS = "--list-workloads";
private static final String LIST_SCENARIOS = "--list-scenarios";
private static final String LIST_INPUT_TYPES = "--list-input-types";
@@ -133,6 +134,7 @@ public class NBCLIOptions {
private boolean enableChart = false;
private boolean dockerMetrics = false;
private boolean wantsScenariosList = false;
private boolean wantsScriptList = false;
private String wantsToCopyWorkload = null;
private boolean wantsWorkloadsList = false;
private final List<String> wantsToIncludePaths = new ArrayList<>();
@@ -519,6 +521,10 @@ public class NBCLIOptions {
arglist.removeFirst();
wantsScenariosList = true;
break;
case LIST_SCRIPTS:
arglist.removeFirst();
wantsScriptList = true;
break;
case LIST_WORKLOADS:
arglist.removeFirst();
wantsWorkloadsList = true;
@@ -775,6 +781,10 @@ public class NBCLIOptions {
return wantsScenariosList;
}
public boolean wantsScriptList() {
return wantsScriptList;
}
public boolean wantsToCopyResource() {
return wantsToCopyWorkload != null;
}

View File

@@ -0,0 +1,19 @@
package io.nosqlbench.engine.cli;
import io.nosqlbench.engine.api.scenarios.NBCLIScenarioParser;
import java.util.List;
public class NBCLIScripts {
public static void printScripts(boolean includeScenarios,
String... includes) {
List<String> scripts =
NBCLIScenarioParser.getScripts(true, includes);
for (String script: scripts) {
System.out.println(script);
}
}
}

View File

@@ -13,6 +13,9 @@
# To get a list of scenarios to run:
./nb --list-scenarios
# To get a list of scripts to run:
./nb --list-scripts
# To provide your own contact points (comma separated), add the hosts= parameter
./nb cql-iot hosts=host1,host2

View File

@@ -178,6 +178,13 @@ public class TestNBCLIOptions {
assertThat(opts.wantsScenariosList());
}
@Test
public void listScripts() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "--list-scripts"});
List<Cmd> cmds = opts.getCommands();
assertThat(opts.wantsScriptList());
}
@Test
public void clTest() {