[config] Accept ‘parallel’ in config files (#230)

This commit is contained in:
Paul Campbell 2019-10-08 13:58:40 +01:00 committed by GitHub
parent aee0c50733
commit 1ef912ceb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 7 deletions

View file

@ -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))

View file

@ -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())))