Changeset 201718 in webkit


Ignore:
Timestamp:
Jun 6, 2016 11:51:23 AM (8 years ago)
Author:
rniwa@webkit.org
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.

Location:
trunk/Websites/perf.webkit.org
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Websites/perf.webkit.org/ChangeLog

    r201607 r201718  
     12016-06-06  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        sync-buildbot.js should update the list of tests and platforms associated with a triggerable
     4        https://bugs.webkit.org/show_bug.cgi?id=158406
     5        <rdar://problem/26185737>
     6
     7        Reviewed by Darin Adler.
     8
     9        Added /api/update-triggerable to update the list of configurations (platform and test pairs)
     10        associated with a given triggerable, and make sync-buildbot.js use this JSON API before each
     11        syncing cycle so that the association gets updated automatically by simply updating the JSON.
     12
     13        * server-tests/api-manifest.js: Use const for imported modules.
     14        * server-tests/api-report-commits-tests.js: Removed unnecessary importing of crypto.
     15        * server-tests/resources/mock-data.js:
     16        (MockData.someTestId): Added.
     17        (MockData.somePlatformId): Added.
     18        (MockData.addMockData):
     19        * server-tests/tools-buildbot-triggerable-tests.js: Use const for imported modules. Also added
     20        a test for BuildbotTriggerable's updateTriggerable.
     21        * tools/js/buildbot-triggerable.js:
     22        (BuildbotTriggerable.prototype.updateTriggerable): Added. Find the list of all configurations
     23        associated with this triggeerable and post it to /api/update-triggerable.
     24        * tools/js/database.js: Added triggerable_configurations to the list of tables.
     25        * tools/js/remote.js:
     26        (RemoteAPI.prototype.postJSON): Print the whole response when JSON parsing fails for debugging.
     27        * tools/sync-buildbot.js:
     28        (syncLoop): Call BuildbotTriggerable's updateTriggerable before syncing.
     29
    1302016-06-02  Ryosuke Niwa  <rniwa@webkit.org>
    231
  • trunk/Websites/perf.webkit.org/server-tests/api-manifest.js

    r199444 r201718  
    11'use strict';
    22
    3 let assert = require('assert');
     3const assert = require('assert');
    44
    55require('../tools/js/v3-models.js');
    66
    7 let TestServer = require('./resources/test-server.js');
     7const MockData = require('./resources/mock-data.js');
     8const TestServer = require('./resources/test-server.js');
    89
    910describe('/api/manifest', function () {
  • trunk/Websites/perf.webkit.org/server-tests/api-report-commits-tests.js

    r199191 r201718  
    22
    33const assert = require('assert');
    4 const crypto = require('crypto');
    54
    65const TestServer = require('./resources/test-server.js');
  • trunk/Websites/perf.webkit.org/server-tests/resources/mock-data.js

    r199332 r201718  
    1717        TestGroup.clearStaticMap();
    1818    },
     19    someTestId() { return 200; },
     20    somePlatformId() { return 65; },
    1921    addMockData: function (db, statusList)
    2022    {
     
    2931            db.insert('commits', {id: 93116, repository: 11, revision: '191622', time: (new Date(1445945816878)).toISOString()}),
    3032            db.insert('commits', {id: 96336, repository: 11, revision: '192736', time: (new Date(1448225325650)).toISOString()}),
    31             db.insert('platforms', {id: 65, name: 'some platform'}),
    32             db.insert('tests', {id: 200, name: 'some test'}),
     33            db.insert('platforms', {id: MockData.somePlatformId(), name: 'some platform'}),
     34            db.insert('tests', {id: MockData.someTestId(), name: 'some test'}),
    3335            db.insert('test_metrics', {id: 300, test: 200, name: 'some metric'}),
    3436            db.insert('test_configurations', {id: 301, metric: 300, platform: 65, type: 'current'}),
  • trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js

    r199388 r201718  
    11'use strict';
    22
    3 let assert = require('assert');
    4 
    5 let BuildbotTriggerable = require('../tools/js/buildbot-triggerable.js').BuildbotTriggerable;
    6 let MockData = require('./resources/mock-data.js');
    7 let MockRemoteAPI = require('../unit-tests/resources/mock-remote-api.js').MockRemoteAPI;
    8 let TestServer = require('./resources/test-server.js');
     3const assert = require('assert');
     4
     5const BuildbotTriggerable = require('../tools/js/buildbot-triggerable.js').BuildbotTriggerable;
     6const MockData = require('./resources/mock-data.js');
     7const MockRemoteAPI = require('../unit-tests/resources/mock-remote-api.js').MockRemoteAPI;
     8const TestServer = require('./resources/test-server.js');
     9const connectToDatabaseInEveryTest = require('./resources/common-operations.js').connectToDatabaseInEveryTest;
    910
    1011class MockLogger {
     
    903904        });
    904905    });
     906
     907    describe('updateTriggerables', function () {
     908        connectToDatabaseInEveryTest();
     909
     910        it('should update available triggerables', function (done) {
     911            let db = TestServer.database();
     912            MockData.addMockData(db).then(function () {
     913                return Manifest.fetch();
     914            }).then(function () {
     915                return db.selectAll('triggerable_configurations', 'test');
     916            }).then(function (configurations) {
     917                assert.equal(configurations.length, 0);
     918                let config = MockData.mockTestSyncConfigWithSingleBuilder();
     919                let logger = new MockLogger;
     920                let slaveInfo = {name: 'sync-slave', password: 'password'};
     921                let triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
     922                return triggerable.updateTriggerable();
     923            }).then(function () {
     924                return db.selectAll('triggerable_configurations', 'test');
     925            }).then(function (configurations) {
     926                assert.equal(configurations.length, 1);
     927                assert.equal(configurations[0].test, MockData.someTestId());
     928                assert.equal(configurations[0].platform, MockData.somePlatformId());
     929                done();
     930            }).catch(done);
     931        });
     932    });
     933
    905934});
  • trunk/Websites/perf.webkit.org/tools/js/buildbot-triggerable.js

    r199388 r201718  
    2727
    2828    name() { return this._name; }
     29
     30    updateTriggerable()
     31    {
     32        const map = new Map;
     33        for (const syncer of this._syncers) {
     34            for (const config of syncer.testConfigurations()) {
     35                const entry = {test: config.test.id(), platform: config.platform.id()};
     36                map.set(entry.test + '-' + entry.platform, entry);
     37            }
     38        }
     39        return this._remote.postJSON(`/api/update-triggerable/`, {
     40            'slaveName': this._slaveInfo.name,
     41            'slavePassword': this._slaveInfo.password,
     42            'triggerable': this._name,
     43            'configurations': Array.from(map.values())});
     44    }
    2945
    3046    syncOnce()
  • trunk/Websites/perf.webkit.org/tools/js/database.js

    r199191 r201718  
    143143    'tests': 'test',
    144144    'tracker_repositories': 'tracrepo',
     145    'triggerable_configurations': 'trigconfig',
    145146    'platforms': 'platform',
    146147    'reports': 'report',
  • trunk/Websites/perf.webkit.org/tools/js/remote.js

    r199266 r201718  
    7272        const payload = JSON.stringify(data);
    7373        return this.sendHttpRequest(path, 'POST', 'application/json', payload).then(function (result) {
    74             return JSON.parse(result.responseText);
     74            try {
     75                return JSON.parse(result.responseText);
     76            } catch (error) {
     77                console.error(result.responseText);
     78                throw error;
     79            }
    7580        });
    7681    }
  • trunk/Websites/perf.webkit.org/tools/sync-buildbot.js

    r199220 r201718  
    4242
    4343    console.log(`Fetching the manifest...`);
     44
     45    let triggerable;
    4446    Manifest.fetch().then(function () {
    45         let triggerable = new BuildbotTriggerable(buildbotConfig, global.RemoteAPI, buildbotRemote, serverConfig.slave, console);
     47        triggerable = new BuildbotTriggerable(buildbotConfig, global.RemoteAPI, buildbotRemote, serverConfig.slave, console);
     48        return triggerable.updateTriggerable();
     49    }).then(function () {
    4650        return triggerable.syncOnce();
    4751    }).catch(function (error) {
Note: See TracChangeset for help on using the changeset viewer.