Skip to content

Commit 74ff393

Browse files
committed
Add integration test for distribution metric submission
1 parent 373044a commit 74ff393

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/integration/api/test_api.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def get_with_retry(
3333
else:
3434
resource = getattr(getattr(dog, resource_type), operation)(resource_id, **kwargs)
3535
retry_counter = 0
36+
print(resource)
3637
while retry_condition(resource) and retry_counter < retry_limit:
3738
if resource_id is None:
3839
resource = getattr(getattr(dog, resource_type), operation)(**kwargs)
@@ -259,6 +260,25 @@ def retry_condition(r):
259260
assert len(metric_query_tuple["series"][0]["pointlist"]) == 1
260261
assert metric_query_tuple["series"][0]["pointlist"][0][1] == 1
261262

263+
def test_distribution_metrics(self):
264+
now = datetime.datetime.now()
265+
now_ts = int(time.mktime(now.timetuple()))
266+
metric_name = "test.distribution_metric." + str(now_ts)
267+
host_name = "test.host." + str(now_ts)
268+
269+
# Send metrics with single and multi points, and with compression
270+
assert dog.Distribution.send(
271+
distributions=[{
272+
'metric': metric_name,
273+
'points': [(now_ts - 60, [1.0])],
274+
'type': 'distribution',
275+
'host': host_name,
276+
}]
277+
)["status"] == "ok"
278+
279+
# FIXME: Query and verify the test metric result. Currently, it takes
280+
# too long for a new distribution metric to become available for query.
281+
262282
def test_graph_snapshot(self):
263283
metric_query = "system.load.1{*}"
264284
event_query = "*"

0 commit comments

Comments
 (0)