зеркало из https://github.com/mozilla/treeherder.git
fix unit tests and a bug in clonejobs wrt updating background repo
This commit is contained in:
Родитель
ab058f2dfe
Коммит
22cc514c5a
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -22,30 +22,6 @@ describe('JobsCtrl', function(){
|
|||
getJSONFixture('resultset_list.json')
|
||||
);
|
||||
|
||||
$httpBackend.whenGET(projectPrefix + 'jobs/1235/').respond(
|
||||
getJSONFixture('job_1235.json')
|
||||
);
|
||||
|
||||
$httpBackend.whenGET(projectPrefix + 'artifact/403/').respond(
|
||||
getJSONFixture('artifact_403.json')
|
||||
);
|
||||
|
||||
$httpBackend.whenGET(projectPrefix + 'artifact/403').respond(
|
||||
getJSONFixture('artifact_403.json')
|
||||
);
|
||||
|
||||
$httpBackend.whenGET(projectPrefix + 'note?job_id=1235').respond(
|
||||
getJSONFixture('notes_job_1235.json')
|
||||
);
|
||||
|
||||
$httpBackend.whenGET(projectPrefix + 'note/?job_id=1235').respond(
|
||||
getJSONFixture('notes_job_1235.json')
|
||||
);
|
||||
|
||||
$httpBackend.whenGET('resources/job_groups.json').respond(
|
||||
getJSONFixture('job_groups.json')
|
||||
);
|
||||
|
||||
$httpBackend.whenGET('https://treestatus.mozilla.org/mozilla-inbound?format=json').respond(
|
||||
{
|
||||
"status": "closed",
|
||||
|
@ -83,9 +59,9 @@ describe('JobsCtrl', function(){
|
|||
Tests ResultSetCtrl
|
||||
*/
|
||||
|
||||
it('should have 139 jobs in resultset 2', function() {
|
||||
it('should have 31 platforms in resultset 8', function() {
|
||||
createResultSetCtrl(jobScope.result_sets[8]);
|
||||
expect(resultsetScope.resultset.platforms.length).toBe(14);
|
||||
expect(resultsetScope.resultset.platforms.length).toBe(31);
|
||||
});
|
||||
|
||||
it('should default to revisions collapsed', function() {
|
||||
|
|
|
@ -28,10 +28,6 @@ describe('ThResultSetModel', function(){
|
|||
getResultSet(10)
|
||||
);
|
||||
|
||||
$httpBackend.whenGET(projectPrefix + 'jobs/1235/').respond(
|
||||
getJSONFixture('job_1235.json')
|
||||
);
|
||||
|
||||
rootScope = $rootScope.$new();
|
||||
rootScope.repoName = foregroundRepo;
|
||||
|
||||
|
@ -114,7 +110,7 @@ describe('ThResultSetModel', function(){
|
|||
resultset: {id: 1, push_timestamp: 1396899074}
|
||||
};
|
||||
|
||||
$httpBackend.whenGET(foregroundPrefix + '/jobs/?id__in=123').respond(
|
||||
$httpBackend.whenGET(foregroundPrefix + '/jobs/?job_guid__in=123').respond(
|
||||
getJob(123, {result_set_id: 1})
|
||||
);
|
||||
|
||||
|
@ -136,7 +132,7 @@ describe('ThResultSetModel', function(){
|
|||
resultset: {id: 1, push_timestamp: 1396899074}
|
||||
};
|
||||
|
||||
$httpBackend.whenGET(foregroundPrefix + '/jobs/?id__in=590604').respond(
|
||||
$httpBackend.whenGET(foregroundPrefix + '/jobs/?job_guid__in=590604').respond(
|
||||
getJob(590604, {result_set_id: 1})
|
||||
);
|
||||
|
||||
|
@ -158,7 +154,7 @@ describe('ThResultSetModel', function(){
|
|||
resultset: {id: 10, push_timestamp: 1396899074}
|
||||
};
|
||||
|
||||
$httpBackend.whenGET(backgroundPrefix + '/jobs/?id__in=123').respond(
|
||||
$httpBackend.whenGET(backgroundPrefix + '/jobs/?job_guid__in=123').respond(
|
||||
getJob(123, {result_set_id: 10})
|
||||
);
|
||||
|
||||
|
@ -180,7 +176,7 @@ describe('ThResultSetModel', function(){
|
|||
resultset: {id: 10, push_timestamp: 1396899074}
|
||||
};
|
||||
|
||||
$httpBackend.whenGET(backgroundPrefix + '/jobs/?id__in=590604').respond(
|
||||
$httpBackend.whenGET(backgroundPrefix + '/jobs/?job_guid__in=590604').respond(
|
||||
getJob(590604, {result_set_id: 10})
|
||||
);
|
||||
|
||||
|
@ -278,7 +274,18 @@ describe('ThResultSetModel', function(){
|
|||
"revision": "793611be6b26"
|
||||
};
|
||||
_.extend(rs, values);
|
||||
return [rs];
|
||||
return {
|
||||
"meta": {
|
||||
"count": 1,
|
||||
"filter_params": {
|
||||
"count": "10",
|
||||
"full": "false",
|
||||
"format": "json"
|
||||
},
|
||||
"repository": "mozilla-inbound"
|
||||
},
|
||||
"results": [rs]
|
||||
};
|
||||
};
|
||||
|
||||
var getJob = function(id, values) {
|
||||
|
|
|
@ -84,7 +84,7 @@ treeherder.directive('thCloneJobs', function(
|
|||
|
||||
var targetEl, jobKey;
|
||||
if(!_.isEmpty(lastJobSelected.el)){
|
||||
jobKey = getJobMapKey(lastObjSelected.job);
|
||||
jobKey = getJobMapKey(lastJobSelected.job);
|
||||
getPreviousUnclassifiedFailure(jobMap[jobKey].job_obj);
|
||||
|
||||
}else{
|
||||
|
@ -881,7 +881,6 @@ treeherder.directive('thCloneJobs', function(
|
|||
_.bind(updateJobs, scope, platformData)();
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
var linker = function(scope, element, attrs){
|
||||
|
|
|
@ -13,8 +13,7 @@ treeherder.factory('ThJobModel', function($http, ThLog, thUrl) {
|
|||
|
||||
ThJobModel.get_list = function(repoName, options) {
|
||||
// a static method to retrieve a list of ThJobModel
|
||||
var query_string = $.param(options);
|
||||
return $http.get(ThJobModel.get_uri(repoName)+"?"+query_string)
|
||||
return $http.get(ThJobModel.get_uri(repoName), {params: options})
|
||||
.then(function(response) {
|
||||
var item_list = [];
|
||||
angular.forEach(response.data, function(elem){
|
||||
|
|
|
@ -222,7 +222,7 @@ treeherder.factory('ThResultSetModel',
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
$log.debug("sorting", repoName, repositories[repoName]);
|
||||
repositories[repoName].resultSets.sort(rsCompare);
|
||||
|
||||
$log.debug("oldest job: ", repositories[repoName].jobMapOldestId);
|
||||
|
@ -233,11 +233,11 @@ treeherder.factory('ThResultSetModel',
|
|||
/**
|
||||
* Sort the resultsets in place after updating the array
|
||||
*/
|
||||
var rsCompare = function(a, b) {
|
||||
if (a.push_timestamp > b.push_timestamp) {
|
||||
var rsCompare = function(rs_a, rs_b) {
|
||||
if (rs_a.push_timestamp > rs_b.push_timestamp) {
|
||||
return -1;
|
||||
}
|
||||
if (a.push_timestamp < b.push_timestamp) {
|
||||
if (rs_a.push_timestamp < rs_b.push_timestamp) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -341,7 +341,7 @@ treeherder.factory('ThResultSetModel',
|
|||
}
|
||||
|
||||
if (jobFetchList.length > 0) {
|
||||
$log.debug("processing jobFetchList", jobFetchList);
|
||||
$log.debug("processing the jobFetchList", jobFetchList.length, jobFetchList);
|
||||
|
||||
// make an ajax call to get the job details
|
||||
fetchJobs(repoName, jobFetchList);
|
||||
|
@ -352,7 +352,8 @@ treeherder.factory('ThResultSetModel',
|
|||
* in the data model.
|
||||
*/
|
||||
var fetchJobs = function(repoName, jobFetchList) {
|
||||
ThJobModel.get_list({
|
||||
$log.debug("fetchJobs", repoName, jobFetchList);
|
||||
ThJobModel.get_list(repoName, {
|
||||
job_guid__in: jobFetchList.join()
|
||||
}).then(
|
||||
_.bind(updateJobs, $rootScope, repoName),
|
||||
|
@ -436,7 +437,7 @@ treeherder.factory('ThResultSetModel',
|
|||
aggregateJobPlatform(repoName, jobList[i], platformData);
|
||||
}
|
||||
|
||||
if(!_.isEmpty(platformData)){
|
||||
if(!_.isEmpty(platformData) && repoName === $rootScope.repoName){
|
||||
$rootScope.$broadcast(thEvents.jobsLoaded, platformData);
|
||||
}
|
||||
};
|
||||
|
@ -511,8 +512,6 @@ treeherder.factory('ThResultSetModel',
|
|||
|
||||
}
|
||||
|
||||
$rootScope.$broadcast(thEvents.jobUpdated, newJob);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче