Planet Ceph

Aggregated news from external sources

October 7, 2014

Ceph make check in docker

After Ceph is built from sources, unit and functional tests can be run with make check. Delegating the execution to a container makes it possible to:

  • keep working on the sources without disrupting the run
  • run functional tests that require root privileges without modifying the development environment
  • check various operating systems

The src/test/ library can be used from the command line:

$ test/ --os-type ubuntu --os-version 14.04 make check &
$ test/ --os-type centos --os-version centos7 make check &

Each run uses a clone of the current repository and pulls from origin before executing the command. For instance, if running from /srv/ceph, the centos run will run make check in /srv/ceph-centos-centos7 which is bind mounted in the container. A possible workflow is:

  • work
  • commit
  • test/ make check which pulls the latest commits
  • keep working
  • check the make check output

In case an error happens, debugging starts by running a shell in the container

$ test/ --os-type ubuntu --os-version 14.04 --shell
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 10 (delta 8), reused 0 (delta 0)
Unpacking objects: 100% (10/10), done.
From /home/loic/software/ceph/ceph
 + 15046fe...8a39cad wip-9665 -> origin/wip-9665
HEAD is now at 8a39cad autotools: add --enable-docker

The first time test/ runs, it creates a docker images populated with the packages necessary to compile and run Ceph. This lowers the overhead to run a test in the container:

$ time test/ --os-type ubuntu --os-version 14.04 unittest_str_map
HEAD is now at 8a39cad autotools: add --enable-docker
Running main() from
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from str_map
[ RUN      ] str_map.json
[       OK ] str_map.json (1 ms)
[ RUN      ] str_map.plaintext
[       OK ] str_map.plaintext (0 ms)
[----------] 2 tests from str_map (1 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (1 ms total)
[  PASSED  ] 2 tests.

real	0m3.340s
user	0m0.071s
sys	0m0.046s