Commit 32413efa authored by sergiyb@chromium.org's avatar sergiyb@chromium.org

Use failure.tree field provided by the builder_alerts generator

Depends on https://codereview.chromium.org/508873005/.

BUG=406969
R=ojan@chromium.org

Review URL: https://codereview.chromium.org/511253004

git-svn-id: svn://svn.chromium.org/blink/trunk@181652 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 09d822d0
...@@ -20,24 +20,6 @@ function CTFailures(commitLog) { ...@@ -20,24 +20,6 @@ function CTFailures(commitLog) {
// Maps a tree id to an array of CTFailureGroups within that tree. // Maps a tree id to an array of CTFailureGroups within that tree.
this.failures = null; this.failures = null;
this.lastUpdateDate = null; this.lastUpdateDate = null;
// FIXME: Get this from
// https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/slave/gatekeeper_trees.json?format=text.
this._trees = {
blink: [
"https://build.chromium.org/p/chromium.webkit",
],
chromium: [
"https://build.chromium.org/p/chromium",
"https://build.chromium.org/p/chromium.chrome",
"https://build.chromium.org/p/chromium.chromiumos",
"https://build.chromium.org/p/chromium.gpu",
"https://build.chromium.org/p/chromium.linux",
"https://build.chromium.org/p/chromium.mac",
"https://build.chromium.org/p/chromium.memory",
"https://build.chromium.org/p/chromium.win"
],
};
} }
(function() { (function() {
...@@ -86,13 +68,6 @@ CTFailures.prototype._failureByTreeListComparator = function(tree, a, b) { ...@@ -86,13 +68,6 @@ CTFailures.prototype._failureByTreeListComparator = function(tree, a, b) {
// Updates the format of the alerts array to be easier to parse. // Updates the format of the alerts array to be easier to parse.
CTFailures.prototype._mungeAlerts = function(alerts) { CTFailures.prototype._mungeAlerts = function(alerts) {
var masterToTree = {};
Object.keys(this._trees, function(tree, masters) {
masters.forEach(function(master) {
masterToTree[master] = tree;
});
});
alerts.forEach(function(failure) { alerts.forEach(function(failure) {
// FIXME: Have the server store the actual failure type in a different // FIXME: Have the server store the actual failure type in a different
// field instead of smashing it into the reason. // field instead of smashing it into the reason.
...@@ -107,10 +82,6 @@ CTFailures.prototype._mungeAlerts = function(alerts) { ...@@ -107,10 +82,6 @@ CTFailures.prototype._mungeAlerts = function(alerts) {
failure.failureType = 'UNKNOWN'; failure.failureType = 'UNKNOWN';
} }
} }
// FIXME: Figure out what tree masters that aren't in masterToTree
// we should have.
failure.tree = masterToTree[failure.master_url];
}); });
}; };
......
...@@ -75,17 +75,21 @@ describe('ct-failures', function() { ...@@ -75,17 +75,21 @@ describe('ct-failures', function() {
{ {
reason: 'reason', reason: 'reason',
master_url: 'https://build.chromium.org/p/chromium.webkit', master_url: 'https://build.chromium.org/p/chromium.webkit',
tree: 'blink',
}, },
{ {
reason: 'reason:type', reason: 'reason:type',
master_url: 'https://build.chromium.org/p/chromium.chrome', master_url: 'https://build.chromium.org/p/chromium.chrome',
tree: 'chromium',
}, },
{ {
master_url: 'https://build.chromium.org/p/chromium.gpu', master_url: 'https://build.chromium.org/p/chromium.gpu',
tree: 'chromium',
}, },
{ {
reason: 'reason:type', reason: 'reason:type',
failureType: 'actual_type', failureType: 'actual_type',
tree: undefined,
}, },
]; ];
analyzer._mungeAlerts(alerts); analyzer._mungeAlerts(alerts);
...@@ -272,7 +276,7 @@ describe('ct-failures', function() { ...@@ -272,7 +276,7 @@ describe('ct-failures', function() {
builder_name: "Linux Tests (dbg)(1)", builder_name: "Linux Tests (dbg)(1)",
key: "f1", key: "f1",
step_name: "compile", step_name: "compile",
tree_name: null, tree: 'chromium',
passing_revisions: { passing_revisions: {
v8: 50, v8: 50,
chromium: 99, chromium: 99,
...@@ -362,6 +366,38 @@ describe('ct-failures', function() { ...@@ -362,6 +366,38 @@ describe('ct-failures', function() {
}); });
}); });
describe('processFailuresForRangeGroup', function() {
it('should use tree name from json', function() {
var analyzer = new CTFailures(null);
var annotations = Promise.resolve({
'test-key': 'test-annotation',
})
var range_groups = {
'failure_keys': ['test-key'],
'likely_revisions': []
}
var alertsByKey = {
'test-key': {
'key': 'test-key',
'step_name': 'bot_update',
'tree': 'test-tree',
'builder_name': 'Linux',
'last_failing_build': 1234,
'failing_build': 1234,
'master_url': 'http://build.chromium.org/p/chromium',
'failing_build_count': 1,
'reason': 'test-reason',
}
}
var newFailures = {}
analyzer._processFailuresForRangeGroup(newFailures, range_groups, alertsByKey, annotations)
assert.ok('test-tree' in newFailures)
assert.notOk('chromium' in newFailures)
});
});
}); });
})() })()
......
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