add support for scenarios from a http service

This commit is contained in:
Jake Luciani 2021-11-18 16:55:23 -05:00
parent d31fbd45fe
commit af83ca6d65
3 changed files with 13 additions and 2 deletions

View File

@ -98,7 +98,7 @@ public class NBCLIScenarioParser {
.prefix(includes)
.name(workloadName)
.extension(RawStmtsLoader.YAML_EXTENSIONS)
.one();
.first().orElseThrow();
StmtsDocList stmts = StatementsLoader.loadContent(logger, yamlWithNamedScenarios, userParams);

View File

@ -125,6 +125,16 @@ public class NBCLIScenarioParserTest {
assertThat(cmds.size()).isGreaterThan(0);
}
@Test
public void testThatScenarioUrlsAreSupported() {
//TODO: This might change?
String urlScenario = "https://gist.githubusercontent.com/tjake/0106848762e078f0ef886c1a097b3433/raw/4302fd0ab2d34bd088d973cdd52ed7711782f757/scenario-test.yaml?foo=bar";
NBCLIOptions opts = new NBCLIOptions(new String[]{ urlScenario, "schema-only", "cycles-test=20"});
List<Cmd> cmds = opts.getCommands();
assertThat(cmds.size()).isGreaterThan(0);
}
@Test
public void testSanitizer() {
String sanitized = NBCLIScenarioParser.sanitize("A-b,c_d");

View File

@ -10,6 +10,7 @@ import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -73,7 +74,7 @@ public class URLContent implements Content<URL> {
@Override
public Path asPath() {
return null;
return Paths.get(url.getPath());
}
public String toString() {