Hello,
first of all - thank you for these great questions James.
On 02/22/2010 06:25 PM, James Laska wrote:
Nice work! Josef, I see you have multiple tests (runtest.sh) for
different packages. Can you describe how the tests differ, and also,
how they are similar?
Sure. Basically all the initscript tests should have pretty much
identical structure .
1) check if the respective package is installed - the test it self does
not try to install the package though. I spoke with Petr Splichal and he
told me, that required packages are specified in Makefile, which also
tries to install the package. The mentioned assert is there just to
check, if the installation was successfull, and to let the tester know,
if it failed. (This means, that i need to change the python script
runner a bit, but it's no big deal and will be done probably before you
even get to read this email :) )
2) prepare configuration files - none of the scripts present in git has
this part - here, the test should backup existing config files, and
create it's own.
3) check for mandatory actions according to LSB (start, stop, restart,
force-reload, status)
4) tests of each action - here we check, if the initscript returns the
right exit code for each command and state the service is in (for
example, if service XYZ status returns 3 for stopped service)
5) status action checks for stopped service with existing Lock/PID file.
Do we need to think about whether these tests may leave the system in
an
unknown state after execution?
All an all, these tests should not at all be destructive, but they might
leave the tested service in other state, than it was at the beginning of
the test (e.g. the service was stopped at the beginning of the test, but
is running when the test ends).
Moreover they will install the package, which is being tested, so one
could end up having new package installed.
joza