зеркало из https://github.com/mozilla/treeherder.git
Bug 1230652 - Add framework filtering for platform list and use it
This commit is contained in:
Родитель
87699a1b0b
Коммит
85f1aec173
|
@ -4,6 +4,7 @@ import pytest
|
|||
from django.core.urlresolvers import reverse
|
||||
from rest_framework.test import APIClient
|
||||
|
||||
from treeherder.model.models import MachinePlatform
|
||||
from treeherder.perf.models import (PerformanceFramework,
|
||||
PerformanceSignature)
|
||||
|
||||
|
@ -65,6 +66,42 @@ def test_performance_platforms_expired_test(webapp, test_perf_signature):
|
|||
assert resp.json == []
|
||||
|
||||
|
||||
def test_performance_platforms_framework_filtering(webapp, test_perf_signature):
|
||||
# check framework filtering
|
||||
framework2 = PerformanceFramework.objects.create(name='test_talos2')
|
||||
platform2 = MachinePlatform.objects.create(
|
||||
os_name='win',
|
||||
platform='win7-a',
|
||||
architecture='x86',
|
||||
active_status='active')
|
||||
PerformanceSignature.objects.create(
|
||||
repository=test_perf_signature.repository,
|
||||
signature_hash=test_perf_signature.signature_hash,
|
||||
framework=framework2,
|
||||
platform=platform2,
|
||||
option_collection=test_perf_signature.option_collection,
|
||||
suite=test_perf_signature.suite,
|
||||
test=test_perf_signature.test,
|
||||
has_subtests=test_perf_signature.has_subtests,
|
||||
last_updated=test_perf_signature.last_updated)
|
||||
|
||||
# by default should return both
|
||||
resp = webapp.get(reverse('performance-signatures-platforms-list',
|
||||
kwargs={
|
||||
"project": test_perf_signature.repository.name
|
||||
}))
|
||||
assert resp.status_int == 200
|
||||
assert sorted(resp.json) == ['win7', 'win7-a']
|
||||
|
||||
# if we specify just one framework, should only return one
|
||||
resp = webapp.get(reverse('performance-signatures-platforms-list',
|
||||
kwargs={
|
||||
"project": test_perf_signature.repository.name
|
||||
}) + '?framework={}'.format(framework2.id))
|
||||
assert resp.status_int == 200
|
||||
assert resp.json == ['win7-a']
|
||||
|
||||
|
||||
def test_summary_performance_data(webapp, test_repository,
|
||||
summary_perf_signature,
|
||||
test_perf_signature, jm):
|
||||
|
|
|
@ -967,8 +967,9 @@ perf.controller('TestChooserCtrl', function($scope, $uibModalInstance, $http,
|
|||
$scope.loadingTestData = true;
|
||||
$scope.loadingPlatformList = true;
|
||||
$scope.platformList = [];
|
||||
PhSeries.getPlatformList($scope.selectedProject.name, $scope.timeRange).then(
|
||||
function(platformList) {
|
||||
PhSeries.getPlatformList($scope.selectedProject.name, {
|
||||
interval: $scope.timeRange,
|
||||
framework: $scope.selectedFramework.id }).then(function(platformList) {
|
||||
$scope.platformList = platformList;
|
||||
$scope.platformList.sort();
|
||||
if (_.contains($scope.platformList, defaultPlatform)) {
|
||||
|
|
|
@ -74,9 +74,9 @@ treeherder.factory('PhSeries', ['$http', 'thServiceDomain', 'ThOptionCollectionM
|
|||
});
|
||||
});
|
||||
},
|
||||
getPlatformList: function(projectName, interval) {
|
||||
getPlatformList: function(projectName, params) {
|
||||
return $http.get(thServiceDomain + '/api/project/' + projectName +
|
||||
'/performance/platforms/', { params: { interval: interval } }).then(
|
||||
'/performance/platforms/', { params: params }).then(
|
||||
function(response) {
|
||||
return response.data;
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче