Skip to content

Commit f752783

Browse files
feedback
Created using spr 1.3.6
1 parent d2e5e9b commit f752783

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

.ci/metrics/metrics_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313

1414
class TestMetrics(unittest.TestCase):
1515
def test_upload_gauge_metric(self):
16+
"""Test that we can upload a gauge metric correctly.
17+
18+
Also verify that we pass around parameters like API keys and user IDs
19+
correctly to the HTTP POST request.
20+
"""
1621
test_metrics = [metrics.GaugeMetric("gauge_test", 5, 1000)]
1722
return_value = requests.Response()
1823
return_value.status_code = 204
@@ -29,6 +34,7 @@ def test_upload_gauge_metric(self):
2934
)
3035

3136
def test_upload_job_metric(self):
37+
"""Test that we can upload a job metric correctly."""
3238
test_metrics = [
3339
metrics.JobMetrics("test_job", 5, 10, 1, 1000, 7, "test_workflow")
3440
]
@@ -44,6 +50,8 @@ def test_upload_job_metric(self):
4450
)
4551

4652
def test_upload_unknown_metric(self):
53+
"""Test we report an error if we encounter an unknown metric type."""
54+
4755
@dataclass
4856
class FakeMetric:
4957
fake_data: str
@@ -54,6 +62,7 @@ class FakeMetric:
5462
metrics.upload_metrics(test_metrics, "test_userid", "test_api_key")
5563

5664
def test_bad_response_code(self):
65+
"""Test that we gracefully handle HTTP response errors."""
5766
test_metrics = [metrics.GaugeMetric("gauge_test", 5, 1000)]
5867
return_value = requests.Response()
5968
return_value.status_code = 403

0 commit comments

Comments
 (0)