BuildRequest should have associated platform and test
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Mar 2016 04:18:39 +0000 (04:18 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Mar 2016 04:18:39 +0000 (04:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156054

Reviewed by Joseph Pecoraro.

Added methods to retrieve the platform and the test associated with a build request with tests.

* public/v3/models/build-request.js:
(BuildRequest):
(BuildRequest.prototype.platform): Added.
(BuildRequest.prototype.test): Added.
* server-tests/api-build-requests-tests.js:
* server-tests/api-manifest.js: Fixed a typo. This tests /api/manifest, not /api/build-requests.
* unit-tests/buildbot-syncer-tests.js:
(.createSampleBuildRequest): Now takes Platform and Test objects to avoid hitting assertions in
BuildRequest's constructor.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@198882 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/public/v3/models/build-request.js
Websites/perf.webkit.org/server-tests/api-build-requests-tests.js
Websites/perf.webkit.org/server-tests/api-manifest.js
Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js

index e6257fc..95ca09d 100644 (file)
@@ -1,5 +1,24 @@
 2016-03-30  Ryosuke Niwa  <rniwa@webkit.org>
 
+        BuildRequest should have associated platform and test
+        https://bugs.webkit.org/show_bug.cgi?id=156054
+
+        Reviewed by Joseph Pecoraro.
+
+        Added methods to retrieve the platform and the test associated with a build request with tests.
+
+        * public/v3/models/build-request.js:
+        (BuildRequest):
+        (BuildRequest.prototype.platform): Added.
+        (BuildRequest.prototype.test): Added.
+        * server-tests/api-build-requests-tests.js:
+        * server-tests/api-manifest.js: Fixed a typo. This tests /api/manifest, not /api/build-requests.
+        * unit-tests/buildbot-syncer-tests.js:
+        (.createSampleBuildRequest): Now takes Platform and Test objects to avoid hitting assertions in
+        BuildRequest's constructor.
+
+2016-03-30  Ryosuke Niwa  <rniwa@webkit.org>
+
         BuildRequest should have a method to fetch all in-progress and pending requests for a triggerable
         https://bugs.webkit.org/show_bug.cgi?id=156008
 
index ed71451..d773bd3 100644 (file)
@@ -10,6 +10,10 @@ class BuildRequest extends DataModelObject {
         this._testGroup = object.testGroup;
         if (this._testGroup)
             this._testGroup.addBuildRequest(this);
+        console.assert(object.platform instanceof Platform);
+        this._platform = object.platform;
+        console.assert(object.test instanceof Test);
+        this._test = object.test;
         this._order = object.order;
         console.assert(object.rootSet instanceof RootSet);
         this._rootSet = object.rootSet;
@@ -31,6 +35,8 @@ class BuildRequest extends DataModelObject {
 
     testGroupId() { return this._testGroupId; }
     testGroup() { return this._testGroup; }
+    platform() { return this._platform; }
+    test() { return this._test; }
     order() { return this._order; }
     rootSet() { return this._rootSet; }
 
index 9a0ee2a..6667530 100644 (file)
@@ -215,7 +215,16 @@ describe('/api/build-requests', function () {
         }).then(function (buildRequests) {
             assert.equal(buildRequests.length, 4);
 
+            let test = Test.findById(200);
+            assert(test);
+
+            let platform = Platform.findById(65);
+            assert(platform);
+
             assert.equal(buildRequests[0].id(), 700);
+            assert.equal(buildRequests[0].testGroupId(), 600);
+            assert.equal(buildRequests[0].test(), test);
+            assert.equal(buildRequests[0].platform(), platform);
             assert.equal(buildRequests[0].order(), 0);
             assert.ok(buildRequests[0].rootSet() instanceof RootSet);
             assert.ok(!buildRequests[0].hasFinished());
@@ -224,6 +233,9 @@ describe('/api/build-requests', function () {
             assert.equal(buildRequests[0].statusLabel(), 'Waiting to be scheduled');
 
             assert.equal(buildRequests[1].id(), 701);
+            assert.equal(buildRequests[1].testGroupId(), 600);
+            assert.equal(buildRequests[1].test(), test);
+            assert.equal(buildRequests[1].platform(), platform);
             assert.equal(buildRequests[1].order(), 1);
             assert.ok(buildRequests[1].rootSet() instanceof RootSet);
             assert.ok(!buildRequests[1].hasFinished());
@@ -232,6 +244,9 @@ describe('/api/build-requests', function () {
             assert.equal(buildRequests[1].statusLabel(), 'Waiting to be scheduled');
 
             assert.equal(buildRequests[2].id(), 702);
+            assert.equal(buildRequests[2].testGroupId(), 600);
+            assert.equal(buildRequests[2].test(), test);
+            assert.equal(buildRequests[2].platform(), platform);
             assert.equal(buildRequests[2].order(), 2);
             assert.ok(buildRequests[2].rootSet() instanceof RootSet);
             assert.ok(!buildRequests[2].hasFinished());
@@ -240,6 +255,9 @@ describe('/api/build-requests', function () {
             assert.equal(buildRequests[2].statusLabel(), 'Waiting to be scheduled');
 
             assert.equal(buildRequests[3].id(), 703);
+            assert.equal(buildRequests[3].testGroupId(), 600);
+            assert.equal(buildRequests[3].test(), test);
+            assert.equal(buildRequests[3].platform(), platform);
             assert.equal(buildRequests[3].order(), 3);
             assert.ok(buildRequests[3].rootSet() instanceof RootSet);
             assert.ok(!buildRequests[3].hasFinished());
index caae155..b5d3452 100644 (file)
@@ -6,7 +6,7 @@ require('../tools/js/v3-models.js');
 
 let TestServer = require('./resources/test-server.js');
 
-describe('/api/build-requests', function () {
+describe('/api/manifest', function () {
     this.timeout(10000);
     TestServer.inject();
 
index 1586684..82f0439 100644 (file)
@@ -71,15 +71,18 @@ let sampleRootSetData = {
     }
 };
 
-function createSampleBuildRequest()
+function createSampleBuildRequest(platform, test)
 {
+    assert(platform instanceof Platform);
+    assert(test instanceof Test);
+
     let rootSet = RootSet.ensureSingleton('4197', {roots: [
         {'id': '111127', 'time': 1456955807334, 'repository': MockModels.webkit, 'revision': '197463'},
         {'id': '111237', 'time': 1456931874000, 'repository': MockModels.sharedRepository, 'revision': '80229'},
         {'id': '88930', 'time': 0, 'repository': MockModels.ios, 'revision': '13A452'},
     ]});
 
-    let request = BuildRequest.ensureSingleton('16733', {'rootSet': rootSet, 'status': 'pending'});
+    let request = BuildRequest.ensureSingleton('16733', {'rootSet': rootSet, 'status': 'pending', 'platform': platform, 'test': test});
     return request;
 }
 
@@ -424,37 +427,38 @@ describe('BuildbotSyncer', function () {
     describe('_propertiesForBuildRequest', function () {
         it('should include all properties specified in a given configuration', function () {
             let syncers = BuildbotSyncer._loadConfig('http://build.webkit.org/', sampleiOSConfig());
-            let properties = syncers[0]._propertiesForBuildRequest(createSampleBuildRequest());
+            let properties = syncers[0]._propertiesForBuildRequest(createSampleBuildRequest(MockModels.iphone, MockModels.speedometer));
             assert.deepEqual(Object.keys(properties), ['desired_image', 'roots_dict', 'test_name', 'forcescheduler', 'build_request_id']);
         });
 
         it('should preserve non-parametric property values', function () {
             let syncers = BuildbotSyncer._loadConfig('http://build.webkit.org/', sampleiOSConfig());
-            let properties = syncers[0]._propertiesForBuildRequest(createSampleBuildRequest());
+            let properties = syncers[0]._propertiesForBuildRequest(createSampleBuildRequest(MockModels.iphone, MockModels.speedometer));
             assert.equal(properties['test_name'], 'speedometer');
             assert.equal(properties['forcescheduler'], 'ABTest-iPhone-RunBenchmark-Tests-ForceScheduler');
 
-            properties = syncers[1]._propertiesForBuildRequest(createSampleBuildRequest());
+            properties = syncers[1]._propertiesForBuildRequest(createSampleBuildRequest(MockModels.iphone, MockModels.speedometer));
             assert.equal(properties['test_name'], 'jetstream');
             assert.equal(properties['forcescheduler'], 'ABTest-iPhone-RunBenchmark-Tests-ForceScheduler');
         });
 
         it('should resolve "root"', function () {
             let syncers = BuildbotSyncer._loadConfig('http://build.webkit.org/', sampleiOSConfig());
-            let properties = syncers[0]._propertiesForBuildRequest(createSampleBuildRequest());
+            let properties = syncers[0]._propertiesForBuildRequest(createSampleBuildRequest(MockModels.iphone, MockModels.speedometer));
             assert.equal(properties['desired_image'], '13A452');
         });
 
         it('should resolve "rootsExcluding"', function () {
             let syncers = BuildbotSyncer._loadConfig('http://build.webkit.org/', sampleiOSConfig());
-            let properties = syncers[0]._propertiesForBuildRequest(createSampleBuildRequest());
+            let properties = syncers[0]._propertiesForBuildRequest(createSampleBuildRequest(MockModels.iphone, MockModels.speedometer));
             assert.equal(properties['roots_dict'], JSON.stringify(sampleRootSetData));
         });
 
         it('should set the property for the build request id', function () {
             let syncers = BuildbotSyncer._loadConfig('http://build.webkit.org/', sampleiOSConfig());
-            let properties = syncers[0]._propertiesForBuildRequest(createSampleBuildRequest());
-            assert.equal(properties['build_request_id'], createSampleBuildRequest().id());
+            let request = createSampleBuildRequest(MockModels.iphone, MockModels.speedometer);
+            let properties = syncers[0]._propertiesForBuildRequest(request);
+            assert.equal(properties['build_request_id'], request.id());
         });
     });