Skip to content

Commit

Permalink
Fix regression in assert_metric for value comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreYang committed Jul 9, 2019
1 parent 2d585e8 commit 9fa7311
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions datadog_checks_base/datadog_checks/base/stubs/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ def assert_metric(self, name, value=None, tags=None, count=None, at_least=1, hos
if value is not None and candidates and all(self.is_aggregate(m.type) for m in candidates):
got = sum(m.value for m in candidates)
msg = "Expected count value for '{}': {}, got {}".format(name, value, got)
condition = len(candidates) == count
condition = (value == got)
elif count is not None:
msg = "Needed exactly {} candidates for '{}', got {}".format(count, name, len(candidates))
condition = len(candidates) == count
condition = (len(candidates) == count)
else:
msg = "Needed at least {} candidates for '{}', got {}".format(at_least, name, len(candidates))
condition = len(candidates) >= at_least
condition = (len(candidates) >= at_least)
self._assert(condition, msg=msg, expected_stub=expected_metric, submitted_elements=self._metrics)

def assert_service_check(self, name, status=None, tags=None, count=None, at_least=1, hostname=None, message=None):
Expand Down
6 changes: 4 additions & 2 deletions spark/tests/test_spark.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ def join_url_dir(url, *args):


class Url(object):
"""A url object that can be compared with other url orbjects
"""
A url object that can be compared with other url orbjects
without regard to the vagaries of encoding, escaping, and ordering
of parameters in query strings."""
of parameters in query strings.
"""

def __init__(self, url):
parts = urlparse(url)
Expand Down

0 comments on commit 9fa7311

Please sign in to comment.