@@ -49,10 +49,8 @@ class Tester {
49
49
// Controlled by command-line
50
50
boolean verbose = false
51
51
52
- // Controlled by setup sections
53
- int testTimeoutSeconds = 30
54
-
55
52
// Constants?
53
+ int defaultTimeoutSeconds = 30
56
54
String testExt = ' .test'
57
55
String executeAnchorDir = ' /src/'
58
56
String testFileSpec = " **/*${ testExt} "
@@ -68,6 +66,9 @@ class Tester {
68
66
String testPrefix = ' test_'
69
67
String ignorePrefix = ' ignore_'
70
68
69
+ // Controlled by setup sections
70
+ int testTimeoutSeconds = defaultTimeoutSeconds
71
+
71
72
// Material accumulated as the tests execute
72
73
int testScriptVersion = 0
73
74
int sectionNumber = 0
@@ -84,6 +85,9 @@ class Tester {
84
85
// i.e. 'arg.volumes' becomes 'volumes' (also contains expanded ranges)
85
86
List<String > optionNames = []
86
87
def optionDefaults = [:]
88
+ // Files created by the entire test collection.
89
+ // Defined in the 'setup_collection.creates' block.
90
+ def collectionCreates = []
87
91
88
92
/**
89
93
* The run method.
@@ -108,6 +112,7 @@ class Tester {
108
112
take(currentTestFilename. length() - testExt. length())
109
113
sectionNumber = 0
110
114
testScriptVersion = 0
115
+ testTimeoutSeconds = 30
111
116
112
117
// We must not have duplicate test files -
113
118
// this indicates there are pipelines in different projects
@@ -127,7 +132,7 @@ class Tester {
127
132
extractOptionsFromCurrentServiceDescriptor()
128
133
129
134
// Now run each test found in the test spec
130
- // (also checking for a `setup_collection` and `version` sections).
135
+ // (also checking for `setup_collection` and `version` sections).
131
136
def test_spec = new ConfigSlurper (). parse(new File (path). toURI(). toURL())
132
137
for (def section : test_spec) {
133
138
@@ -462,10 +467,18 @@ class Tester {
462
467
info(' Processing setup_collection section' )
463
468
464
469
// Extract key setup values, supplying defaults
465
- int timeoutSeconds = setupSection. value. get(' timeout' )
466
- if (timeoutSeconds != null ) {
467
- info(" Setup timeout=$timeoutSeconds " )
468
- testTimeoutSeconds = timeoutSeconds
470
+ if (setupSection. value. timeout != null ) {
471
+ int timeoutSeconds = setupSection. value. get(' timeout' )
472
+ if (timeoutSeconds != null ) {
473
+ info(" Setup timeout=$timeoutSeconds " )
474
+ testTimeoutSeconds = timeoutSeconds
475
+ }
476
+ }
477
+
478
+ // Globally-defined created files?
479
+ collectionCreates = []
480
+ if (setupSection. value. creates != null ) {
481
+ collectionCreates = setupSection. value. get(' creates' )
469
482
}
470
483
471
484
}
@@ -519,6 +532,8 @@ class Tester {
519
532
*
520
533
* - creates
521
534
* An optional list of file names (regular expressions).
535
+ * Entries in this list are added to any defined in the creates
536
+ * block in the setup_collection section.
522
537
*
523
538
* - does_not_create
524
539
* An optional list of file names (regular expressions).
@@ -632,13 +647,17 @@ class Tester {
632
647
boolean validated = true
633
648
if (exitValue == 0 ) {
634
649
650
+ List<String > testCreates = collectionCreates
651
+ if (createsBlock != null ) {
652
+ testCreates. addAll(createsBlock)
653
+ }
635
654
// Do we expect output files?
636
655
// Here we look for things like "output*" in the
637
656
// redirected output path.
638
- if (testOutputPath != null && createsBlock != null ) {
657
+ if (testOutputPath != null && testCreates . size() > 0 ) {
639
658
def createdFiles = new FileNameFinder ().
640
659
getFileNames(testOutputPath. toString(), " *" )
641
- for (String expectedFile in createsBlock ) {
660
+ for (String expectedFile in testCreates . unique() ) {
642
661
boolean found = false
643
662
for (String createdFile in createdFiles) {
644
663
if (createdFile. endsWith(expectedFile)) {
0 commit comments