Rename API endpoint for `get_runs_by_run_metadata_key`.
The route for `get_runs_by_run_metadata_key` conflicted with the `get_test_runs_by_build_name` route when grouping by the `build_name` metadata key. This moves the route into the `/runs/key/` namespace to prevent it from colliding with other endpoints. Change-Id: I64280febe39eaecd7b694aea7f5d39df5c1bc45c
This commit is contained in:
parent
8559e8f0b9
commit
821601b16d
|
@ -69,7 +69,7 @@ function HealthService($http, config) {
|
|||
|
||||
service.getRunsForRunMetadataKey = function(runMetadataKey, value, options) {
|
||||
return config.get().then(function(config) {
|
||||
return $http.jsonp(config.apiRoot + '/' + runMetadataKey + '/' + value + '/runs', {
|
||||
return $http.jsonp(config.apiRoot + '/runs/key/' + runMetadataKey + '/' + value, {
|
||||
params: angular.extend(options, { callback: 'JSON_CALLBACK' })
|
||||
});
|
||||
});
|
||||
|
|
|
@ -210,7 +210,7 @@ def _aggregate_runs(runs_by_time_delta):
|
|||
return dict(timedelta=aggregated_runs)
|
||||
|
||||
|
||||
@app.route('/<path:run_metadata_key>/<path:value>/runs', methods=['GET'])
|
||||
@app.route('/runs/key/<path:run_metadata_key>/<path:value>', methods=['GET'])
|
||||
def get_runs_by_run_metadata_key(run_metadata_key, value):
|
||||
global Session
|
||||
session = Session()
|
||||
|
|
|
@ -357,7 +357,8 @@ class TestRestAPI(base.TestCase):
|
|||
def test_get_runs_by_project_resolution_sec(self, api_mock):
|
||||
api.Session = mock.MagicMock()
|
||||
query = 'datetime_resolution=sec'
|
||||
res = self.app.get('/project/openstack/trove/runs?{0}'.format(query))
|
||||
res = self.app.get('/runs/key/project/openstack/trove?{0}'
|
||||
.format(query))
|
||||
|
||||
self.assertEqual(200, res.status_code)
|
||||
|
||||
|
@ -411,7 +412,8 @@ class TestRestAPI(base.TestCase):
|
|||
def test_get_runs_by_project_resolution_min(self, api_mock):
|
||||
api.Session = mock.MagicMock()
|
||||
query = 'datetime_resolution=min'
|
||||
res = self.app.get('/project/openstack/trove/runs?{0}'.format(query))
|
||||
res = self.app.get('/runs/key/project/openstack/trove?{0}'
|
||||
.format(query))
|
||||
|
||||
self.assertEqual(200, res.status_code)
|
||||
|
||||
|
@ -465,7 +467,8 @@ class TestRestAPI(base.TestCase):
|
|||
def test_get_runs_by_project_resolution_hour(self, api_mock):
|
||||
api.Session = mock.MagicMock()
|
||||
query = 'datetime_resolution=hour'
|
||||
res = self.app.get('/project/openstack/trove/runs?{0}'.format(query))
|
||||
res = self.app.get('/runs/key/project/openstack/trove?{0}'
|
||||
.format(query))
|
||||
|
||||
self.assertEqual(200, res.status_code)
|
||||
|
||||
|
@ -525,7 +528,8 @@ class TestRestAPI(base.TestCase):
|
|||
def test_get_runs_by_project_resolution_day(self, api_mock):
|
||||
api.Session = mock.MagicMock()
|
||||
query = 'datetime_resolution=day'
|
||||
res = self.app.get('/project/openstack/trove/runs?{0}'.format(query))
|
||||
res = self.app.get('/runs/key/project/openstack/trove?{0}'
|
||||
.format(query))
|
||||
|
||||
self.assertEqual(200, res.status_code)
|
||||
|
||||
|
@ -590,7 +594,8 @@ class TestRestAPI(base.TestCase):
|
|||
stop_date = timestamp_d2.date().isoformat()
|
||||
query = ('datetime_resolution=day&start_date={0}&stop_date={1}'
|
||||
.format(start_date, stop_date))
|
||||
res = self.app.get('/project/openstack/trove/runs?{0}'.format(query))
|
||||
res = self.app.get('/runs/key/project/openstack/trove?{0}'
|
||||
.format(query))
|
||||
|
||||
self.assertEqual(200, res.status_code)
|
||||
|
||||
|
@ -624,7 +629,7 @@ class TestRestAPI(base.TestCase):
|
|||
def test_get_runs_by_project_invalid_resolution(self):
|
||||
api.Session = mock.MagicMock()
|
||||
res = self.app.get(
|
||||
'/projects/openstack/trove/runs?datetime_resolution=century')
|
||||
'/runs/key/project/openstack/trove?datetime_resolution=century')
|
||||
self.assertEqual(res.status_code, 400)
|
||||
self.assertEqual('Datetime resolution: century, is not a valid choice',
|
||||
res.data)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = {
|
||||
request: {
|
||||
method: 'JSONP',
|
||||
path: '/project/openstack/taskflow/runs'
|
||||
path: '/runs/key/project/openstack/taskflow'
|
||||
},
|
||||
response: {
|
||||
data: {
|
||||
|
|
|
@ -40,7 +40,7 @@ describe('E2E: Routes', function() {
|
|||
|
||||
// data should actually be requested (no request if error)
|
||||
expect(mock.requestsMade()).toContain(jasmine.objectContaining({
|
||||
url: 'http://localhost:5000/project/openstack/taskflow/runs',
|
||||
url: 'http://localhost:5000/runs/key/project/openstack/taskflow',
|
||||
method: 'JSONP'
|
||||
}));
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ describe('GroupedRunsController', function() {
|
|||
};
|
||||
|
||||
var endpoint = API_ROOT +
|
||||
'/project/openstack/cinder/runs?callback=JSON_CALLBACK&' +
|
||||
'/runs/key/project/openstack/cinder?callback=JSON_CALLBACK&' +
|
||||
'datetime_resolution=hour&' +
|
||||
'start_date=' + startDate.toISOString() + '&' +
|
||||
'stop_date=' + stopDate.toISOString();
|
||||
|
|
|
@ -97,7 +97,7 @@ describe('HealthService', function() {
|
|||
it('should get runs from project', function() {
|
||||
var expectedResponse = [{ data: 'data' }, {}, {}];
|
||||
var endpoint = API_ROOT +
|
||||
'/project/openstack/cinder/runs?' +
|
||||
'/runs/key/project/openstack/cinder?' +
|
||||
'callback=JSON_CALLBACK&' +
|
||||
'start_date=' + DEFAULT_START_TIME + '&' +
|
||||
'stop_date=' + DEFAULT_END_TIME;
|
||||
|
|
Loading…
Reference in New Issue