How to mock journal related methods

Nagaraju Goruganti ngorugan at in.ibm.com
Thu Jun 28 00:26:36 AEST 2018


Hi Team,

I am writing unit test-cases to phospher-logging server.

As it gets information form the journal log for event and logging 
creation,it needs to make calls to
below given journal related methods:

sd_journal_open(sd_journal**,int)(
https://github.com/openbmc/phosphor-logging/blob/master/log_manager.cpp#L86
)
sd_journal_get_data(sd_journal*,const char *,const void **,size_t) (
https://github.com/openbmc/phosphor-logging/blob/master/log_manager.cpp#L115
)
sd_journal_close(sd_journal *) (
https://github.com/openbmc/phosphor-logging/blob/master/log_manager.cpp#L175
)

I am able make calls to these methods, without any issue, on host 
machine(inside x86 sandbox) where we don't have journal service is 
running.

Is it the correct way(don't we need to mock these methods) ? 

If not, Please someone let me know how to mock these methods?



Thanks and Regards,
Nagaraju G

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20180627/46541b55/attachment-0001.html>


More information about the openbmc mailing list