Skip to content

Commit

Permalink
Add assert_metadata option
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreYang committed Mar 11, 2020
1 parent e5deb1a commit 1a00a76
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions datadog_checks_base/datadog_checks/base/stubs/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,16 @@ def _assert_metric_using_metadata(self, metric_stub):
warnings.warn(error_msg)

def assert_metric(
self, name, value=None, tags=None, count=None, at_least=1, hostname=None, metric_type=None, device=None
self,
name,
value=None,
tags=None,
count=None,
at_least=1,
hostname=None,
metric_type=None,
device=None,
assert_metadata=True,
):
"""
Assert a metric was processed by this stub
Expand Down Expand Up @@ -264,7 +273,8 @@ def assert_metric(

candidates.append(metric)

self._assert_metric_using_metadata(metric)
if assert_metadata:
self._assert_metric_using_metadata(metric)

expected_metric = MetricStub(name, metric_type, value, tags, hostname, device)

Expand Down

0 comments on commit 1a00a76

Please sign in to comment.