Skip to content

Commit 165874d

Browse files
author
Alan Christie
committed
- Now understands zero 'minValues' in DSD
i.e. no parameter is required.
1 parent 1bf475c commit 165874d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/groovy/PipelineTester.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import org.apache.commons.cli.Option
3333

3434
// Version
3535
// Update with every change/release
36-
String version = '2.6.3'
36+
String version = '2.6.4'
3737

3838
println "+------------------+"
3939
println "| PipelineTester | v$version"

src/groovy/Tester.groovy

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class Tester {
8989
// A convenient list of normalised service descriptor option names
9090
// i.e. 'arg.volumes' becomes 'volumes' (also contains expanded ranges)
9191
def optionNames = []
92+
def optionMinValues = []
9293
def optionDefaults = [:]
9394
// Files created by the entire test collection.
9495
// Defined in the 'setup_collection.creates' block.
@@ -466,6 +467,7 @@ class Tester {
466467
// (to avoid contamination from a prior test)
467468
optionNames.clear()
468469
optionDefaults.clear()
470+
optionMinValues.clear()
469471

470472
currentServiceDescriptor.serviceConfig.optionDescriptors.each { option ->
471473

@@ -478,6 +480,11 @@ class Tester {
478480
optionNames.add(arglessOption)
479481
}
480482

483+
// Collect the optional minValues value
484+
if (option.minValues != null) {
485+
optionMinValues.add(option.minValues)
486+
}
487+
481488
// Collect the optional default value?
482489
if (option.defaultValue != null) {
483490
if (option.defaultValue in java.util.List) {
@@ -536,7 +543,7 @@ class Tester {
536543

537544
if (checkStatus) {
538545
// Now check that the user has not missed an option.
539-
optionNames.each { option ->
546+
optionNames.each { String option ->
540547
boolean foundParam = false
541548
params.each { param ->
542549
// Accommodate range parameters
@@ -555,7 +562,7 @@ class Tester {
555562
}
556563
}
557564
}
558-
if (!foundParam) {
565+
if (!foundParam && optionMinValues.size() > 0 && optionMinValues[0] > 0) {
559566
Log.err("Pipeline option '$option' is not defined in the test's params" +
560567
" and there is no default value to use.")
561568
checkStatus = false

0 commit comments

Comments
 (0)