[kea-dev] How to properly test callouts?
tomasz at isc.org
Wed Nov 5 18:37:01 UTC 2014
On 05.11.2014 19:01, Marcin Wyszynski wrote:
> Hello Marcin,
Hello Marcins ;)
> The question now is - if I want to test my pkt4_receive function, how do I create a CalloutHandle if the definition for CalloutManager needed for the only CalloutHandle constructor is explicitly not exported?
It's done on purpose, so users don't create it. The reason is that we
don't want people to go too deeply with the server side code when
implementing hooks. The reason for this is that we may change something
deep inside the code in future releases. If you just use hooks API, your
application should recompile and run fine. On the other hand, if you
take use of how currently the code is implemented, you may experience
issues when we change something.
Having said that, this is open source, so we can't really forbid that.
We're just trying to discourage people.
> It would be awesome if for our purposes CalloutManager could be created in a test suite:
Have you looked at HooksDhcpv4SrvTest.Buffer4ReceiveSimple,
They are relatively simple tests that are simulating packet reception to
trigger buffer4_receive and pkt4_receive (and other hook points).
Maybe you could build your unit-tests upon them?
On a related note, your request for this came at a really bad time.
Marcin and I are in the final preparation stages for IETF and a vacation
I just saw your pull request. It's very simple - just export the header.
I suppose we can do that :)
Hope that helps,
More information about the kea-dev