Before commit7dc24868, when process.env was nil, prepareEnv returned a flag telling HOME is not set, and it was added. Commit7dc24868moved the functionality of adding HOME into prepareEnv but did not properly handle nil case. As a result, runc exec -p with process.json having no env set resulted in an exec with no HOME set. Fix this, and add unit and integration tests. Fixes:7dc24868("libct: switch to numeric UID/GID/groups") Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
runc Integration Tests
Integration tests provide end-to-end testing of runc.
Note that integration tests do not replace unit tests.
As a rule of thumb, code should be tested thoroughly with unit tests. Integration tests on the other hand are meant to test a specific feature end to end.
Integration tests are written in bash using the bats (Bash Automated Testing System) framework. Please see bats documentation for more details.
Running integration tests
The easiest way to run integration tests is with Docker:
make integration
Alternatively, you can run integration tests directly on your host through make:
sudo make localintegration
Or you can just run them directly using bats
sudo bats tests/integration
To run a single test bucket:
make integration TESTPATH="/checkpoint.bats"
To run them on your host, you need to set up a development environment plus bats (Bash Automated Testing System).
For example:
cd ~/go/src/github.com
git clone https://github.com/bats-core/bats-core.git
cd bats-core
./install.sh /usr/local
Writing integration tests
Helper functions are provided in order to facilitate writing tests.
Please see existing tests for examples.