Title: [201718] trunk/Websites/perf.webkit.org
Revision
201718
Author
rn...@webkit.org
Date
2016-06-06 11:51:23 -0700 (Mon, 06 Jun 2016)

Log Message

sync-buildbot.js should update the list of tests and platforms associated with a triggerable
https://bugs.webkit.org/show_bug.cgi?id=158406
<rdar://problem/26185737>

Reviewed by Darin Adler.

Added /api/update-triggerable to update the list of configurations (platform and test pairs)
associated with a given triggerable, and make sync-buildbot.js use this JSON API before each
syncing cycle so that the association gets updated automatically by simply updating the JSON.

* server-tests/api-manifest.js: Use const for imported modules.
* server-tests/api-report-commits-tests.js: Removed unnecessary importing of crypto.
* server-tests/resources/mock-data.js:
(MockData.someTestId): Added.
(MockData.somePlatformId): Added.
(MockData.addMockData):
* server-tests/tools-buildbot-triggerable-tests.js: Use const for imported modules. Also added
a test for BuildbotTriggerable's updateTriggerable.
* tools/js/buildbot-triggerable.js:
(BuildbotTriggerable.prototype.updateTriggerable): Added. Find the list of all configurations
associated with this triggeerable and post it to /api/update-triggerable.
* tools/js/database.js: Added triggerable_configurations to the list of tables.
* tools/js/remote.js:
(RemoteAPI.prototype.postJSON): Print the whole response when JSON parsing fails for debugging.
* tools/sync-buildbot.js:
(syncLoop): Call BuildbotTriggerable's updateTriggerable before syncing.

Modified Paths

Diff

Modified: trunk/Websites/perf.webkit.org/ChangeLog (201717 => 201718)


--- trunk/Websites/perf.webkit.org/ChangeLog	2016-06-06 18:38:34 UTC (rev 201717)
+++ trunk/Websites/perf.webkit.org/ChangeLog	2016-06-06 18:51:23 UTC (rev 201718)
@@ -1,3 +1,32 @@
+2016-06-06  Ryosuke Niwa  <rn...@webkit.org>
+
+        sync-buildbot.js should update the list of tests and platforms associated with a triggerable
+        https://bugs.webkit.org/show_bug.cgi?id=158406
+        <rdar://problem/26185737>
+
+        Reviewed by Darin Adler.
+
+        Added /api/update-triggerable to update the list of configurations (platform and test pairs)
+        associated with a given triggerable, and make sync-buildbot.js use this JSON API before each
+        syncing cycle so that the association gets updated automatically by simply updating the JSON.
+
+        * server-tests/api-manifest.js: Use const for imported modules.
+        * server-tests/api-report-commits-tests.js: Removed unnecessary importing of crypto.
+        * server-tests/resources/mock-data.js:
+        (MockData.someTestId): Added.
+        (MockData.somePlatformId): Added.
+        (MockData.addMockData):
+        * server-tests/tools-buildbot-triggerable-tests.js: Use const for imported modules. Also added
+        a test for BuildbotTriggerable's updateTriggerable.
+        * tools/js/buildbot-triggerable.js:
+        (BuildbotTriggerable.prototype.updateTriggerable): Added. Find the list of all configurations
+        associated with this triggeerable and post it to /api/update-triggerable.
+        * tools/js/database.js: Added triggerable_configurations to the list of tables.
+        * tools/js/remote.js:
+        (RemoteAPI.prototype.postJSON): Print the whole response when JSON parsing fails for debugging.
+        * tools/sync-buildbot.js:
+        (syncLoop): Call BuildbotTriggerable's updateTriggerable before syncing.
+
 2016-06-02  Ryosuke Niwa  <rn...@webkit.org>
 
         Build fix after r201564.

Modified: trunk/Websites/perf.webkit.org/server-tests/api-manifest.js (201717 => 201718)


--- trunk/Websites/perf.webkit.org/server-tests/api-manifest.js	2016-06-06 18:38:34 UTC (rev 201717)
+++ trunk/Websites/perf.webkit.org/server-tests/api-manifest.js	2016-06-06 18:51:23 UTC (rev 201718)
@@ -1,10 +1,11 @@
 'use strict';
 
-let assert = require('assert');
+const assert = require('assert');
 
 require('../tools/js/v3-models.js');
 
-let TestServer = require('./resources/test-server.js');
+const MockData = require('./resources/mock-data.js');
+const TestServer = require('./resources/test-server.js');
 
 describe('/api/manifest', function () {
     this.timeout(1000);

Modified: trunk/Websites/perf.webkit.org/server-tests/api-report-commits-tests.js (201717 => 201718)


--- trunk/Websites/perf.webkit.org/server-tests/api-report-commits-tests.js	2016-06-06 18:38:34 UTC (rev 201717)
+++ trunk/Websites/perf.webkit.org/server-tests/api-report-commits-tests.js	2016-06-06 18:51:23 UTC (rev 201718)
@@ -1,7 +1,6 @@
 'use strict';
 
 const assert = require('assert');
-const crypto = require('crypto');
 
 const TestServer = require('./resources/test-server.js');
 const addSlaveForReport = require('./resources/common-operations.js').addSlaveForReport;

Modified: trunk/Websites/perf.webkit.org/server-tests/resources/mock-data.js (201717 => 201718)


--- trunk/Websites/perf.webkit.org/server-tests/resources/mock-data.js	2016-06-06 18:38:34 UTC (rev 201717)
+++ trunk/Websites/perf.webkit.org/server-tests/resources/mock-data.js	2016-06-06 18:51:23 UTC (rev 201718)
@@ -16,6 +16,8 @@
         Test.clearStaticMap();
         TestGroup.clearStaticMap();
     },
+    someTestId() { return 200; },
+    somePlatformId() { return 65; },
     addMockData: function (db, statusList)
     {
         if (!statusList)
@@ -28,8 +30,8 @@
             db.insert('commits', {id: 87832, repository: 9, revision: '10.11 15A284'}),
             db.insert('commits', {id: 93116, repository: 11, revision: '191622', time: (new Date(1445945816878)).toISOString()}),
             db.insert('commits', {id: 96336, repository: 11, revision: '192736', time: (new Date(1448225325650)).toISOString()}),
-            db.insert('platforms', {id: 65, name: 'some platform'}),
-            db.insert('tests', {id: 200, name: 'some test'}),
+            db.insert('platforms', {id: MockData.somePlatformId(), name: 'some platform'}),
+            db.insert('tests', {id: MockData.someTestId(), name: 'some test'}),
             db.insert('test_metrics', {id: 300, test: 200, name: 'some metric'}),
             db.insert('test_configurations', {id: 301, metric: 300, platform: 65, type: 'current'}),
             db.insert('root_sets', {id: 401}),

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


--- trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js	2016-06-06 18:38:34 UTC (rev 201717)
+++ trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js	2016-06-06 18:51:23 UTC (rev 201718)
@@ -1,11 +1,12 @@
 'use strict';
 
-let assert = require('assert');
+const assert = require('assert');
 
-let BuildbotTriggerable = require('../tools/js/buildbot-triggerable.js').BuildbotTriggerable;
-let MockData = require('./resources/mock-data.js');
-let MockRemoteAPI = require('../unit-tests/resources/mock-remote-api.js').MockRemoteAPI;
-let TestServer = require('./resources/test-server.js');
+const BuildbotTriggerable = require('../tools/js/buildbot-triggerable.js').BuildbotTriggerable;
+const MockData = require('./resources/mock-data.js');
+const MockRemoteAPI = require('../unit-tests/resources/mock-remote-api.js').MockRemoteAPI;
+const TestServer = require('./resources/test-server.js');
+const connectToDatabaseInEveryTest = require('./resources/common-operations.js').connectToDatabaseInEveryTest;
 
 class MockLogger {
     constructor()
@@ -902,4 +903,32 @@
             }).catch(done);
         });
     });
+
+    describe('updateTriggerables', function () {
+        connectToDatabaseInEveryTest();
+
+        it('should update available triggerables', function (done) {
+            let db = TestServer.database();
+            MockData.addMockData(db).then(function () {
+                return Manifest.fetch();
+            }).then(function () {
+                return db.selectAll('triggerable_configurations', 'test');
+            }).then(function (configurations) {
+                assert.equal(configurations.length, 0);
+                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);
+                return triggerable.updateTriggerable();
+            }).then(function () {
+                return db.selectAll('triggerable_configurations', 'test');
+            }).then(function (configurations) {
+                assert.equal(configurations.length, 1);
+                assert.equal(configurations[0].test, MockData.someTestId());
+                assert.equal(configurations[0].platform, MockData.somePlatformId());
+                done();
+            }).catch(done);
+        });
+    });
+
 });

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


--- trunk/Websites/perf.webkit.org/tools/js/buildbot-triggerable.js	2016-06-06 18:38:34 UTC (rev 201717)
+++ trunk/Websites/perf.webkit.org/tools/js/buildbot-triggerable.js	2016-06-06 18:51:23 UTC (rev 201718)
@@ -27,6 +27,22 @@
 
     name() { return this._name; }
 
+    updateTriggerable()
+    {
+        const map = new Map;
+        for (const syncer of this._syncers) {
+            for (const config of syncer.testConfigurations()) {
+                const entry = {test: config.test.id(), platform: config.platform.id()};
+                map.set(entry.test + '-' + entry.platform, entry);
+            }
+        }
+        return this._remote.postJSON(`/api/update-triggerable/`, {
+            'slaveName': this._slaveInfo.name,
+            'slavePassword': this._slaveInfo.password,
+            'triggerable': this._name,
+            'configurations': Array.from(map.values())});
+    }
+
     syncOnce()
     {
         let syncerList = this._syncers;

Modified: trunk/Websites/perf.webkit.org/tools/js/database.js (201717 => 201718)


--- trunk/Websites/perf.webkit.org/tools/js/database.js	2016-06-06 18:38:34 UTC (rev 201717)
+++ trunk/Websites/perf.webkit.org/tools/js/database.js	2016-06-06 18:51:23 UTC (rev 201718)
@@ -142,6 +142,7 @@
     'test_runs': 'run',
     'tests': 'test',
     'tracker_repositories': 'tracrepo',
+    'triggerable_configurations': 'trigconfig',
     'platforms': 'platform',
     'reports': 'report',
     'repositories': 'repository',

Modified: trunk/Websites/perf.webkit.org/tools/js/remote.js (201717 => 201718)


--- trunk/Websites/perf.webkit.org/tools/js/remote.js	2016-06-06 18:38:34 UTC (rev 201717)
+++ trunk/Websites/perf.webkit.org/tools/js/remote.js	2016-06-06 18:51:23 UTC (rev 201718)
@@ -71,7 +71,12 @@
         const contentType = 'application/json';
         const payload = JSON.stringify(data);
         return this.sendHttpRequest(path, 'POST', 'application/json', payload).then(function (result) {
-            return JSON.parse(result.responseText);
+            try {
+                return JSON.parse(result.responseText);
+            } catch (error) {
+                console.error(result.responseText);
+                throw error;
+            }
         });
     }
 

Modified: trunk/Websites/perf.webkit.org/tools/sync-buildbot.js (201717 => 201718)


--- trunk/Websites/perf.webkit.org/tools/sync-buildbot.js	2016-06-06 18:38:34 UTC (rev 201717)
+++ trunk/Websites/perf.webkit.org/tools/sync-buildbot.js	2016-06-06 18:51:23 UTC (rev 201718)
@@ -41,8 +41,12 @@
     global.RemoteAPI = new RemoteAPI(serverConfig.server);
 
     console.log(`Fetching the manifest...`);
+
+    let triggerable;
     Manifest.fetch().then(function () {
-        let triggerable = new BuildbotTriggerable(buildbotConfig, global.RemoteAPI, buildbotRemote, serverConfig.slave, console);
+        triggerable = new BuildbotTriggerable(buildbotConfig, global.RemoteAPI, buildbotRemote, serverConfig.slave, console);
+        return triggerable.updateTriggerable();
+    }).then(function () {
         return triggerable.syncOnce();
     }).catch(function (error) {
         console.error(error);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to