Skip to content
This repository has been archived by the owner on Sep 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #83 from cisco-open/fix/redundant-warning/SDK-589
Browse files Browse the repository at this point in the history
fix(console-exporter): rm redundant warning for debug exporter
  • Loading branch information
nemoshlag authored May 24, 2022
2 parents ce03de6 + 2426a71 commit e32e6da
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cisco_telescope/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ def __init__(
if self.exporter_type not in project_consts.ALLOWED_EXPORTER_TYPES:
raise ValueError("Unsupported exported type")

if not self.collector_endpoint:
if (
self.exporter_type is not project_consts.CONSOLE_EXPORTER_TYPE
and not self.collector_endpoint
):
logging.warning(
"Warning: Custom exporter is set without collector endpoint"
)
Expand Down
13 changes: 12 additions & 1 deletion tests/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
limitations under the License.
"""
import os
from distutils.util import strtobool
import unittest
from unittest import mock

Expand Down Expand Up @@ -118,6 +117,18 @@ def test_missing_collector_url_warning(self):
"Warning: Custom exporter is set without collector endpoint",
)

def test_rm_collector_url_warning_on_console_exporter(self):
with self.assertLogs() as captured:
captured.records.append(
"dummy record to ensure no real record was generated"
)
_ = options.ExporterOptions(exporter_type=consts.CONSOLE_EXPORTER_TYPE)
self.assertEqual(len(captured.records), 1)
self.assertEqual(
captured.records[0],
"dummy record to ensure no real record was generated",
)

@mock.patch.dict(
os.environ,
{
Expand Down

0 comments on commit e32e6da

Please sign in to comment.