[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
|
value: String
|
||||||
): List[ConfigOption] =
|
): List[ConfigOption] =
|
||||||
key.toLowerCase match {
|
key.toLowerCase match {
|
||||||
case "source" => List(Source(Paths.get(value)))
|
case "parallel" => value.toIntOption.map(Parallel).toList
|
||||||
case "bucket" => List(Bucket(value))
|
case "source" => List(Source(Paths.get(value)))
|
||||||
case "prefix" => List(Prefix(value))
|
case "bucket" => List(Bucket(value))
|
||||||
case "include" => List(Include(value))
|
case "prefix" => List(Prefix(value))
|
||||||
case "exclude" => List(Exclude(value))
|
case "include" => List(Include(value))
|
||||||
case "debug" => if (truthy(value)) List(Debug()) else List.empty
|
case "exclude" => List(Exclude(value))
|
||||||
case _ => List.empty
|
case "debug" => if (truthy(value)) List(Debug()) else List.empty
|
||||||
|
case _ => List.empty
|
||||||
}
|
}
|
||||||
|
|
||||||
private def truthy(value: String): Boolean =
|
private def truthy(value: String): Boolean =
|
||||||
|
|
|
@ -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