Title: [199215] trunk/Websites/perf.webkit.org
Revision
199215
Author
[email protected]
Date
2016-04-07 21:21:32 -0700 (Thu, 07 Apr 2016)

Log Message

sync-buildbot.js doesn't mark disappeared builds as failed
https://bugs.webkit.org/show_bug.cgi?id=156386

Reviewed by Chris Dumez.

Fix a bug that new syncing script doesn't mark builds that it scheduled but doesn't appear when queried
by buildbot's JSON API. These are builds that got canceled by humans (e.g. buildbot was restarted, data
loss, pending build was canceled, etc...)

* server-tests/tools-buildbot-triggerable-tests.js: Added a test case.
* tools/js/buildbot-triggerable.js:
(BuildbotTriggerable.prototype._pullBuildbotOnAllSyncers): Added a set of build requests we've matched
against BuildbotBuildEntry's. Mark build requests that didn't have any entry but supposed to be in either
'scheduled' or 'running' status as failed.

Modified Paths

Diff

Modified: trunk/Websites/perf.webkit.org/ChangeLog (199214 => 199215)


--- trunk/Websites/perf.webkit.org/ChangeLog	2016-04-08 04:17:23 UTC (rev 199214)
+++ trunk/Websites/perf.webkit.org/ChangeLog	2016-04-08 04:21:32 UTC (rev 199215)
@@ -1,5 +1,22 @@
 2016-04-07  Ryosuke Niwa  <[email protected]>
 
+        sync-buildbot.js doesn't mark disappeared builds as failed
+        https://bugs.webkit.org/show_bug.cgi?id=156386
+
+        Reviewed by Chris Dumez.
+
+        Fix a bug that new syncing script doesn't mark builds that it scheduled but doesn't appear when queried
+        by buildbot's JSON API. These are builds that got canceled by humans (e.g. buildbot was restarted, data
+        loss, pending build was canceled, etc...)
+
+        * server-tests/tools-buildbot-triggerable-tests.js: Added a test case.
+        * tools/js/buildbot-triggerable.js:
+        (BuildbotTriggerable.prototype._pullBuildbotOnAllSyncers): Added a set of build requests we've matched
+        against BuildbotBuildEntry's. Mark build requests that didn't have any entry but supposed to be in either
+        'scheduled' or 'running' status as failed.
+
+2016-04-07  Ryosuke Niwa  <[email protected]>
+
         A/B testing bots should prioritize user created test groups
         https://bugs.webkit.org/show_bug.cgi?id=156375
 

Modified: trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js (199214 => 199215)


--- trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js	2016-04-08 04:17:23 UTC (rev 199214)
+++ trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js	2016-04-08 04:21:32 UTC (rev 199215)
@@ -441,6 +441,62 @@
             }).catch(done);
         });
 
+        it('should update the status of a supposedly scheduled build that went missing', function (done) {
+            let db = TestServer.database();
+            let syncPromise;
+            db.connect().then(function () {
+                return MockData.addMockData(db, ['scheduled', 'pending', 'pending', 'pending']);
+            }).then(function () {
+                return Manifest.fetch();
+            }).then(function () {
+                let config = MockData.mockTestSyncConfigWithSingleBuilder();
+                let logger = new MockLogger;
+                let slaveInfo = {name: 'sync-slave', password: 'password'};
+                let triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
+                syncPromise = triggerable.syncOnce();
+                syncPromise.catch(done);
+                return MockRemoteAPI.waitForRequest();
+            }).then(function () {
+                assert.equal(MockRemoteAPI.requests.length, 1);
+                assert.equal(MockRemoteAPI.requests[0].method, 'GET');
+                assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
+                MockRemoteAPI.requests[0].resolve([]);
+                return MockRemoteAPI.waitForRequest();
+            }).then(function () {
+                assert.equal(MockRemoteAPI.requests.length, 2);
+                assert.equal(MockRemoteAPI.requests[1].method, 'GET');
+                assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some-builder-1/builds/?select=-1&select=-2');
+                MockRemoteAPI.requests[1].resolve({});
+                return MockRemoteAPI.waitForRequest();
+            }).then(function () {
+                assert.equal(MockRemoteAPI.requests.length, 3);
+                assert.equal(MockRemoteAPI.requests[2].method, 'GET');
+                assert.equal(MockRemoteAPI.requests[2].url, '/json/builders/some-builder-1/pendingBuilds');
+                MockRemoteAPI.requests[2].resolve([]);
+                return MockRemoteAPI.waitForRequest();
+            }).then(function () {
+                assert.equal(MockRemoteAPI.requests.length, 4);
+                assert.equal(MockRemoteAPI.requests[3].method, 'GET');
+                assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some-builder-1/builds/?select=-1&select=-2');
+                MockRemoteAPI.requests[3].resolve({});
+                return syncPromise;
+            }).then(function () {
+                assert.equal(BuildRequest.all().length, 4);
+                assert.equal(BuildRequest.findById(700).status(), 'scheduled');
+                assert.equal(BuildRequest.findById(701).status(), 'pending');
+                assert.equal(BuildRequest.findById(702).status(), 'pending');
+                assert.equal(BuildRequest.findById(703).status(), 'pending');
+                return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithTwoBuilders().triggerableName);
+            }).then(function () {
+                assert.equal(BuildRequest.all().length, 4);
+                assert.equal(BuildRequest.findById(700).status(), 'failed');
+                assert.equal(BuildRequest.findById(701).status(), 'pending');
+                assert.equal(BuildRequest.findById(702).status(), 'pending');
+                assert.equal(BuildRequest.findById(703).status(), 'pending');
+                done();
+            }).catch(done);
+        });
+
         it('should schedule a build request of an user created test group before ones created by automatic change detection', function (done) {
             let db = TestServer.database();
             let syncPromise;

Modified: trunk/Websites/perf.webkit.org/tools/js/buildbot-triggerable.js (199214 => 199215)


--- trunk/Websites/perf.webkit.org/tools/js/buildbot-triggerable.js	2016-04-08 04:17:23 UTC (rev 199214)
+++ trunk/Websites/perf.webkit.org/tools/js/buildbot-triggerable.js	2016-04-08 04:21:32 UTC (rev 199215)
@@ -80,6 +80,7 @@
     _pullBuildbotOnAllSyncers(buildReqeustsByGroup)
     {
         let updates = {};
+        let associatedRequests = new Set;
         let self = this;
         return Promise.all(this._syncers.map(function (syncer) {
             self._logger.log(`Fetching builds on ${syncer.builderName()}`);
@@ -88,6 +89,7 @@
                     let request = BuildRequest.findById(entry.buildRequestId());
                     if (!request)
                         continue;
+                    associatedRequests.add(request);
 
                     let info = buildReqeustsByGroup.get(request.testGroupId());
                     assert(!info.syncer || info.syncer == syncer);
@@ -104,7 +106,14 @@
                     }
                 }
             });
-        })).then(function () { return updates; });
+        })).then(function () {
+            for (let request of BuildRequest.all()) {
+                if (request.hasStarted() && !request.hasFinished() && !associatedRequests.has(request)) {
+                    assert(!(request.id() in updates));
+                    updates[request.id()] = {status: 'failedIfNotCompleted'};
+                }
+            }
+        }).then(function () { return updates; });
     }
 
     _scheduleNextRequestInGroupIfSlaveIsAvailable(groupInfo, pendingUpdates)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to