Skip to content

Commit

Permalink
Modify the metrics test to set the prometheus_multiproc_dir environme…
Browse files Browse the repository at this point in the history
…nt variable (#179)
  • Loading branch information
dehort committed Apr 9, 2019
1 parent 2b57f9a commit 53d1427
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import test.support
import uuid
import copy
import tempfile
from app import create_app, db
from app.auth.identity import Identity
from app.utils import HostWrapper
Expand Down Expand Up @@ -1438,8 +1439,12 @@ def test_metrics(self):
"""
The metrics endpoint simply returns 200 to any GET request.
"""
response = self.client().get(METRICS_URL) # No identity header.
self.assertEqual(200, response.status_code)
with tempfile.TemporaryDirectory() as temp_dir:
with test.support.EnvironmentVarGuard() as env:
env.set("prometheus_multiproc_dir", temp_dir)

response = self.client().get(METRICS_URL) # No identity header.
self.assertEqual(200, response.status_code)

def test_version(self):
response = self.get(VERSION_URL, 200)
Expand Down

0 comments on commit 53d1427

Please sign in to comment.