[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,13 +25,14 @@ trait ParseConfigLines {
|
|||
value: String
|
||||
): List[ConfigOption] =
|
||||
key.toLowerCase match {
|
||||
case "source" => List(Source(Paths.get(value)))
|
||||
case "bucket" => List(Bucket(value))
|
||||
case "prefix" => List(Prefix(value))
|
||||
case "include" => List(Include(value))
|
||||
case "exclude" => List(Exclude(value))
|
||||
case "debug" => if (truthy(value)) List(Debug()) else List.empty
|
||||
case _ => List.empty
|
||||
case "parallel" => value.toIntOption.map(Parallel).toList
|
||||
case "source" => List(Source(Paths.get(value)))
|
||||
case "bucket" => List(Bucket(value))
|
||||
case "prefix" => List(Prefix(value))
|
||||
case "include" => List(Include(value))
|
||||
case "exclude" => List(Exclude(value))
|
||||
case "debug" => if (truthy(value)) List(Debug()) else List.empty
|
||||
case _ => List.empty
|
||||
}
|
||||
|
||||
private def truthy(value: String): Boolean =
|
||||
|
|
|
@ -50,6 +50,24 @@ class ParseConfigLinesTest extends FunSpec {
|
|||
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") {
|
||||
it("should parse") {
|
||||
val expected = Right(ConfigOptions(List(ConfigOption.Debug())))
|
||||
|
|
Loading…
Reference in a new issue