Tugbot Leader is a Continuous Testing Framework for Docker Swarm based production/staging/testing environment. Tugbot Leader executes Docker Swarm Test Services upon some event.
Test Service is a regular Docker swarm service. Docker LABEL
is used to discover test service and Tugbot related test metadata. These labels can be specified at runtime, using --label
of docker service create
option.
Tugbot Leader will trigger a sequential test service execution upon event (see tugbot-swarm-events
label). In order to collect test results and depoly those results to elasticsearch, for example, you should add tugbot-collect related labels (see tugbot-results-dir
label).
All Tugbot labels must be prefixed with tugbot-
to avoid potential conflict with other labels.
Tugbot labels are divided into:
- Container labels:
tugbot-results-dir
- directory, where test container reports test results; default to/var/tests/results
- Swarm Service labels:
tugbot-swarm-events
- list of comma separated Docker Swarm events (currently only service update is supported)
#####Example Docker Swarm Test Service creation:
docker service create --network my_net --replicas 1 --restart-condition none --label tugbot-swarm-events=update --name mytest my-test-img
It is highly recommended to determain
--restart-condition none
when creating a test service. Otherwise, Swarm will restart test service all the time (default “any”).
Use
--label tugbot-swarm-events=update
to tell tugbot framework that this is a test service that should be updated each time an application service is updated.
docker run -d -e DOCKER_HOST=<Address> -e DOCKER_CERT_PATH=<Docker Certificate Path> --log-driver=json-file --name tugbot-leader gaiadocker/tugbot-leader
DOCKER_HOST
- Docker Swarm Master host address (Tugbot Leader should run as part of Docker Swarm Master in order to update Docker Swarm Services).DOCKER_CERT_PATH
- dirctory should contain: ca.pem, cert.pem and key.pem. While using Docker secure communication.DOCKER_TLS_VERIFY
- Use TLS when connecting to the Docker socket and verify the server's certificate.TUGBOT_LEADER_INTERVAL
- Interval time between polling Docker Swarm for list of updated services (currently docker is not exposing Swarm events, this is why Tugbot Leader is polling the Swarm master node). An interval string is a possibly signed sequence of decimal numbers, each with optional fraction and a time unit suffix, such as "300s", "1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".TUGBOT_LEADER_LOG_LEVEL
- Enable debug mode. When this option set todebug
you'll see more verbose logging in the Tugbot Leader log file.