@@ -84,6 +84,10 @@ class Tester {
84
84
// i.e. 'arg.volumes' becomes 'volumes' (also contains expanded ranges)
85
85
List<String > optionNames = []
86
86
def optionDefaults = [:]
87
+ // A list of created and uncreated files
88
+ // (set if the user's used the corresponding blocks in the test)
89
+ List<String > creates = []
90
+ List<String > doesNotCreate = []
87
91
88
92
/**
89
93
* The run method.
@@ -102,11 +106,14 @@ class Tester {
102
106
for (String path : testFiles) {
103
107
104
108
// Reset filename and section number
109
+ // along with other test-specific objects
105
110
currentTestFilename = path. split(File . separator)[-1 ]
106
111
currentTestFilename = currentTestFilename.
107
112
take(currentTestFilename. length() - testExt. length())
108
113
sectionNumber = 0
109
114
testScriptVersion = 0
115
+ creates = []
116
+ doesNotCreate []
110
117
111
118
// We must not have duplicate test files -
112
119
// this indicates there are pipelines in different projects
@@ -515,6 +522,12 @@ class Tester {
515
522
* - see
516
523
* An optional list of regular expressions executed against
517
524
* the pipeline log.
525
+ *
526
+ * - creates
527
+ * An optional list of file names (regular expressions).
528
+ *
529
+ * - does_not_create
530
+ * An optional list of file names (regular expressions).
518
531
**/
519
532
def processTest (filename , section ) {
520
533
@@ -524,10 +537,13 @@ class Tester {
524
537
logTest(filename, section)
525
538
526
539
def command = section. value[' command' ]
527
- def params_block = section. value[' params' ]
528
- def see_block = section. value[' see' ]
540
+ def paramsBlock = section. value[' params' ]
541
+ def seeBlock = section. value[' see' ]
542
+ def createsBlock = section. value[' creates' ]
543
+ def doesNotCreateBlock = section. value[' does_not_create' ]
544
+
529
545
// Enforce conditions on block combinations...
530
- if (command != null && params_block != null ) {
546
+ if (command != null && paramsBlock != null ) {
531
547
err(' Found "command" and "params". Use one or the other.' )
532
548
recordFailedTest(section. key)
533
549
return
@@ -539,7 +555,7 @@ class Tester {
539
555
String pipelineCommand
540
556
if (command == null ) {
541
557
542
- if (! checkAllOptionsHaveBeenUsed(params_block )) {
558
+ if (! checkAllOptionsHaveBeenUsed(paramsBlock )) {
543
559
recordFailedTest(section. key)
544
560
return
545
561
}
@@ -548,7 +564,7 @@ class Tester {
548
564
String the_command = currentServiceDescriptor. command
549
565
550
566
// Replace the respective values in the command string...
551
- pipelineCommand = expandTemplate(the_command, params_block )
567
+ pipelineCommand = expandTemplate(the_command, paramsBlock )
552
568
// Replace newlines with '\n'
553
569
pipelineCommand = pipelineCommand. replace(System . lineSeparator(), ' \n ' )
554
570
@@ -626,18 +642,20 @@ class Tester {
626
642
// Here we look for things like "output*" in the
627
643
// redirected output path.
628
644
if (testOutputPath != null ) {
629
- def outputFiles =
630
- new FileNameFinder () . getFileNames(testOutputPath. toString(),
631
- " ${ outputFileBaseName } * " )
645
+ def outputFiles = new FileNameFinder ().
646
+ getFileNames(testOutputPath. toString(), " * " )
647
+ println " ++++++ " + outputFiles
632
648
if (outputFiles. size() == 0 ) {
633
- err(" Expected output files '$testOutputFile ' but got nothing" )
634
- validated = false
635
- }
649
+ err(" Expected output files '$testOutputFile ' but got nothing" )
650
+ validated = false
651
+ }
636
652
}
637
653
638
- if (validated && see_block != null ) {
654
+ // Has the user asked us to check text that has been logged?
655
+ if (validated && seeBlock != null ) {
656
+
639
657
// Check that we see everything the test tells us to see.
640
- see_block . each { see ->
658
+ seeBlock . each { see ->
641
659
// Replace spaces in the 'see' string
642
660
// with a simple _variable whitespace_ regex (excluding
643
661
// line-breaks and form-feeds).
@@ -653,6 +671,7 @@ class Tester {
653
671
validated = false
654
672
}
655
673
}
674
+
656
675
}
657
676
658
677
} else {
0 commit comments