4
Upstarts unit tests are run via::
11
Python 3 scripts that make use of the ``pyupstart.py`` test module.
12
There are 2 classes of integration tests:
14
Session-level Integration Tests
15
-------------------------------
17
These can be run as a non-root user or as root. Ideally, run them as
22
$ cd scripts/tests && ./test_pyupstart_session_init.py
24
The tests make use of some of the sample Job Configuration (``.conf``)
25
files shipped with Upstart. However, if the
26
``UPSTART_TEST_USE_INSTALLED_CONF`` variable is set to any value, if the
27
tests find an *installed* session job of the same name, they will use
28
those jobs instead. The current sample jobs the tests use are:
31
- ``upstart-file-bridge.conf``
33
System-level Integration Tests
34
------------------------------
36
These tests must be run as ``root`` (the tests will be skipped if called
37
by a non-root user) and operate on the PID 1 executable. The tests will
38
create a subdirectory below ``/etc/init/`` in an attempt to isolate
39
themselves from the rest of the system. However, these tests are
40
designed to be run *on test systems only*.
42
The tests also exercise the chroot abilities of Upstart. If the
43
environment variable ``UPSTART_TEST_CHROOT_PATH`` is set and points to a
44
valid chroot in which Upstart is installed this chroot will participate
47
To run the system-level integration tests::
50
# export UPSTART_TEST_CHROOT_PATH=/full/path/to/chroot
51
# cd scripts/tests && ./test_pyupstart_system_init.py
53
Running All the Tests Together
54
------------------------------
56
WARNING: Running the tests as ``root`` in this way will modify your
57
``/etc/init/`` directory. See `System-level Integration Tests`_.
59
You can make use of python3's unittest module to run all the tests in
62
$ cd scripts && python3 -munittest
64
# cd scripts && python3 -munittest