Commit 94cd2b42 authored by ale's avatar ale
Browse files

Fix probe error details page

parent a4dae1a9
Pipeline #5807 passed with stages
in 1 minute and 54 seconds
......@@ -60,7 +60,7 @@ def probe_detail(probe_name):
@app.route('/errdetail/<probe_ts>/<path:probe_name>')
def probe_error(probe_ts, probe_name):
result = app.results.get_error(probe_name, probe_ts)
result = app.results.get_error(probe_name, int(probe_ts))
if not result:
abort(404)
return render_template(
......
......@@ -58,7 +58,7 @@ class Probe(object):
if has_prometheus:
probe_success.labels(self.name).set(
1 if result['status'] == 'ok' else 0)
results.add(self.name, end_timestamp, result)
results.add(self.name, int(end_timestamp), result)
def parameterize(probe, attr, values):
......
......@@ -21,3 +21,13 @@ class AppTest(unittest.TestCase):
self.assertEquals(200, resp.status_code)
self.assertTrue(b'ok' in resp.data)
self.assertTrue(b'err' in resp.data)
def test_detail(self):
resp = self.c.get('/detail/ok')
self.assertEquals(200, resp.status_code)
def test_errdetail(self):
# Find the 'err' probe result timestamp to build the URL.
err_ts = self.app.results.get_results()['err']['timestamp']
resp = self.c.get('/errdetail/%d/err' % err_ts)
self.assertEquals(200, resp.status_code)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment