Skip to content

Commit b97e16e

Browse files
author
Alan Christie
committed
- Changes after retest with and without Docker
- Output restructuring - Support for POUT environment (PIN is automatic)
1 parent c0f8732 commit b97e16e

File tree

7 files changed

+123
-104
lines changed

7 files changed

+123
-104
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,20 @@ run the following Gradle command from here: -
7373
$ ./gradlew runPipelineTester
7474

7575
### In Docker
76-
You can run the pipeline tests in Docxker using their expected container
76+
You can run the pipeline tests in Docker using their expected container
7777
image (defined in the service descriptor). Doing this gives you added
7878
confidence that your pipeline will work wen deployed.
7979

80-
To run in Docker you need to add the `-d` or `--indocker` command-line
81-
argument. To pass these variables through Gradle into the pipeline tester
82-
run the tests like this: -
83-
84-
$ ./gradlew runPipelineTester -Pptargs=-d
85-
86-
Or by using the Docker-specific gradle command:
80+
You can use the docker-specific Gradle task: -
8781

8882
$ ./gradlew runDockerPipelineTester
8983

84+
Or, by add the `-d` or `--indocker` command-line argument into the basic
85+
task. To pass these variables through Gradle into the pipeline tester
86+
run the Docker tests like this: -
87+
88+
$ ./gradlew runPipelineTester -Pptargs=-d
89+
9090
> When you run _in docker_ only the tests that can run in Docker (those with
9191
a defined image name) will be executed. Tests that cannot be executed in
9292
Docker will be _skipped_.

pipeline.test.template

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,12 @@
3131
// file. Individual tests can define their own test-specific files
3232
// with their own 'creates' block, discussed later in this file.
3333
//
34-
// pin: This property can be used to over-ride the automatically
35-
// generated data input path (which is typically the repository's
36-
// own data directory. This allows you to use date outside the
37-
// repository - maybe because it's a large file or an experimental
38-
// file.
39-
//
4034
// There can only be one setup_collection section and it must be
4135
// the first section in the file.
4236

4337
setup_collection = [
4438
timeout: 10,
45-
creates: [ 'output.txt' ],
46-
pin: /Users/alan/data
39+
creates: [ 'output.txt' ]
4740
],
4841

4942
// Individual tests.
@@ -68,7 +61,12 @@
6861
// If a test is not working an you want to keep it and avoid running it
6962
// then simply prefix the test section name with `ignore_`.
7063
//
71-
// The location of any input data you provide in your test
64+
// The location of any input data you provide in your test is normally
65+
// located in the project's `data` directory or mounted as `/data`
66+
// when running in a container. You can safely refer to data in both cases
67+
// with the PIN environment variable created by the PipelineTester.
68+
// To allow execution from the command-line and in a container the input
69+
// data file `blob.dat` should be referred to using `${PIN}blob.dat`
7270

7371
test_1 = [
7472

@@ -80,7 +78,7 @@
8078
// If you provide a command you **cannot** provide parameters
8179
// (see the params section below).
8280

83-
command: ```python my_own_command
81+
command: ```python my_own_command -i ${PIN}blob.dat
8482
--my-own-param-1 32
8583
--my-own-param-2 18.5```,
8684

src/groovy/ContainerExecutor.groovy

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,19 @@
2323
class ContainerExecutor {
2424

2525
/**
26-
* Executes the given command in the supplied container image.
26+
* Executes the given command in the supplied container image. The data
27+
* directory (pin) is mounted as `/data` in the running container
28+
* and the designated output directory (pout) is mounted in the container
29+
* as `/output`. Two environment variables are defined: PIN and POUT and
30+
* are set to `/data` and `/output` respectively. The script is executed in
31+
* the output directory in the container.
2732
*
28-
* @param imageName The image to run the command in
2933
* @param command The command to run
34+
* @param imageName The image to run the command in
35+
* @param pin The pipeline input directory
36+
* (used to define the PIN environment variable)
37+
* @param pout The pipeline output directory
38+
* (used to define the POUT environment variable)
3039
* @param timeoutSeconds The time to allow for the command to execute
3140
* @return A list containing the STDOUT and STDERR encapsulated in a
3241
* StringBuilder(), an integer command exit code and a timeout

src/groovy/PipelineTester.groovy

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,25 @@
1616
* limitations under the License.
1717
*/
1818

19-
import Tester
20-
2119
/**
2220
* The PipelineTester. A groovy script for the automated testing
2321
* of Informatics Matters pipeline scripts. This utility searches for
24-
* pipeline test files and then loads and executes them.
22+
* pipeline `.test` files and then loads and executes them.
2523
*
2624
* `pipeline.test.template` is template that can be used as to create your
2725
* own tests. Read its inline documentation to understand how it is used
2826
* within this framework.
2927
*
3028
* Depending on your pipeline's requirements you may need to execute this
3129
* the PipelineTester within a suitable execution environment like Conda.
32-
*
33-
* Typical execution is from this project's root using Gradle: -
34-
*
35-
* gradle runPipelineTester
36-
*
37-
* ...or with an abbreviated task name like:
38-
*
39-
* gradle rPT
40-
*
41-
* This utility has been tested with groovy v2.4
4230
*/
4331

4432
// Version
4533
// Update with every change/release
4634
String version = '2.0.0'
4735

4836
println "+----------------+"
49-
println "| PipelineTester | (v$version)"
37+
println "| PipelineTester | v$version"
5038
println "+----------------+"
5139

5240
// Build command-line processor

src/groovy/ShellExecutor.groovy

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
*/
1818

1919
/**
20-
* The PipelineTester Executor class. The class is responsible for executing
21-
* a pipeline command using the command-line.
20+
* The PipelineTester Shell (command-line) Executor class. The class is
21+
* responsible for executing a pipeline command using the command-line.
2222
*/
2323
class ShellExecutor {
2424

2525
/**
26-
* Executes the given command in the supplied execution directory.
26+
* Executes the given command using the shell in the supplied execution
27+
* directory.
2728
*
2829
* @param command The command to run
2930
* @param edir The directory in which to run the command

0 commit comments

Comments
 (0)