Running with Docker
This section explains how to run the RSMP Validator using Docker. You can also install locally.
Setup
-
Download and install Docker.
-
Create a local folder for storing validator configurations. It will serve the same purpose as the config folder when you install manually.
-
Create a configuration file for the equipment, simulator or supervisor that you want to test. Check out an example for TLC emulator build into the the rsmp Ruby gem, or ream more about site test configurations and supervisor test configurations.
-
Create a validator.yaml file inside you config filer and edit it to point to the test config that you created above. (Or as an alternative, set
SITE_CONFIG
orSUPERVISOR_CONFIG
when you run the validator).
Run from the Terminal
You run the validator be starting the container. You must mount the config folder you create above, so the validator can read files in it. Assuming the config folder you created is at ./config, you can use $PWD to construct the absolute path:
% docker run --name rsmp_validator -it -v $PWD/config:/config -p 13111:13111 ghcr.io/rsmp-nordic/rsmp_validator
By default the validator listens on port 13111 when testing rsmp sites. The port must be mapped using the -p
option, as shown above.
After running, you can start the container again to re-run the same set of test and options with:
% docker start -a rsmp_validator
To run with different options, remove the container and run again with different options. You can pass --rm
when running to automatically remove the container after each completion. See the Docker docs for more info about managing containers.
Custom Options
You can pass custom options to the validator, e.g. to run specific tests, filter tests by tags or use a custom reporting format.
Use the detailed log format:
% docker run --name rsmp_validator -it -v $PWD/config:/config -p 13111:13111 ghcr.io/rsmp-nordic/rsmp_validator spec/site/core --format Validator::Details
Run a specific test:
% docker run --name rsmp_validator -it -v $PWD/config:/config -p 13111:13111 ghcr.io/rsmp-nordic/rsmp_validator spec/site/tlc/detector_logics_spec.rb:31
Log Files
By default, the validator produce a single output which will be send to the terminal. If you like you can direct this output to a file to keep it.
The validator also has the option to produce mulitple outputs, directing some to files. When running with Docker, this would by default be to files inside the container. If you remove the container, the files will be lost. If you want to persists these extra log files on the host, you can mount a log folder and write logs to it:
% docker run --name rsmp_validator -it -v $PWD/config:/config -v $PWD/log:/log -p 13111:13111 ghcr.io/rsmp-nordic/rsmp_validator spec/site/core --format Validator::Brief --format Validator::Details --out log/validation.log
Run from Docker Desktop
You can also run tests from Docker Desktop. Find rsmp_validator
in the images tab and press Run
, Select Optional settings and then enter:
- Ports:
13111
- Volumes:
- Host path: Select the folder you created in step 1
- Container Path:
/config
Start the container by cliking ‘Run’. The log output is shown in Docker Desktop.
Default test set
By default the container will run tests in these two folders:
spec/site/core
: tests covering the RSMP Core spec, which apply to all types of sites (equipment).spec/site/tlc
: test for TLCs (Traffic Light Controller).
This default set of tests is defined in the CMD directive of the Dockerfile used to build the Docker image.
To change the set of tests run, you could modifify the CMD directive in the Dockerfile and rebuild the image. But usually it’s easier to just override pass custom arguments to the docker run
command, as shown above.
Available Images
The latest commit of the master branch is available under the docker tags latest
, and also as master
.
Our docker images are publish on Github Container Registry. Check the available images on github.