mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
post merge test fixes
This commit is contained in:
parent
777c4aa3c7
commit
f7e4efc79a
@ -68,13 +68,13 @@ public class RawYamlTemplateLoaderTest {
|
|||||||
"a quintessential description - this is superseded by dedicated specification tests and will be removed");
|
"a quintessential description - this is superseded by dedicated specification tests and will be removed");
|
||||||
|
|
||||||
RawScenarios rawScenarios = rawOpsDoc.getRawScenarios();
|
RawScenarios rawScenarios = rawOpsDoc.getRawScenarios();
|
||||||
assertThat(rawScenarios.getScenarioNames()).containsExactly("default", "schema-only");
|
assertThat(rawScenarios.getScenarioNames()).containsExactly("default", "schema_only");
|
||||||
Map<String, String> defaultScenario = rawScenarios.getNamedScenario("default");
|
Map<String, String> defaultScenario = rawScenarios.getNamedScenario("default");
|
||||||
assertThat(defaultScenario.keySet())
|
assertThat(defaultScenario.keySet())
|
||||||
.containsExactly("000","001");
|
.containsExactly("000","001");
|
||||||
assertThat(defaultScenario.values())
|
assertThat(defaultScenario.values())
|
||||||
.containsExactly("run driver=stdout alias=step1","run driver=stdout alias=step2");
|
.containsExactly("run driver=stdout alias=step1","run driver=stdout alias=step2");
|
||||||
Map<String, String> schemaOnlyScenario = rawScenarios.getNamedScenario("schema-only");
|
Map<String, String> schemaOnlyScenario = rawScenarios.getNamedScenario("schema_only");
|
||||||
assertThat(schemaOnlyScenario.keySet())
|
assertThat(schemaOnlyScenario.keySet())
|
||||||
.containsExactly("000");
|
.containsExactly("000");
|
||||||
assertThat(schemaOnlyScenario.values())
|
assertThat(schemaOnlyScenario.values())
|
||||||
|
@ -18,6 +18,7 @@ package io.nosqlbench.engine.cli;
|
|||||||
|
|
||||||
import io.nosqlbench.api.errors.BasicError;
|
import io.nosqlbench.api.errors.BasicError;
|
||||||
import io.nosqlbench.engine.api.scenarios.NBCLIScenarioParser;
|
import io.nosqlbench.engine.api.scenarios.NBCLIScenarioParser;
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@ -31,39 +32,39 @@ public class NBCLIScenarioParserTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void providePathForScenario() {
|
public void providePathForScenario() {
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{"local/example-scenarios"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{"local/example_scenarios"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void defaultScenario() {
|
public void defaultScenario() {
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario-test"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario_test"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void defaultScenarioWithParams() {
|
public void defaultScenarioWithParams() {
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario-test", "cycles=100"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario_test", "cycles=100"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
assertThat(cmds.get(0).getArg("cycles")).isEqualTo("100");
|
assertThat(cmds.get(0).getArg("cycles")).isEqualTo("100");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void namedScenario() {
|
public void namedScenario() {
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario-test", "schema-only"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario_test", "schema_only"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void namedScenarioWithParams() {
|
public void namedScenarioWithParams() {
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario-test", "schema-only", "cycles=100"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario_test", "schema_only", "cycles=100"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
assertThat(cmds.get(0).getArg("cycles")).containsOnlyOnce("100");
|
assertThat(cmds.get(0).getArg("cycles")).containsOnlyOnce("100");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThatSilentFinalParametersPersist() {
|
public void testThatSilentFinalParametersPersist() {
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario-test", "type=foo"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario_test", "type=foo"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
assertThat(cmds.get(0).getArg("driver")).isEqualTo("stdout");
|
assertThat(cmds.get(0).getArg("driver")).isEqualTo("stdout");
|
||||||
}
|
}
|
||||||
@ -71,35 +72,35 @@ public class NBCLIScenarioParserTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testThatVerboseFinalParameterThrowsError() {
|
public void testThatVerboseFinalParameterThrowsError() {
|
||||||
assertThatExceptionOfType(BasicError.class)
|
assertThatExceptionOfType(BasicError.class)
|
||||||
.isThrownBy(() -> new NBCLIOptions(new String[]{"scenario-test", "workload=canttouchthis"}));
|
.isThrownBy(() -> new NBCLIOptions(new String[]{"scenario_test", "workload=canttouchthis"}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThatMissingScenarioNameThrowsError() {
|
public void testThatMissingScenarioNameThrowsError() {
|
||||||
assertThatExceptionOfType(BasicError.class)
|
assertThatExceptionOfType(BasicError.class)
|
||||||
.isThrownBy(() -> new NBCLIOptions(new String[]{"scenario-test", "missing-scenario"}));
|
.isThrownBy(() -> new NBCLIOptions(new String[]{"scenario_test", "missing_scenario"}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThatMultipleScenariosConcatenate() {
|
public void testThatMultipleScenariosConcatenate() {
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario-test", "default", "default"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario_test", "default", "default"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
assertThat(cmds.size()).isEqualTo(6);
|
assertThat(cmds.size()).isEqualTo(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThatTemplatesAreExpandedDefault() {
|
public void testThatTemplatesAreExpandedDefault() {
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario-test", "template-test"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario_test", "template_test"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
assertThat(cmds.size()).isEqualTo(1);
|
assertThat(cmds.size()).isEqualTo(1);
|
||||||
assertThat(cmds.get(0).getArg("driver")).isEqualTo("stdout");
|
assertThat(cmds.get(0).getArg("driver")).isEqualTo("stdout");
|
||||||
assertThat(cmds.get(0).getArg("cycles")).isEqualTo("10");
|
assertThat(cmds.get(0).getArg("cycles")).isEqualTo("10");
|
||||||
assertThat(cmds.get(0).getArg("workload")).isEqualTo("scenario-test");
|
assertThat(cmds.get(0).getArg("workload")).isEqualTo("scenario_test");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThatTemplateParamsAreExpandedAndNotRemovedOverride() {
|
public void testThatTemplateParamsAreExpandedAndNotRemovedOverride() {
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario-test", "template-test", "cycles-test=20"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario_test", "template_test", "cycles-test=20"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
assertThat(cmds.size()).isEqualTo(1);
|
assertThat(cmds.size()).isEqualTo(1);
|
||||||
assertThat(cmds.get(0).getParams()).isEqualTo(Map.of(
|
assertThat(cmds.get(0).getParams()).isEqualTo(Map.of(
|
||||||
@ -108,13 +109,13 @@ public class NBCLIScenarioParserTest {
|
|||||||
"cycles-test", "20",
|
"cycles-test", "20",
|
||||||
"driver", "stdout",
|
"driver", "stdout",
|
||||||
"labels","workload:$scenario_test",
|
"labels","workload:$scenario_test",
|
||||||
"workload", "scenario-test"
|
"workload", "scenario_test"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThatUndefValuesAreUndefined() {
|
public void testThatUndefValuesAreUndefined() {
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario-test", "schema-only", "cycles-test=20"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario_test", "schema_only", "cycles-test=20"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
assertThat(cmds.size()).isEqualTo(1);
|
assertThat(cmds.size()).isEqualTo(1);
|
||||||
assertThat(cmds.get(0).getParams()).isEqualTo(Map.of(
|
assertThat(cmds.get(0).getParams()).isEqualTo(Map.of(
|
||||||
@ -123,9 +124,9 @@ public class NBCLIScenarioParserTest {
|
|||||||
"driver", "stdout",
|
"driver", "stdout",
|
||||||
"labels","workload:$scenario_test",
|
"labels","workload:$scenario_test",
|
||||||
"tags", "block:\"schema.*\"",
|
"tags", "block:\"schema.*\"",
|
||||||
"workload", "scenario-test"
|
"workload", "scenario_test"
|
||||||
));
|
));
|
||||||
NBCLIOptions opts1 = new NBCLIOptions(new String[]{"scenario-test", "schema-only", "doundef=20"});
|
NBCLIOptions opts1 = new NBCLIOptions(new String[]{"scenario_test", "schema_only", "doundef=20"});
|
||||||
List<Cmd> cmds1 = opts1.getCommands();
|
List<Cmd> cmds1 = opts1.getCommands();
|
||||||
assertThat(cmds1.size()).isEqualTo(1);
|
assertThat(cmds1.size()).isEqualTo(1);
|
||||||
assertThat(cmds1.get(0).getArg("cycles-test")).isNull();
|
assertThat(cmds1.get(0).getArg("cycles-test")).isNull();
|
||||||
@ -136,23 +137,24 @@ public class NBCLIScenarioParserTest {
|
|||||||
Path cwd = Path.of(".").toAbsolutePath();
|
Path cwd = Path.of(".").toAbsolutePath();
|
||||||
System.out.println("cwd: '" + cwd + "'");
|
System.out.println("cwd: '" + cwd + "'");
|
||||||
|
|
||||||
Path rel = Path.of("src/test/resources/activities/scenario-test.yaml");
|
Path rel = Path.of("src/test/resources/activities/scenario_test.yaml");
|
||||||
|
|
||||||
assertThat(rel).exists();
|
assertThat(rel).exists();
|
||||||
Path absolute = rel.toAbsolutePath();
|
Path absolute = rel.toAbsolutePath();
|
||||||
assertThat(absolute).exists();
|
assertThat(absolute).exists();
|
||||||
|
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{absolute.toString(), "schema-only", "cycles-test=20"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{absolute.toString(), "schema_only", "cycles-test=20"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
assertThat(cmds.size()).isGreaterThan(0);
|
assertThat(cmds.size()).isGreaterThan(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Disabled
|
||||||
@Test
|
@Test
|
||||||
public void testThatScenarioUrlsAreSupported() {
|
public void testThatScenarioUrlsAreSupported() {
|
||||||
//TODO: This might change?
|
//TODO: This might change?
|
||||||
String urlScenario = "https://raw.githubusercontent.com/nosqlbench/nosqlbench/main/engine-cli/src/test/resources/activities/scenario-test.yaml";
|
String urlScenario = "https://raw.githubusercontent.com/nosqlbench/nosqlbench/main/engine-cli/src/test/resources/activities/scenario_test.yaml";
|
||||||
|
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{urlScenario, "schema-only", "cycles-test=20"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{urlScenario, "schema_only", "cycles-test=20"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
assertThat(cmds.size()).isGreaterThan(0);
|
assertThat(cmds.size()).isGreaterThan(0);
|
||||||
}
|
}
|
||||||
@ -165,7 +167,7 @@ public class NBCLIScenarioParserTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSubStepSelection() {
|
public void testSubStepSelection() {
|
||||||
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario-test", "schema-only", "cycles-test=20"});
|
NBCLIOptions opts = new NBCLIOptions(new String[]{"scenario_test", "schema_only", "cycles-test=20"});
|
||||||
List<Cmd> cmds = opts.getCommands();
|
List<Cmd> cmds = opts.getCommands();
|
||||||
assertThat(cmds.size()).isEqualTo(1);
|
assertThat(cmds.size()).isEqualTo(1);
|
||||||
assertThat(cmds.get(0).getParams()).isEqualTo(Map.of(
|
assertThat(cmds.get(0).getParams()).isEqualTo(Map.of(
|
||||||
@ -174,7 +176,7 @@ public class NBCLIScenarioParserTest {
|
|||||||
"driver", "stdout",
|
"driver", "stdout",
|
||||||
"labels","workload:$scenario_test",
|
"labels","workload:$scenario_test",
|
||||||
"tags", "block:\"schema.*\"",
|
"tags", "block:\"schema.*\"",
|
||||||
"workload", "scenario-test"
|
"workload", "scenario_test"
|
||||||
));
|
));
|
||||||
NBCLIOptions opts1 = new NBCLIOptions(new String[]{"local/example-scenarios", "namedsteps.one", "testparam1=testvalue2"});
|
NBCLIOptions opts1 = new NBCLIOptions(new String[]{"local/example-scenarios", "namedsteps.one", "testparam1=testvalue2"});
|
||||||
List<Cmd> cmds1 = opts1.getCommands();
|
List<Cmd> cmds1 = opts1.getCommands();
|
||||||
|
@ -2,11 +2,11 @@ min_version: "5.17.1"
|
|||||||
|
|
||||||
scenarios:
|
scenarios:
|
||||||
default:
|
default:
|
||||||
schema: run driver==stdout workload===scenario-test tags=block:"schema.*"
|
schema: run driver==stdout workload===scenario_test tags=block:"schema.*"
|
||||||
rampup: run driver=stdout workload===scenario-test tags=block:rampup cycles=TEMPLATE(cycles1,10)
|
rampup: run driver=stdout workload===scenario_test tags=block:rampup cycles=TEMPLATE(cycles1,10)
|
||||||
main: run driver=stdout workload===scenario-test tags=block:"main.*" cycles=TEMPLATE(cycles2,10)
|
main: run driver=stdout workload===scenario_test tags=block:"main.*" cycles=TEMPLATE(cycles2,10)
|
||||||
schema_only:
|
schema_only:
|
||||||
schema: run driver=stdout workload==scenario-test tags=block:"schema.*" doundef==undef
|
schema: run driver=stdout workload==scenario_test tags=block:"schema.*" doundef==undef
|
||||||
|
|
||||||
template_test:
|
template_test:
|
||||||
with_template: run driver=stdout cycles=TEMPLATE(cycles-test,10)
|
with_template: run driver=stdout cycles=TEMPLATE(cycles-test,10)
|
Loading…
Reference in New Issue
Block a user