[config] Accept ‘parallel’ in config files (#230)
This commit is contained in:
parent
aee0c50733
commit
1ef912ceb3
2 changed files with 26 additions and 7 deletions
|
@ -25,6 +25,7 @@ trait ParseConfigLines {
|
||||||
value: String
|
value: String
|
||||||
): List[ConfigOption] =
|
): List[ConfigOption] =
|
||||||
key.toLowerCase match {
|
key.toLowerCase match {
|
||||||
|
case "parallel" => value.toIntOption.map(Parallel).toList
|
||||||
case "source" => List(Source(Paths.get(value)))
|
case "source" => List(Source(Paths.get(value)))
|
||||||
case "bucket" => List(Bucket(value))
|
case "bucket" => List(Bucket(value))
|
||||||
case "prefix" => List(Prefix(value))
|
case "prefix" => List(Prefix(value))
|
||||||
|
|
|
@ -50,6 +50,24 @@ class ParseConfigLinesTest extends FunSpec {
|
||||||
assertResult(expected)(result)
|
assertResult(expected)(result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
describe("parallel") {
|
||||||
|
describe("when valid") {
|
||||||
|
it("should parse") {
|
||||||
|
val expected =
|
||||||
|
Right(ConfigOptions(List(ConfigOption.Parallel(3))))
|
||||||
|
val result = invoke(List("parallel = 3"))
|
||||||
|
assertResult(expected)(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe("when invalid") {
|
||||||
|
it("should ignore") {
|
||||||
|
val expected =
|
||||||
|
Right(ConfigOptions(List.empty))
|
||||||
|
val result = invoke(List("parallel = invalid"))
|
||||||
|
assertResult(expected)(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
describe("debug - true") {
|
describe("debug - true") {
|
||||||
it("should parse") {
|
it("should parse") {
|
||||||
val expected = Right(ConfigOptions(List(ConfigOption.Debug())))
|
val expected = Right(ConfigOptions(List(ConfigOption.Debug())))
|
||||||
|
|
Loading…
Reference in a new issue