File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,11 +53,11 @@ def read_version_file(filepath, default='unknown'):
5353
5454@app .route ('/version' , methods = ['GET' ])
5555def version ():
56- """Return application version and build timestamp"""
57- return jsonify ({
56+ """Return application version and build timestamp as array for Grafana Infinity datasource """
57+ return jsonify ([ {
5858 "version" : APP_VERSION ,
5959 "build_ts" : APP_BUILD_TS
60- })
60+ }] )
6161
6262
6363@app .route ('/health' , methods = ['GET' ])
Original file line number Diff line number Diff line change @@ -23,17 +23,24 @@ def test_version_endpoint_returns_json(self, client):
2323 assert response .status_code == 200
2424 assert response .content_type == 'application/json'
2525
26+ def test_version_endpoint_returns_array (self , client ):
27+ """Test that /version returns array for Grafana Infinity datasource."""
28+ response = client .get ('/version' )
29+ data = json .loads (response .data )
30+ assert isinstance (data , list )
31+ assert len (data ) == 1
32+
2633 def test_version_endpoint_contains_version_field (self , client ):
2734 """Test that /version response contains version field."""
2835 response = client .get ('/version' )
2936 data = json .loads (response .data )
30- assert 'version' in data
37+ assert 'version' in data [ 0 ]
3138
3239 def test_version_endpoint_contains_build_ts_field (self , client ):
3340 """Test that /version response contains build_ts field."""
3441 response = client .get ('/version' )
3542 data = json .loads (response .data )
36- assert 'build_ts' in data
43+ assert 'build_ts' in data [ 0 ]
3744
3845
3946class TestReadVersionFile :
You can’t perform that action at this time.
0 commit comments