mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-29 03:54:01 -06:00
Merge pull request #1891 from cognitree/unit-tests-duplicate-options
Unit tests for duplicate parameters in cli and scenario
This commit is contained in:
commit
6e379f78f0
@ -194,4 +194,11 @@ public class NBCLIScenarioPreprocessorTest {
|
|||||||
assertThat(cmds1.get(0).getArgValueOrNull("cycles_test")).isNull();
|
assertThat(cmds1.get(0).getArgValueOrNull("cycles_test")).isNull();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testThatDuplicateParamInScenarioDefThrowsError() {
|
||||||
|
assertThatExceptionOfType(BasicError.class)
|
||||||
|
.isThrownBy(() -> new NBCLIOptions(new String[]{"scenario_test", "duplicate_param"}, NBCLIOptions.Mode.ParseAllOptions))
|
||||||
|
.withMessageContaining("Duplicate occurrence of parameter \"threads\"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,10 @@ scenarios:
|
|||||||
template_test:
|
template_test:
|
||||||
with_template: run driver=stdout cycles=TEMPLATE(cycles-test,10)
|
with_template: run driver=stdout cycles=TEMPLATE(cycles-test,10)
|
||||||
|
|
||||||
|
duplicate_param:
|
||||||
|
schema: run driver=stdout workload==scenario_test threads=auto tags=block:"schema.*" threads=1 doundef==undef
|
||||||
|
|
||||||
|
|
||||||
blocks:
|
blocks:
|
||||||
schema:
|
schema:
|
||||||
ops:
|
ops:
|
||||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
// test for dots and underscores in names
|
// test for dots and underscores in names
|
||||||
@ -98,4 +99,11 @@ class CmdParserTest {
|
|||||||
assertThat(cmds.getFirst().getArgValue("param1")).isEqualTo("value1");
|
assertThat(cmds.getFirst().getArgValue("param1")).isEqualTo("value1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testThatDuplicateParameterThrowsBasicError() {
|
||||||
|
assertThatExceptionOfType(BasicError.class)
|
||||||
|
.isThrownBy(() -> CmdParser.parseArgvCommands(new LinkedList<>(List.of("run", "threads=auto", "threads=1"))))
|
||||||
|
.withMessageContaining("Duplicate occurrence of option: threads");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user