(self)
| 112 | await self.validate_metrics("failed_requests", "Number of failed requests", 7) |
| 113 | |
| 114 | async def test_gzip(self): |
| 115 | # Increment a metric. |
| 116 | metric_name = "counter" |
| 117 | help_text = "A counter" |
| 118 | increments = 2 |
| 119 | self.increment_metrics(metric_name, help_text, increments) |
| 120 | |
| 121 | async with self.client.get( |
| 122 | "/metrics", |
| 123 | auto_decompress=False, |
| 124 | headers={hdrs.ACCEPT_ENCODING: "gzip"}, |
| 125 | ) as response: |
| 126 | response.raise_for_status() |
| 127 | self.assertIn(hdrs.CONTENT_ENCODING, response.headers) |
| 128 | self.assertIn("gzip", response.headers.getall(hdrs.CONTENT_ENCODING)) |
| 129 | body = await response.read() |
| 130 | output = gzip.decompress(body).decode("utf8") |
| 131 | self.assert_metrics(output, metric_name, help_text, increments) |
| 132 | |
| 133 | async def test_gzip_disabled(self): |
| 134 | # Increment a metric. |
nothing calls this directly
no test coverage detected