Skip to content

Commit d47ad5d

Browse files
author
Alan Christie
committed
- Early support for 'creates' section (passed initial tests)
1 parent 238bcdb commit d47ad5d

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/groovy/PipelineTester.groovy

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ class Tester {
8484
// i.e. 'arg.volumes' becomes 'volumes' (also contains expanded ranges)
8585
List<String> optionNames = []
8686
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 = []
9187

9288
/**
9389
* The run method.
@@ -112,8 +108,6 @@ class Tester {
112108
take(currentTestFilename.length() - testExt.length())
113109
sectionNumber = 0
114110
testScriptVersion = 0
115-
creates = []
116-
doesNotCreate []
117111

118112
// We must not have duplicate test files -
119113
// this indicates there are pipelines in different projects
@@ -272,7 +266,7 @@ class Tester {
272266
*/
273267
private separate() {
274268

275-
println "-------"
269+
println "-------"
276270

277271
}
278272

@@ -632,7 +626,7 @@ class Tester {
632626

633627
// If command execution was successful (exit value of 0)
634628
// then:
635-
// - check that an output file was created (if expected)
629+
// - check that any declared _creates_ output files were created
636630
// - iterate through any optional _see_ values,
637631
// checking that the pipeline log contains the defined text.
638632
boolean validated = true
@@ -642,20 +636,18 @@ class Tester {
642636
// Here we look for things like "output*" in the
643637
// redirected output path.
644638
if (testOutputPath != null && createsBlock != null) {
645-
def outputFiles = new FileNameFinder().
639+
def createdFiles = new FileNameFinder().
646640
getFileNames(testOutputPath.toString(), "*")
647-
for (String create in creates) {
648-
println "+++++ " + create
641+
for (String expectedFile in createsBlock) {
649642
boolean found = false
650-
for (String outputFile in outputFiles) {
651-
println ">>>>> " + outputFile
652-
if (outputFile.endsWith(create)) {
643+
for (String createdFile in createdFiles) {
644+
if (createdFile.endsWith(expectedFile)) {
653645
found = true
654646
break
655647
}
656648
}
657649
if (!found) {
658-
err("Expected output file '$creste' but couldn't find it")
650+
err("Expected output file '$expectedFile' but couldn't find it")
659651
validated = false
660652
break
661653
}

0 commit comments

Comments
 (0)