fix: add Splunk HEC token validation for external Splunk #877
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds validation of HEC token. It just checks if an event can be send via given HEC token to external Splunk.
![image](https://private-user-images.githubusercontent.com/147069837/355810172-95bd1c7c-d6ed-43d7-8249-7475e4760808.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjA1NjIsIm5iZiI6MTczOTU2MDI2MiwicGF0aCI6Ii8xNDcwNjk4MzcvMzU1ODEwMTcyLTk1YmQxYzdjLWQ2ZWQtNDNkNy04MjQ5LTc0NzVlNDc2MDgwOC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQxOTExMDJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05YmYwNmVmYzYwMGM2NGM0OWQ0NmZkNTk2ZmNkNDYxZTFiOGQxMDY5ZDZkNWNmMmI2M2M2MzhjNzAyNDVmOGVlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.1CgFeXoO1X0j6o_KeWMv2eg_0LSy3I2mvu6cXh9jtgs)
Fix was tested locally. The result for 3 workers are presented in the attached screenshot (with pytest-splunk-addon code from develop branch it breaks main worker , restarts it and wait indefinitely).
Although splunk_external fixture is defined in the session scope it runs on each worker separately.
The following question arises: is it expected behaviour, or it's something we'd like to change (for the fixture logic to be executed before pytest splits for several processes). I do not believe that we have to check if Splunk is responsive from each worker separately. That would need to be explored (such solution might not be compatible with pytest):