Bug 182036 - Create BuildbotBuildEntry in Buildbot syncer in Buildbot 0.9 format
Summary: Create BuildbotBuildEntry in Buildbot syncer in Buildbot 0.9 format
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Aakash Jain
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-01-23 20:48 PST by Aakash Jain
Modified: 2018-02-01 23:09 PST (History)
8 users (show)

See Also:


Attachments
Proposed patch (14.50 KB, patch)
2018-01-23 21:03 PST, Aakash Jain
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews206 for win-future (12.05 MB, application/zip)
2018-01-23 22:59 PST, EWS Watchlist
no flags Details
Proposed patch (14.50 KB, patch)
2018-01-29 11:57 PST, Aakash Jain
rniwa: review-
Details | Formatted Diff | Diff
Updated patch with unit-tests (31.09 KB, patch)
2018-02-01 18:06 PST, Aakash Jain
rniwa: review+
Details | Formatted Diff | Diff
Patch for landing (31.11 KB, patch)
2018-02-01 21:57 PST, Aakash Jain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aakash Jain 2018-01-23 20:48:14 PST
As part of supporting Buildbot 0.9, BuildbotBuildEntry (inside OpenSource/Websites/perf.webkit.org/tools/js/buildbot-syncer.js) should handle the Buildbot 0.9 data format.
Comment 1 Aakash Jain 2018-01-23 21:03:12 PST
Created attachment 332121 [details]
Proposed patch

Created new BuildbotBuildEntry class and moved previous one to BuildbotBuildEntryDeprecated. Did not sub-classed (or did not tried to share code between these classes) as we are not simultaneously supporting both Buildbot versions. BuildbotBuildEntryDeprecated will be simply deleted later on.
Comment 2 EWS Watchlist 2018-01-23 22:59:26 PST Comment hidden (obsolete)
Comment 3 EWS Watchlist 2018-01-23 22:59:36 PST Comment hidden (obsolete)
Comment 4 Aakash Jain 2018-01-29 11:57:45 PST
Created attachment 332565 [details]
Proposed patch
Comment 5 Ryosuke Niwa 2018-01-30 00:17:35 PST
Comment on attachment 332565 [details]
Proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=332565&action=review

> Websites/perf.webkit.org/tools/js/buildbot-syncer.js:38
> +    buildRequestStatusIfUpdateIsNeeded(request)

We shouldn't be duplicating the code for this function.
r- due to this code duplication.

> Websites/perf.webkit.org/tools/js/buildbot-syncer.js:68
> +        this._isPending = false;
> +        if ('claimed' in rawData)
> +            this._isPending = !rawData['claimed'];

These three lines of code should just be: this._isPending = 'claimed' in rawData && !rawData['claimed'].

> Websites/perf.webkit.org/tools/js/buildbot-syncer.js:75
> +        if (!('properties' in rawData))
> +            return;
> +        if (rawData.properties.workername)
> +            this._workerName = rawData.properties.workername[0];

These lines code should simply be: this._workerName = rawData['properties'] && rawData['properties']['workername'] ? rawData['properties']['workername'][0] : null.
But is it really guaranteed that worker name always contain exactly one item?

> Websites/perf.webkit.org/tools/js/buildbot-syncer.js:78
> +    syncer() { return this._syncer; }

Instead of duplicating all the code, make one inherit from another.

> Websites/perf.webkit.org/tools/js/buildbot-syncer.js:271
> +    urlForPendingBuild(buildrequestid) { return this._remote.url(`/#/buildrequests/${buildrequestid}`); }

buildrequestid should be camelCase: buildRequestId
Comment 6 Aakash Jain 2018-02-01 18:06:37 PST
Created attachment 332927 [details]
Updated patch with unit-tests

Added unit-tests.
Removed code-duplication by inheriting BuildbotBuildEntryDeprecated from BuildbotBuildEntry.
Incorporated review comments.
Comment 7 Ryosuke Niwa 2018-02-01 21:34:35 PST
Comment on attachment 332927 [details]
Updated patch with unit-tests

View in context: https://bugs.webkit.org/attachment.cgi?id=332927&action=review

> Websites/perf.webkit.org/tools/js/buildbot-syncer.js:253
> +    urlForPendingBuild(buildRequestId) { return this._remote.url(`/#/buildrequests/${buildRequestId}`); }

Huh, it's neat that you can find a build based on a build property.

> Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js:1278
> +            let syncer = BuildbotSyncer._loadConfig(MockRemoteAPI, sampleiOSConfig(), builderNameToIDMap())[1];
> +            let buildbotData = samplePendingBuild();
> +            let pendingEntries = buildbotData.buildrequests.map((entry) => new BuildbotBuildEntry(syncer, entry));

Use const.

> Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js:1281
> +            let entry = pendingEntries[0];

Ditto.

> Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js:1298
> +            let syncer = BuildbotSyncer._loadConfig(MockRemoteAPI, sampleiOSConfig(), builderNameToIDMap())[1];
> +            let buildbotData = sampleInProgressBuild();
> +            let entries = buildbotData.builds.map((entry) => new BuildbotBuildEntry(syncer, entry));
> +
> +            assert.equal(entries.length, 1);
> +            let entry = entries[0];

Ditto for using const.

> Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js:1315
> +            let syncer = BuildbotSyncer._loadConfig(MockRemoteAPI, sampleiOSConfig(), builderNameToIDMap())[1];
> +            let buildbotData = sampleFinishedBuild();
> +            let entries = buildbotData.builds.map((entry) => new BuildbotBuildEntry(syncer, entry));
> +
> +            assert.deepEqual(entries.length, 1);
> +            let entry = entries[0];

Ditto.

> Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js:1329
> +            let syncer = BuildbotSyncer._loadConfig(MockRemoteAPI, sampleiOSConfig(), builderNameToIDMap())[1];
> +            let buildbotData = {'builds': [sampleInProgressBuildData(), sampleFinishedBuildData()]};
> +            let entries = buildbotData.builds.map((entry) => new BuildbotBuildEntry(syncer, entry));

Ditto.
Comment 8 Aakash Jain 2018-02-01 21:57:19 PST
Created attachment 332939 [details]
Patch for landing

Used const instead of let.
Comment 9 WebKit Commit Bot 2018-02-01 23:06:24 PST
Comment on attachment 332939 [details]
Patch for landing

Clearing flags on attachment: 332939

Committed r227996: <https://trac.webkit.org/changeset/227996>
Comment 10 WebKit Commit Bot 2018-02-01 23:06:25 PST
All reviewed patches have been landed.  Closing bug.
Comment 11 Radar WebKit Bug Importer 2018-02-01 23:09:03 PST
<rdar://problem/37146332>