Closed yaleman closed 6 months ago
@hetangmodi-crest and @kkedziak-splunk can you please take a look?
@yaleman, Ideally, we shouldn't alter/tweak source code to make the tests work unless there is a problem in the source code. This library would be present in a Splunk environment (docker, enterprise or cloud), as it is used in add-ons that are installed in a Splunk environment.
Perhaps, can you try to mock the calls or the imports of solnlib.Logs
in your test cases? Alternatively, you spin up a docker image of Splunk and leverage that environment for your test cases.
I guess I'll mock out the module in that case, thanks.
As part of automated unit testing I'd normally expect to be able to init my modular input and be able to run it, but the following call assumes that the module's running in a Splunk environment, because it tries to execute btool in a shell:
https://github.com/splunk/addonfactory-ucc-library/blob/170959f1daffd486de774cee484f55a6b8a0c3c6/splunktaucclib/modinput_wrapper/base_modinput.py#L67
Can you make the initialization of this optional? It seems excessive to shell out to
btool
to generate a log path if I'm trying to test functionality using pytest etc.