Skip to content

Commit

Permalink
Add functional test for metrics endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Muellner committed Apr 1, 2022
1 parent 36f07e3 commit 4178f73
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions system/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class BaseTest(object):
"gpgDisableSign": False,
"ppaDistributorID": "ubuntu",
"ppaCodename": "",
"enableMetricsEndpoint": True,
}
configOverride = {}
environmentOverride = {}
Expand Down
26 changes: 26 additions & 0 deletions system/t12_api/metrics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from api_lib import APITest


class MetricsEnabledAPITest(APITest):
"""
GET /metrics
"""

def check(self):
resp = self.get("/api/metrics")
self.check_equal(resp.status_code, 200)

apiRequestsInFlightGauge = "# TYPE aptly_api_http_requests_in_flight gauge"
self.check_in(apiRequestsInFlightGauge, resp.text)

apiRequestsTotalCounter = "# TYPE aptly_api_http_requests_total counter"
self.check_in(apiRequestsTotalCounter, resp.text)

apiRequestSizeSummary = "# TYPE aptly_api_http_request_size_bytes summary"
self.check_in(apiRequestSizeSummary, resp.text)

apiResponseSizeSummary = "# TYPE aptly_api_http_response_size_bytes summary"
self.check_in(apiResponseSizeSummary, resp.text)

apiRequestsDurationSummary = "# TYPE aptly_api_http_request_duration_seconds summary"
self.check_in(apiRequestsDurationSummary, resp.text)

0 comments on commit 4178f73

Please sign in to comment.