Skip to content

mozilla/version-control-tools

Repository files navigation

Mozilla Version Control Tools

This repository contains tools, extensions, hooks, etc to support version control at Mozilla.

Most documentation exists in the docs/ directory. It can be viewed online on Read the Docs.

Contributing

Testing

To create a test environment and run tests, you should use the ./run script at the root of the repository. This script wraps common docker-compose commands to provide better ergonomics and good testing defaults.

The test runner and all it's dependencies are contained in a Docker image. The state of your version-control-tools checkout is mounted into the container built from that image and tests are run inside the container using the source on your host's filesystem. To do this, a .env file must be created to tell the container about which user on the host system is running the tests.

You can run the following command to create a .env file:

  ./run env > .env

Now you can run the tests via:

  ./run tests path/to/test --with-hg=5.3.2

Ansible-to-Docker Cluster

The configuration of the production server is managed by the Ansible configs in ansible/. To test these configs and much of the code that depends on them, we have a custom Docker image build process which applies the Ansible roles to Docker images and creates a mock cluster of Docker containers that is mostly identical to the production hosts of hg.mozilla.org.

Running these tests is slow and uses a lot of CPU resources. It is recommended to use -j to limit the number of concurrently running tests. If you don't want to run the Ansible-to-Docker cluster tests, you can use the --no-docker flag when running the tests.