[Nagiosplug-devel] Preparation for release 1.4.11
Andreas Ericsson
ae at op5.se
Tue Dec 11 22:12:32 CET 2007
Thomas Guyot-Sionnest wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 11/12/07 09:29 AM, Andreas Ericsson wrote:
>> Thomas Guyot-Sionnest wrote:
>>> On 11/12/07 05:19 AM, Ton Voon wrote:
>>>> test_base64.t:
>>>> My opsviewdev1 box
>>>>
>>>> I'll look into the two boxes that I own. I'm surprised that
>>>> test_base64 is failing given the simplicity of the test and the code.
>>>> Any ideas on why this is?
>>>>
>>>> Also, I think Holger mentioned that the logs were not very interesting
>>>> as they do not show enough detail. I'll see if there is a switch in
>>>> Test::Harness to dump extra information.
>>> Dumping each command ran in verbose mode would be awesome. I find myself
>>> often trying to reproduce what was actually run to find what certain
>>> tests failed.
>>>
>> If you're looking at reworking/improving the test-suite, sneak a peek at
>> what git uses. It's quite amazingly simple to add additional tests to it,
>> although it doesn't solve the worst issue with the plugins (environment
>> to test in). Oh, and it's in shell, so even us poor perl illiterate folks
>> can join in on the testing frenzy ;-)
>
> What you do with git looks nice but do you have a simple tutorial to
> start with (hint: apart the fact that it's the Linux kernel's RCS I know
> absolutely nothing about it)? ;)
>
Well, the git docs are here: http://www.kernel.org/pub/software/scm/git/docs/
But you should be able to grab a tar-ball and just have a look at any
file under t/ to get an idea of how to write tests using the test-lib
we've cooked up for git.
In short though, it works like this:
--%<---%<---%<---
. test-lib.sh
test_description 'A simple test for sed'
test_expect_success 'Test single char substitution' \
'
var=$(echo foo | sed s/f//)
test "$var" = "oo"
'
test_done
---%<---%<---%<---
Which would produce the following output
* ok 1: Test single char substitution
* passed all 1 test(s)
with the last line printed in green when all tests pass, and in red
when any of them fail.
One can stack any amount of tests between test_description and test_done.
The really nifty thing about this mode of testing is that each test is
a shell-script on its own, so it's easy to set up a small environment
for the commands that need it using plain shell commands between tests.
We're looking into using it for pretty much everything except neb-modules
at the moment (nebs always need their own tester).
Tests can also be skipped quite easily if some predefined criteria isn't
matched, such as a certain program not being installed or some such.
Ah well, I'll stop preaching and go back to fiddling with Nagios' config
reading instead. It's just that wretched template chaining left before
it's done.
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
More information about the Devel
mailing list