Testing Minion Locally
For the following example I will use this repository: https://bitbucket.org/touchcastllc/test-minion-container
But should work for any other minion repository if you don’t have access or don’t know about this project
Building Docker Image
The best way to test minion locally is through the docker image, so you first need to clone:
git clone git@bitbucket.org:touchcastllc/test-minion-container.git
And then run the build
make build
That will generate a local image, in this case is called test-minion-container:latest
(the name is usually in the first lines of the Makefile
)
Commands
The repository contains the following commands:
test:simple
test:error
test:files
Test command
The docker message is:
docker run --rm -ti \
-e TCDOCKER_MESSAGE='JSON_TEXT' \
test-minion-container:latest
The test:simple
will just print some params and return fine, an example of command is:
so the inline command is
This will output:
Error command
This is a test more for integration as will stop processing when sees an error, but you can trigger the error and check the output:
message
inline command
output will be:
File references
The system will either use local files for testing or download files from a message; the general way to do is:
dispatcher sdk will create a task group
dispatcher sdk will upload files into task group, for example let’s say upload a file called
test.txt
the file must be passed in params (input or option) with following prefixes:
taskfile://FILENAME
to use files uploaded from dispatcher sdktaskfile-output://
to either set output files or reuse files from a previous task (when chaining tasks)
so for example if a command takes two inputs, one for the input file and the other for the file to write, it can be called like this:
Using local files
To test local files you will need the following:
assign a environment variable called
TCDOCKER_TASK_ID=local
mount a local folder mounted
/workspace
-v /path/to/folder:/workspace
the local folder must contain two directories:
input
andoutput
The input message will be like this:
In order to run you will need to create a tmp dir:
Run the command:
The output will be like this:
There should be a output file in the /tmp/test-minion-files/output
You can call again using this file as input (command chaining)
And there should be a new file in the output folder:
Uploading files
TODO