Unable to stop executing checks with 3.2.2

Ton Voon tonvoon at gmail.com
Mon Sep 20 09:51:32 CEST 2010


On 19 Sep 2010, at 11:51, Stephen Gran wrote:

> On Sat, Sep 18, 2010 at 06:57:54PM +0100, Ton Voon said:
>> The test_events.c passes with this change. However, it would be best
>> if a testcase could be written for the problem this is trying to
>> solve, which fails without the patch and passes with the patch. This
>> will ensure the problem will continue to get visibility in future.
>>
>> If you create that testcase, I'd be more than happy to apply.
>
> So I've been looking at the various test cases you already have, and  
> I'm
> not sure if it's going to be simpler to try to plug it into  
> test_events.c
> or create a new one

I don't mind as long as the test is written in a way that can be rerun  
to confirm success in TAP output.

More docs at http://wiki.nagios.org/index.php/Nagios_Core_Developer_Guidelines#Testing

However, I'm guessing you'll find it easier to add more tests to  
test_events.c than to create a whole new test_events2.c.

> , so I'm going to outline my thoughts and ask for a
> recommendation.
>
> The things that this patch addresses and should be tested are (in  
> pseudo
> code):
>
> if execute_service_checks == 1 and execute_host_checks == 1:
>    failed service_check schedules a host_check and executes it
>    service_check is rescheduled
>
> else if execute_service_checks == 0 and execute_host_checks == 1:
>    service_check is rescheduled instead of executed
>    host_check is scheduled at it's normal interval and executed
>
> else if execute_service_checks == 1 and execute_host_checks == 0:
>    failed service_check schedules a host_check
>    host_check is rescheduled instead of run
>    service_check is rescheduled
>
> else if execute_service_checks == 0 and execute_host_checks == 0:
>    a service_check is rescheduled
>    a host_check is rescheduled
>
> That covers my understanding of how the scheduling should work.

This looks about right though, to be honest, I've never delved deeply  
into this logic so I can't verify.

>
> Any advice on where to put that?  I admit at first glance I am  
> slightly
> daunted by the prospect of learning your test harness for the logic
> above, but I'm willing to try.

The first thing is: can you get the test_events C code to execute  
without failure?

The 2nd is to code your scenarios above. The tricky thing here is that  
you have to setup all the appropriate variables, then execute  
event_execution_loop(). As you success criteria is based on whether  
certain events were executed or not, you could probably work this out  
by checking the last_check and next_check for specific host/services  
afterwards.

I look forward to see those tests!

Ton


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev




More information about the Developers mailing list