<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[213969] trunk/Websites/perf.webkit.org</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/213969">213969</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2017-03-14 20:19:02 -0700 (Tue, 14 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Make server tests return a promise instead of manually calling done
https://bugs.webkit.org/show_bug.cgi?id=169648

Rubber-stamped by Chris Dumez.

Make the existing server tests always reutrn a promise instead of manually calling &quot;done&quot; callback.
The promise tests are a lot more stable and less error prone.

Also use arrow functions everywhere and use prepareServerTest, renamed from connectToDatabaseInEveryTest,
in more tests instead of manually connecting to database in every test, and reset v3 models.

* server-tests/admin-platforms-tests.js:
* server-tests/admin-reprocess-report-tests.js:
* server-tests/api-build-requests-tests.js:
* server-tests/api-manifest.js:
* server-tests/api-measurement-set-tests.js:
(.postReports): Deleted. Not used in any test.
* server-tests/api-report-commits-tests.js:
* server-tests/api-report-tests.js:
* server-tests/api-update-triggerable.js:
* server-tests/privileged-api-upate-run-status.js:
* server-tests/resources/common-operations.js:
(prepareServerTest): Renamed from connectToDatabaseInEveryTest. Increase the timeout and reset v3 models.
* server-tests/tools-buildbot-triggerable-tests.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebsitesperfwebkitorgChangeLog">trunk/Websites/perf.webkit.org/ChangeLog</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsadminplatformstestsjs">trunk/Websites/perf.webkit.org/server-tests/admin-platforms-tests.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsadminreprocessreporttestsjs">trunk/Websites/perf.webkit.org/server-tests/admin-reprocess-report-tests.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsapibuildrequeststestsjs">trunk/Websites/perf.webkit.org/server-tests/api-build-requests-tests.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsapicommitsjs">trunk/Websites/perf.webkit.org/server-tests/api-commits.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsapimanifestjs">trunk/Websites/perf.webkit.org/server-tests/api-manifest.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsapimeasurementsettestsjs">trunk/Websites/perf.webkit.org/server-tests/api-measurement-set-tests.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsapireportcommitstestsjs">trunk/Websites/perf.webkit.org/server-tests/api-report-commits-tests.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsapireporttestsjs">trunk/Websites/perf.webkit.org/server-tests/api-report-tests.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsapiupdatetriggerablejs">trunk/Websites/perf.webkit.org/server-tests/api-update-triggerable.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsprivilegedapiupaterunstatusjs">trunk/Websites/perf.webkit.org/server-tests/privileged-api-upate-run-status.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsresourcescommonoperationsjs">trunk/Websites/perf.webkit.org/server-tests/resources/common-operations.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgserverteststoolsbuildbottriggerabletestsjs">trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebsitesperfwebkitorgChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/ChangeLog (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/ChangeLog        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/ChangeLog        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2017-03-14  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        Make server tests return a promise instead of manually calling done
+        https://bugs.webkit.org/show_bug.cgi?id=169648
+
+        Rubber-stamped by Chris Dumez.
+
+        Make the existing server tests always reutrn a promise instead of manually calling &quot;done&quot; callback.
+        The promise tests are a lot more stable and less error prone.
+
+        Also use arrow functions everywhere and use prepareServerTest, renamed from connectToDatabaseInEveryTest,
+        in more tests instead of manually connecting to database in every test, and reset v3 models.
+
+        * server-tests/admin-platforms-tests.js:
+        * server-tests/admin-reprocess-report-tests.js:
+        * server-tests/api-build-requests-tests.js:
+        * server-tests/api-manifest.js:
+        * server-tests/api-measurement-set-tests.js:
+        (.postReports): Deleted. Not used in any test.
+        * server-tests/api-report-commits-tests.js:
+        * server-tests/api-report-tests.js:
+        * server-tests/api-update-triggerable.js:
+        * server-tests/privileged-api-upate-run-status.js:
+        * server-tests/resources/common-operations.js:
+        (prepareServerTest): Renamed from connectToDatabaseInEveryTest. Increase the timeout and reset v3 models.
+        * server-tests/tools-buildbot-triggerable-tests.js:
+
</ins><span class="cx"> 2017-03-12  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Rename RootSet to CommitSet
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsadminplatformstestsjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/admin-platforms-tests.js (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/admin-platforms-tests.js        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/server-tests/admin-platforms-tests.js        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -3,13 +3,11 @@
</span><span class="cx"> const assert = require('assert');
</span><span class="cx"> 
</span><span class="cx"> const TestServer = require('./resources/test-server.js');
</span><del>-const connectToDatabaseInEveryTest = require('./resources/common-operations.js').connectToDatabaseInEveryTest;
</del><ins>+const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
</ins><span class="cx"> const submitReport = require('./resources/common-operations.js').submitReport;
</span><span class="cx"> 
</span><span class="cx"> describe(&quot;/admin/platforms&quot;, function () {
</span><del>-    this.timeout(1000);
-    TestServer.inject();
-    connectToDatabaseInEveryTest();
</del><ins>+    prepareServerTest(this);
</ins><span class="cx"> 
</span><span class="cx">     function reportsForDifferentPlatforms()
</span><span class="cx">     {
</span><span class="lines">@@ -40,37 +38,36 @@
</span><span class="cx">             }];
</span><span class="cx">     } 
</span><span class="cx"> 
</span><del>-    it(&quot;should delete the platform that got merged into another one&quot;, function (done) {
</del><ins>+    it(&quot;should delete the platform that got merged into another one&quot;, () =&gt; {
</ins><span class="cx">         const db = TestServer.database();
</span><del>-        let oldPlatforms;        
-        submitReport(reportsForDifferentPlatforms()).then(function () {
</del><ins>+        let oldPlatforms;
+        return submitReport(reportsForDifferentPlatforms()).then(() =&gt; {
</ins><span class="cx">             return db.selectAll('platforms', 'name');
</span><del>-        }).then(function (platforms) {
</del><ins>+        }).then((platforms) =&gt; {
</ins><span class="cx">             oldPlatforms = platforms;
</span><span class="cx">             assert.equal(oldPlatforms.length, 3);
</span><span class="cx">             assert.equal(oldPlatforms[0]['name'], 'Mavericks');
</span><span class="cx">             assert.equal(oldPlatforms[1]['name'], 'Mountain Lion');
</span><span class="cx">             assert.equal(oldPlatforms[2]['name'], 'Trunk Mountain Lion');
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postFormUrlencodedData('/admin/platforms.php',
</span><span class="cx">                 {'action': 'merge', 'id': oldPlatforms[1]['id'], 'destination': oldPlatforms[2]['id']});
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return db.selectAll('platforms');
</span><del>-        }).then(function (newPlatforms) {
</del><ins>+        }).then((newPlatforms) =&gt; {
</ins><span class="cx">             assert.equal(newPlatforms.length, 2);
</span><span class="cx">             assert.deepEqual(newPlatforms[0], oldPlatforms[0]);
</span><span class="cx">             assert.deepEqual(newPlatforms[1], oldPlatforms[2]);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should move test runs from the merged platform to the destination platform&quot;, function (done) {
</del><ins>+    it(&quot;should move test runs from the merged platform to the destination platform&quot;, () =&gt; {
</ins><span class="cx">         let oldTestRuns;
</span><span class="cx">         const queryForRuns = 'SELECT * FROM test_runs, test_configurations, platforms WHERE run_config = config_id AND config_platform = platform_id ORDER by run_mean_cache';
</span><span class="cx">         const db = TestServer.database();
</span><del>-        submitReport(reportsForDifferentPlatforms()).then(function () {
</del><ins>+        return submitReport(reportsForDifferentPlatforms()).then(() =&gt; {
</ins><span class="cx">             return db.query(queryForRuns);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             oldTestRuns = result.rows;
</span><span class="cx">             assert.equal(oldTestRuns.length, 4);
</span><span class="cx">             assert.equal(oldTestRuns[0]['platform_name'], 'Mavericks');
</span><span class="lines">@@ -81,12 +78,12 @@
</span><span class="cx">             assert.equal(oldTestRuns[2]['run_sum_cache'], 18);
</span><span class="cx">             assert.equal(oldTestRuns[3]['platform_name'], 'Trunk Mountain Lion');
</span><span class="cx">             assert.equal(oldTestRuns[3]['run_sum_cache'], 24);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postFormUrlencodedData('/admin/platforms.php',
</span><span class="cx">                 {'action': 'merge', 'id': oldTestRuns[1]['platform_id'], 'destination': oldTestRuns[3]['platform_id']});
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return db.query(queryForRuns);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const newTestRuns = result.rows;
</span><span class="cx">             assert.equal(newTestRuns.length, 4);
</span><span class="cx">             assert.equal(newTestRuns[0]['run_id'], oldTestRuns[0]['run_id']);
</span><span class="lines">@@ -102,11 +99,10 @@
</span><span class="cx">             assert.equal(newTestRuns[3]['platform_name'], 'Trunk Mountain Lion');
</span><span class="cx">             assert.equal(newTestRuns[3]['run_sum_cache'], 24);
</span><span class="cx">             assert.equal(newTestRuns[1]['run_config'], newTestRuns[3]['run_config']);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should move test configurations from the merged platform to the destination platform&quot;, function (done) {
</del><ins>+    it(&quot;should move test configurations from the merged platform to the destination platform&quot;, () =&gt; {
</ins><span class="cx">         let oldConfigs;
</span><span class="cx">         const reports = reportsForDifferentPlatforms();
</span><span class="cx">         reports[0]['tests'] = {&quot;test&quot;: { &quot;metrics&quot;: {&quot;FrameRate&quot;: { &quot;baseline&quot;: [[1, 1, 1], [1, 1, 1]] } } } };
</span><span class="lines">@@ -113,9 +109,10 @@
</span><span class="cx">         const queryForConfig = 'SELECT * from test_configurations, platforms, test_metrics'
</span><span class="cx">             + ' where config_platform = platform_id and config_metric = metric_id and platform_name in ($1, $2) order by config_id';
</span><span class="cx">         const db = TestServer.database();
</span><del>-        submitReport(reports).then(function () {
</del><ins>+
+        return submitReport(reports).then(() =&gt; {
</ins><span class="cx">             return db.query(queryForConfig, [reports[0]['platform'], reports[2]['platform']]);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             oldConfigs = result.rows;
</span><span class="cx">             assert.equal(oldConfigs.length, 2);
</span><span class="cx">             assert.equal(oldConfigs[0]['platform_name'], reports[0]['platform']);
</span><span class="lines">@@ -124,12 +121,12 @@
</span><span class="cx">             assert.equal(oldConfigs[1]['platform_name'], reports[2]['platform']);
</span><span class="cx">             assert.equal(oldConfigs[1]['metric_name'], 'FrameRate');
</span><span class="cx">             assert.equal(oldConfigs[1]['config_type'], 'current');
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postFormUrlencodedData('/admin/platforms.php',
</span><span class="cx">                 {'action': 'merge', 'id': oldConfigs[0]['platform_id'], 'destination': oldConfigs[1]['platform_id']});
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return db.query(queryForConfig, [reports[0]['platform'], reports[2]['platform']]);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const newConfigs = result.rows;
</span><span class="cx">             assert.equal(newConfigs.length, 2);
</span><span class="cx">             assert.equal(newConfigs[0]['platform_name'], reports[2]['platform']);
</span><span class="lines">@@ -138,8 +135,7 @@
</span><span class="cx">             assert.equal(newConfigs[1]['platform_name'], reports[2]['platform']);
</span><span class="cx">             assert.equal(newConfigs[1]['metric_name'], 'FrameRate');
</span><span class="cx">             assert.equal(newConfigs[1]['config_type'], 'current');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsadminreprocessreporttestsjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/admin-reprocess-report-tests.js (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/admin-reprocess-report-tests.js        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/server-tests/admin-reprocess-report-tests.js        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -4,12 +4,10 @@
</span><span class="cx"> 
</span><span class="cx"> const TestServer = require('./resources/test-server.js');
</span><span class="cx"> const addBuilderForReport = require('./resources/common-operations.js').addBuilderForReport;
</span><del>-const connectToDatabaseInEveryTest = require('./resources/common-operations.js').connectToDatabaseInEveryTest;
</del><ins>+const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
</ins><span class="cx"> 
</span><span class="cx"> describe(&quot;/admin/reprocess-report&quot;, function () {
</span><del>-    this.timeout(1000);
-    TestServer.inject();
-    connectToDatabaseInEveryTest();
</del><ins>+    prepareServerTest(this);
</ins><span class="cx"> 
</span><span class="cx">     const simpleReport = [{
</span><span class="cx">         &quot;buildNumber&quot;: &quot;1986&quot;,
</span><span class="lines">@@ -43,34 +41,33 @@
</span><span class="cx">             }
</span><span class="cx">         }];
</span><span class="cx"> 
</span><del>-    it(&quot;should still create new repository when repository ownerships are different&quot;, function (done) {
</del><ins>+    it(&quot;should still create new repository when repository ownerships are different&quot;, () =&gt; {
</ins><span class="cx">         let db = TestServer.database();
</span><del>-        addBuilderForReport(simpleReportWithRevisions[0]).then(function () {
</del><ins>+        return addBuilderForReport(simpleReportWithRevisions[0]).then(() =&gt; {
</ins><span class="cx">             return db.insert('repositories', {'name': 'WebKit', 'owner': 1});
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', simpleReportWithRevisions);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return db.selectRows('repositories', {'name': 'WebKit'});
</span><del>-        }).then(function (repositories) {
</del><ins>+        }).then((repositories) =&gt; {
</ins><span class="cx">             assert.equal(repositories.length, 2);
</span><span class="cx">             const webkitRepsitoryId = repositories[0].owner == 1 ? repositories[1].id : repositories[0].id;
</span><span class="cx">             return db.selectRows('commits', {'revision': '213214', 'repository': webkitRepsitoryId});
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             assert(result.length, 1);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should add build&quot;, function (done) {
</del><ins>+    it(&quot;should add build&quot;, () =&gt; {
</ins><span class="cx">         let db = TestServer.database();
</span><span class="cx">         let reportId;
</span><del>-        addBuilderForReport(simpleReport[0]).then(function () {
</del><ins>+        return addBuilderForReport(simpleReport[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', simpleReport);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return Promise.all([db.selectAll('builds'), db.selectAll('reports')]);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const builds = result[0];
</span><span class="cx">             const reports = result[1];
</span><span class="cx">             assert.equal(builds.length, 1);
</span><span class="lines">@@ -79,37 +76,36 @@
</span><span class="cx">             reportId = reports[0]['id'];
</span><span class="cx">             assert.equal(reports[0]['build_number'], 1986);
</span><span class="cx">             return db.query('UPDATE reports SET report_build = NULL; DELETE FROM builds');
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return db.selectAll('builds');
</span><del>-        }).then(function (builds) {
</del><ins>+        }).then((builds) =&gt; {
</ins><span class="cx">             assert.equal(builds.length, 0);
</span><span class="cx">             return TestServer.remoteAPI().getJSONWithStatus(`/admin/reprocess-report?report=${reportId}`);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return db.selectAll('builds');
</span><del>-        }).then(function (builds) {
</del><ins>+        }).then((builds) =&gt; {
</ins><span class="cx">             assert.equal(builds.length, 1);
</span><span class="cx">             assert.equal(builds[0]['number'], 1986);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should not duplicate the reprocessed report&quot;, function (done) {
</del><ins>+    it(&quot;should not duplicate the reprocessed report&quot;, () =&gt; {
</ins><span class="cx">         let db = TestServer.database();
</span><span class="cx">         let originalReprot;
</span><del>-        addBuilderForReport(simpleReport[0]).then(function () {
</del><ins>+        return addBuilderForReport(simpleReport[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', simpleReport);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return db.selectAll('reports');
</span><del>-        }).then(function (reports) {
</del><ins>+        }).then((reports) =&gt; {
</ins><span class="cx">             assert.equal(reports.length, 1);
</span><span class="cx">             originalReprot = reports[0];
</span><span class="cx">             return db.query('UPDATE reports SET report_build = NULL; DELETE FROM builds');
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSONWithStatus(`/admin/reprocess-report?report=${originalReprot['id']}`);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return db.selectAll('reports');
</span><del>-        }).then(function (reports) {
</del><ins>+        }).then((reports) =&gt; {
</ins><span class="cx">             assert.equal(reports.length, 1);
</span><span class="cx">             const newPort = reports[0];
</span><span class="cx">             originalReprot['committed_at'] = null;
</span><span class="lines">@@ -118,7 +114,6 @@
</span><span class="cx">             originalReprot['build'] = null;
</span><span class="cx">             newPort['build'] = null;
</span><span class="cx">             assert.deepEqual(originalReprot, newPort);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsapibuildrequeststestsjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/api-build-requests-tests.js (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/api-build-requests-tests.js        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/server-tests/api-build-requests-tests.js        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -4,44 +4,33 @@
</span><span class="cx"> 
</span><span class="cx"> let MockData = require('./resources/mock-data.js');
</span><span class="cx"> let TestServer = require('./resources/test-server.js');
</span><ins>+const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
</ins><span class="cx"> 
</span><span class="cx"> describe('/api/build-requests', function () {
</span><del>-    this.timeout(1000);
-    TestServer.inject();
</del><ins>+    prepareServerTest(this);
</ins><span class="cx"> 
</span><del>-    beforeEach(function () {
-        MockData.resetV3Models();
-    });
-
-    it('should return &quot;TriggerableNotFound&quot; when the database is empty', function (done) {
-        TestServer.remoteAPI().getJSON('/api/build-requests/build-webkit').then(function (content) {
</del><ins>+    it('should return &quot;TriggerableNotFound&quot; when the database is empty', () =&gt; {
+        return TestServer.remoteAPI().getJSON('/api/build-requests/build-webkit').then((content) =&gt; {
</ins><span class="cx">             assert.equal(content['status'], 'TriggerableNotFound');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should return an empty list when there are no build requests', function (done) {
-        TestServer.database().connect().then(function () {
-            return TestServer.database().insert('build_triggerables', {name: 'build-webkit'});
-        }).then(function () {
</del><ins>+    it('should return an empty list when there are no build requests', () =&gt; {
+        return TestServer.database().insert('build_triggerables', {name: 'build-webkit'}).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSON('/api/build-requests/build-webkit');
</span><del>-        }).then(function (content) {
</del><ins>+        }).then((content) =&gt; {
</ins><span class="cx">             assert.equal(content['status'], 'OK');
</span><span class="cx">             assert.deepEqual(content['buildRequests'], []);
</span><span class="cx">             assert.deepEqual(content['commitSets'], []);
</span><span class="cx">             assert.deepEqual(content['commits'], []);
</span><span class="cx">             assert.deepEqual(Object.keys(content).sort(), ['buildRequests', 'commitSets', 'commits', 'status']);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should return build requets associated with a given triggerable with appropriate commits and commitSets', function (done) {
-        let db = TestServer.database();
-        db.connect().then(function () {
-            return MockData.addMockData(db);
-        }).then(function () {
</del><ins>+    it('should return build requets associated with a given triggerable with appropriate commits and commitSets', () =&gt; {
+        return MockData.addMockData(TestServer.database()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSONWithStatus('/api/build-requests/build-webkit');
</span><del>-        }).then(function (content) {
</del><ins>+        }).then((content) =&gt; {
</ins><span class="cx">             assert.deepEqual(Object.keys(content).sort(), ['buildRequests', 'commitSets', 'commits', 'status']);
</span><span class="cx"> 
</span><span class="cx">             assert.equal(content['commitSets'].length, 2);
</span><span class="lines">@@ -89,17 +78,13 @@
</span><span class="cx">             assert.deepEqual(content['buildRequests'][3].commitSet, 402);
</span><span class="cx">             assert.deepEqual(content['buildRequests'][3].status, 'pending');
</span><span class="cx">             assert.deepEqual(content['buildRequests'][3].test, '200');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should support useLegacyIdResolution option', function (done) {
-        let db = TestServer.database();
-        db.connect().then(function () {
-            return MockData.addMockData(db);
-        }).then(function () {
</del><ins>+    it('should support useLegacyIdResolution option', () =&gt; {
+        return MockData.addMockData(TestServer.database()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSONWithStatus('/api/build-requests/build-webkit?useLegacyIdResolution=true');
</span><del>-        }).then(function (content) {
</del><ins>+        }).then((content) =&gt; {
</ins><span class="cx">             assert.deepEqual(Object.keys(content).sort(), ['buildRequests', 'commitSets', 'commits', 'status']);
</span><span class="cx"> 
</span><span class="cx">             assert.equal(content['commitSets'].length, 2);
</span><span class="lines">@@ -147,19 +132,15 @@
</span><span class="cx">             assert.deepEqual(content['buildRequests'][3].commitSet, 402);
</span><span class="cx">             assert.deepEqual(content['buildRequests'][3].status, 'pending');
</span><span class="cx">             assert.deepEqual(content['buildRequests'][3].test, ['some test']);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should be fetchable by BuildRequest.fetchForTriggerable', function (done) {
-        let db = TestServer.database();
-        db.connect().then(function () {
-            return MockData.addMockData(db);
-        }).then(function () {
</del><ins>+    it('should be fetchable by BuildRequest.fetchForTriggerable', () =&gt; {
+        return MockData.addMockData(TestServer.database()).then(() =&gt; {
</ins><span class="cx">             return Manifest.fetch();
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return BuildRequest.fetchForTriggerable('build-webkit');
</span><del>-        }).then(function (buildRequests) {
</del><ins>+        }).then((buildRequests) =&gt; {
</ins><span class="cx">             assert.equal(buildRequests.length, 4);
</span><span class="cx"> 
</span><span class="cx">             let test = Test.findById(200);
</span><span class="lines">@@ -241,48 +222,35 @@
</span><span class="cx">             let secondWebKitCommit = secondCommitSet.commitForRepository(webkit);
</span><span class="cx">             assert.equal(secondWebKitCommit.revision(), '192736');
</span><span class="cx">             assert.equal(+secondWebKitCommit.time(), 1448225325650);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should not include a build request if all requests in the same group had been completed', function (done) {
-        let db = TestServer.database();
-        db.connect().then(function () {
-            return MockData.addMockData(db, ['completed', 'completed', 'completed', 'completed']);
-        }).then(function () {
</del><ins>+    it('should not include a build request if all requests in the same group had been completed', () =&gt; {
+        return MockData.addMockData(TestServer.database(), ['completed', 'completed', 'completed', 'completed']).then(() =&gt; {
</ins><span class="cx">             return Manifest.fetch();
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return BuildRequest.fetchForTriggerable('build-webkit');
</span><del>-        }).then(function (buildRequests) {
</del><ins>+        }).then((buildRequests) =&gt; {
</ins><span class="cx">             assert.equal(buildRequests.length, 0);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should not include a build request if all requests in the same group had been failed or cancled', function (done) {
-        let db = TestServer.database();
-        db.connect().then(function () {
-            return MockData.addMockData(db, ['failed', 'failed', 'canceled', 'canceled']);
-        }).then(function () {
</del><ins>+    it('should not include a build request if all requests in the same group had been failed or cancled', () =&gt; {
+        return MockData.addMockData(TestServer.database(), ['failed', 'failed', 'canceled', 'canceled']).then(() =&gt; {
</ins><span class="cx">             return Manifest.fetch();
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return BuildRequest.fetchForTriggerable('build-webkit');
</span><del>-        }).then(function (buildRequests) {
</del><ins>+        }).then((buildRequests) =&gt; {
</ins><span class="cx">             assert.equal(buildRequests.length, 0);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should include all build requests of a test group if one of the reqeusts in the group had not been finished', function (done) {
-        let db = TestServer.database();
-        db.connect().then(function () {
-            return MockData.addMockData(db, ['completed', 'completed', 'scheduled', 'pending']);
-        }).then(function () {
</del><ins>+    it('should include all build requests of a test group if one of the reqeusts in the group had not been finished', () =&gt; {
+        return MockData.addMockData(TestServer.database(), ['completed', 'completed', 'scheduled', 'pending']).then(() =&gt; {
</ins><span class="cx">             return Manifest.fetch();
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return BuildRequest.fetchForTriggerable('build-webkit');
</span><del>-        }).then(function (buildRequests) {
</del><ins>+        }).then((buildRequests) =&gt; {
</ins><span class="cx">             assert.equal(buildRequests.length, 4);
</span><span class="cx">             assert.ok(buildRequests[0].hasFinished());
</span><span class="cx">             assert.ok(buildRequests[0].hasStarted());
</span><span class="lines">@@ -296,19 +264,15 @@
</span><span class="cx">             assert.ok(!buildRequests[3].hasFinished());
</span><span class="cx">             assert.ok(!buildRequests[3].hasStarted());
</span><span class="cx">             assert.ok(buildRequests[3].isPending());
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should include all build requests of a test group if one of the reqeusts in the group is still running', function (done) {
-        let db = TestServer.database();
-        db.connect().then(function () {
-            return MockData.addMockData(db, ['completed', 'completed', 'completed', 'running']);
-        }).then(function () {
</del><ins>+    it('should include all build requests of a test group if one of the reqeusts in the group is still running', () =&gt; {
+        return MockData.addMockData(TestServer.database(), ['completed', 'completed', 'completed', 'running']).then(() =&gt; {
</ins><span class="cx">             return Manifest.fetch();
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return BuildRequest.fetchForTriggerable('build-webkit');
</span><del>-        }).then(function (buildRequests) {
</del><ins>+        }).then((buildRequests) =&gt; {
</ins><span class="cx">             assert.equal(buildRequests.length, 4);
</span><span class="cx">             assert.ok(buildRequests[0].hasFinished());
</span><span class="cx">             assert.ok(buildRequests[0].hasStarted());
</span><span class="lines">@@ -322,19 +286,16 @@
</span><span class="cx">             assert.ok(!buildRequests[3].hasFinished());
</span><span class="cx">             assert.ok(buildRequests[3].hasStarted());
</span><span class="cx">             assert.ok(!buildRequests[3].isPending());
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should order build requests based on test group creation time and order', function (done) {
</del><ins>+    it('should order build requests based on test group creation time and order', () =&gt; {
</ins><span class="cx">         let db = TestServer.database();
</span><del>-        db.connect().then(function () {
-            return Promise.all([MockData.addMockData(db), MockData.addAnotherMockTestGroup(db)]);
-        }).then(function () {
</del><ins>+        return Promise.all([MockData.addMockData(db), MockData.addAnotherMockTestGroup(db)]).then(() =&gt; {
</ins><span class="cx">             return Manifest.fetch();
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return BuildRequest.fetchForTriggerable('build-webkit');
</span><del>-        }).then(function (buildRequests) {
</del><ins>+        }).then((buildRequests) =&gt; {
</ins><span class="cx">             assert.equal(buildRequests.length, 8);
</span><span class="cx">             assert.equal(buildRequests[0].id(), 700);
</span><span class="cx">             assert.equal(buildRequests[0].testGroupId(), 600);
</span><span class="lines">@@ -361,19 +322,16 @@
</span><span class="cx">             assert.equal(buildRequests[7].id(), 713);
</span><span class="cx">             assert.equal(buildRequests[7].testGroupId(), 601);
</span><span class="cx">             assert.strictEqual(buildRequests[7].order(), 3);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should place build requests created by user before automatically created ones', function (done) {
</del><ins>+    it('should place build requests created by user before automatically created ones', () =&gt; {
</ins><span class="cx">         let db = TestServer.database();
</span><del>-        db.connect().then(function () {
-            return Promise.all([MockData.addMockData(db), MockData.addAnotherMockTestGroup(db, null, 'rniwa')]);
-        }).then(function () {
</del><ins>+        return Promise.all([MockData.addMockData(db), MockData.addAnotherMockTestGroup(db, null, 'rniwa')]).then(() =&gt; {
</ins><span class="cx">             return Manifest.fetch();
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return BuildRequest.fetchForTriggerable('build-webkit');
</span><del>-        }).then(function (buildRequests) {
</del><ins>+        }).then((buildRequests) =&gt; {
</ins><span class="cx">             assert.equal(buildRequests.length, 8);
</span><span class="cx">             assert.equal(buildRequests[0].id(), 710);
</span><span class="cx">             assert.equal(buildRequests[0].testGroupId(), 601);
</span><span class="lines">@@ -400,7 +358,6 @@
</span><span class="cx">             assert.equal(buildRequests[7].id(), 703);
</span><span class="cx">             assert.equal(buildRequests[7].testGroupId(), 600);
</span><span class="cx">             assert.strictEqual(buildRequests[7].order(), 3);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsapicommitsjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/api-commits.js (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/api-commits.js        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/server-tests/api-commits.js        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -4,11 +4,10 @@
</span><span class="cx"> 
</span><span class="cx"> const TestServer = require('./resources/test-server.js');
</span><span class="cx"> const addSlaveForReport = require('./resources/common-operations.js').addSlaveForReport;
</span><del>-const connectToDatabaseInEveryTest = require('./resources/common-operations.js').connectToDatabaseInEveryTest;
</del><ins>+const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
</ins><span class="cx"> 
</span><del>-describe(&quot;/api/commits/&quot;, () =&gt; {
-    TestServer.inject();
-    connectToDatabaseInEveryTest();
</del><ins>+describe(&quot;/api/commits/&quot;, function () {
+    prepareServerTest(this);
</ins><span class="cx"> 
</span><span class="cx">     const subversionCommits = {
</span><span class="cx">         &quot;slaveName&quot;: &quot;someSlave&quot;,
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsapimanifestjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/api-manifest.js (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/api-manifest.js        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/server-tests/api-manifest.js        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -6,19 +6,15 @@
</span><span class="cx"> 
</span><span class="cx"> const MockData = require('./resources/mock-data.js');
</span><span class="cx"> const TestServer = require('./resources/test-server.js');
</span><ins>+const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
</ins><span class="cx"> 
</span><span class="cx"> describe('/api/manifest', function () {
</span><del>-    this.timeout(1000);
-    TestServer.inject();
</del><ins>+    prepareServerTest(this);
</ins><span class="cx"> 
</span><del>-    beforeEach(function () {
-        MockData.resetV3Models();
-    });
-
-    it(&quot;should generate an empty manifest when database is empty&quot;, function (done) {
-        TestServer.remoteAPI().getJSON('/api/manifest').then(function (manifest) {
</del><ins>+    it(&quot;should generate an empty manifest when database is empty&quot;, () =&gt; {
+        return TestServer.remoteAPI().getJSON('/api/manifest').then((manifest) =&gt; {
</ins><span class="cx">             assert.deepEqual(Object.keys(manifest).sort(), ['all', 'bugTrackers', 'builders', 'dashboard', 'dashboards',
</span><del>-                'elapsedTime', 'metrics', 'repositories', 'siteTitle', 'status', 'summaryPages', 'tests', 'triggerables']);
</del><ins>+                'elapsedTime', 'fileUploadSizeLimit', 'metrics', 'repositories', 'siteTitle', 'status', 'summaryPages', 'tests', 'triggerables']);
</ins><span class="cx"> 
</span><span class="cx">             assert.equal(typeof(manifest.elapsedTime), 'number');
</span><span class="cx">             delete manifest.elapsedTime;
</span><span class="lines">@@ -35,20 +31,19 @@
</span><span class="cx">                 tests: {},
</span><span class="cx">                 triggerables: {},
</span><span class="cx">                 summaryPages: [],
</span><ins>+                fileUploadSizeLimit: 0,
</ins><span class="cx">                 status: 'OK'
</span><span class="cx">             });
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     const bugzillaData = {id: 1, name: 'Bugzilla', bug_url: 'https://webkit.org/b/$number', new_bug_url: 'https://bugs.webkit.org/'};
</span><span class="cx">     const radarData = {id: 2, name: 'Radar'};
</span><span class="cx"> 
</span><del>-    it(&quot;should generate manifest with bug trackers without repositories&quot;, function (done) {
-        TestServer.database().connect();
-        TestServer.database().insert('bug_trackers', bugzillaData).then(function () {
</del><ins>+    it(&quot;should generate manifest with bug trackers without repositories&quot;, () =&gt; {
+        return TestServer.database().insert('bug_trackers', bugzillaData).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSON('/api/manifest');
</span><del>-        }).then(function (content) {
</del><ins>+        }).then((content) =&gt; {
</ins><span class="cx">             assert.deepEqual(content.bugTrackers, {1: {name: 'Bugzilla', bugUrl: 'https://webkit.org/b/$number',
</span><span class="cx">                 newBugUrl: 'https://bugs.webkit.org/', repositories: null}});
</span><span class="cx"> 
</span><span class="lines">@@ -58,15 +53,12 @@
</span><span class="cx">             assert.equal(tracker.name(), 'Bugzilla');
</span><span class="cx">             assert.equal(tracker.bugUrl(123), 'https://webkit.org/b/123');
</span><span class="cx">             assert.equal(tracker.newBugUrl(), 'https://bugs.webkit.org/');
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should generate manifest with bug trackers and repositories&quot;, function (done) {
</del><ins>+    it(&quot;should generate manifest with bug trackers and repositories&quot;, () =&gt; {
</ins><span class="cx">         let db = TestServer.database();
</span><del>-        db.connect();
-        Promise.all([
</del><ins>+        return Promise.all([
</ins><span class="cx">             db.insert('bug_trackers', bugzillaData),
</span><span class="cx">             db.insert('bug_trackers', radarData),
</span><span class="cx">             db.insert('repositories', {id: 11, name: 'WebKit', url: 'https://trac.webkit.org/$1'}),
</span><span class="lines">@@ -75,9 +67,9 @@
</span><span class="cx">             db.insert('tracker_repositories', {tracker: bugzillaData.id, repository: 11}),
</span><span class="cx">             db.insert('tracker_repositories', {tracker: radarData.id, repository: 9}),
</span><span class="cx">             db.insert('tracker_repositories', {tracker: radarData.id, repository: 22}),
</span><del>-        ]).then(function () {
</del><ins>+        ]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSON('/api/manifest');
</span><del>-        }).then(function (content) {
</del><ins>+        }).then((content) =&gt; {
</ins><span class="cx">             let manifest = Manifest._didFetchManifest(content);
</span><span class="cx"> 
</span><span class="cx">             let webkit = Repository.findById(11);
</span><span class="lines">@@ -104,21 +96,18 @@
</span><span class="cx">             assert(tracker);
</span><span class="cx">             assert.equal(tracker.name(), 'Radar');
</span><span class="cx">             assert.deepEqual(Repository.sortByName(tracker.repositories()), [osx, ios]);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should generate manifest with builders&quot;, function (done) {
</del><ins>+    it(&quot;should generate manifest with builders&quot;, () =&gt; {
</ins><span class="cx">         let db = TestServer.database();
</span><del>-        db.connect();
-        Promise.all([
</del><ins>+        return Promise.all([
</ins><span class="cx">             db.insert('builders', {id: 1, name: 'SomeBuilder', password_hash: 'a',
</span><span class="cx">                 build_url: 'https://build.webkit.org/builders/$builderName/build/$buildNumber'}),
</span><span class="cx">             db.insert('builders', {id: 2, name: 'SomeOtherBuilder', password_hash: 'b'})
</span><del>-        ]).then(function () {
</del><ins>+        ]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSON('/api/manifest');
</span><del>-        }).then(function (content) {
</del><ins>+        }).then((content) =&gt; {
</ins><span class="cx">             assert.deepEqual(content.builders, {
</span><span class="cx">                 '1': {name: 'SomeBuilder', buildUrl: 'https://build.webkit.org/builders/$builderName/build/$buildNumber'},
</span><span class="cx">                 '2': {name: 'SomeOtherBuilder', buildUrl: null}
</span><span class="lines">@@ -135,15 +124,12 @@
</span><span class="cx">             assert(builder);
</span><span class="cx">             assert.equal(builder.name(), 'SomeOtherBuilder');
</span><span class="cx">             assert.equal(builder.urlForBuild(123), null);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should generate manifest with tests, metrics, and platforms&quot;, function (done) {
</del><ins>+    it(&quot;should generate manifest with tests, metrics, and platforms&quot;, () =&gt; {
</ins><span class="cx">         let db = TestServer.database();
</span><del>-        db.connect();
-        Promise.all([
</del><ins>+        return Promise.all([
</ins><span class="cx">             db.insert('tests', {id: 1, name: 'SomeTest'}),
</span><span class="cx">             db.insert('tests', {id: 2, name: 'SomeOtherTest'}),
</span><span class="cx">             db.insert('tests', {id: 3, name: 'ChildTest', parent: 1}),
</span><span class="lines">@@ -163,9 +149,9 @@
</span><span class="cx">             db.insert('test_configurations', {id: 105, metric: 9, platform: 46, type: 'current'}),
</span><span class="cx">             db.insert('test_configurations', {id: 106, metric: 5, platform: 23, type: 'current'}),
</span><span class="cx">             db.insert('test_configurations', {id: 107, metric: 5, platform: 23, type: 'baseline'}),
</span><del>-        ]).then(function () {
</del><ins>+        ]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSON('/api/manifest');
</span><del>-        }).then(function (content) {
</del><ins>+        }).then((content) =&gt; {
</ins><span class="cx">             assert.deepEqual(content.tests, {
</span><span class="cx">                 &quot;1&quot;: {&quot;name&quot;: &quot;SomeTest&quot;, &quot;parentId&quot;: null, &quot;url&quot;: null},
</span><span class="cx">                 &quot;2&quot;: {&quot;name&quot;: &quot;SomeOtherTest&quot;, &quot;parentId&quot;: null, &quot;url&quot;: null},
</span><span class="lines">@@ -271,15 +257,12 @@
</span><span class="cx">             assert.equal(grandChildTest.metrics().length, 1);
</span><span class="cx">             assert.equal(grandChildTest.metrics()[0].label(), 'Time');
</span><span class="cx">             assert.equal(grandChildTest.metrics()[0].fullName(), 'SomeTest \u220B ChildTest \u220B GrandChild : Time');
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should generate manifest with triggerables&quot;, function (done) {
</del><ins>+    it(&quot;should generate manifest with triggerables&quot;, () =&gt; {
</ins><span class="cx">         let db = TestServer.database();
</span><del>-        db.connect();
-        Promise.all([
</del><ins>+        return Promise.all([
</ins><span class="cx">             db.insert('repositories', {id: 11, name: 'WebKit', url: 'https://trac.webkit.org/$1'}),
</span><span class="cx">             db.insert('repositories', {id: 9, name: 'OS X'}),
</span><span class="cx">             db.insert('repositories', {id: 101, name: 'WebKit', owner: 9, url: 'https://trac.webkit.org/$1'}),
</span><span class="lines">@@ -305,9 +288,9 @@
</span><span class="cx">             db.insert('triggerable_configurations', {triggerable: 200, test: 2, platform: 46}),
</span><span class="cx">             db.insert('triggerable_configurations', {triggerable: 201, test: 1, platform: 23}),
</span><span class="cx">             db.insert('triggerable_configurations', {triggerable: 201, test: 2, platform: 23}),
</span><del>-        ]).then(function () {
</del><ins>+        ]).then(() =&gt; {
</ins><span class="cx">             return Manifest.fetch();
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             let webkit = Repository.findById(11);
</span><span class="cx">             assert.equal(webkit.name(), 'WebKit');
</span><span class="cx">             assert.equal(webkit.urlForRevision(123), 'https://trac.webkit.org/123');
</span><span class="lines">@@ -351,9 +334,7 @@
</span><span class="cx"> 
</span><span class="cx">             assert.equal(Triggerable.findByTestConfiguration(someOtherTest, ios9iphone5s), iosTriggerable);
</span><span class="cx">             assert.equal(Triggerable.findByTestConfiguration(childTest, ios9iphone5s), iosTriggerable);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsapimeasurementsettestsjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/api-measurement-set-tests.js (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/api-measurement-set-tests.js        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/server-tests/api-measurement-set-tests.js        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -7,17 +7,11 @@
</span><span class="cx"> const MockData = require('./resources/mock-data.js');
</span><span class="cx"> const TestServer = require('./resources/test-server.js');
</span><span class="cx"> const addBuilderForReport = require('./resources/common-operations.js').addBuilderForReport;
</span><del>-const connectToDatabaseInEveryTest = require('./resources/common-operations.js').connectToDatabaseInEveryTest;
</del><ins>+const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
</ins><span class="cx"> 
</span><span class="cx"> describe(&quot;/api/measurement-set&quot;, function () {
</span><del>-    this.timeout(1000);
-    TestServer.inject();
-    connectToDatabaseInEveryTest();
</del><ins>+    prepareServerTest(this);
</ins><span class="cx"> 
</span><del>-    beforeEach(function () {
-        MockData.resetV3Models();
-    });
-
</del><span class="cx">     function queryPlatformAndMetric(platformName, metricName)
</span><span class="cx">     {
</span><span class="cx">         const db = TestServer.database();
</span><span class="lines">@@ -135,65 +129,61 @@
</span><span class="cx">             },
</span><span class="cx">         }}];
</span><span class="cx"> 
</span><del>-    it(&quot;should reject when platform ID is missing&quot;, function (done) {
-        addBuilderForReport(reportWithBuildTime[0]).then(function () {
</del><ins>+    it(&quot;should reject when platform ID is missing&quot;, () =&gt; {
+        return addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', reportWithBuildTime);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return queryPlatformAndMetric('Mountain Lion', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSON(`/api/measurement-set/?metric=${result.metricId}`);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'AmbiguousRequest');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should reject when metric ID is missing&quot;, function (done) {
-        addBuilderForReport(reportWithBuildTime[0]).then(function () {
</del><ins>+    it(&quot;should reject when metric ID is missing&quot;, () =&gt; {
+        return addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', reportWithBuildTime);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return queryPlatformAndMetric('Mountain Lion', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSON(`/api/measurement-set/?platform=${result.platformId}`);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'AmbiguousRequest');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should reject an invalid platform name&quot;, function (done) {
-        addBuilderForReport(reportWithBuildTime[0]).then(function () {
</del><ins>+    it(&quot;should reject an invalid platform name&quot;, () =&gt; {
+        return addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', reportWithBuildTime);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return queryPlatformAndMetric('Mountain Lion', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSON(`/api/measurement-set/?platform=${result.platformId}a&amp;metric=${result.metricId}`);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'InvalidPlatform');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should reject an invalid metric name&quot;, function (done) {
-        addBuilderForReport(reportWithBuildTime[0]).then(function () {
</del><ins>+    it(&quot;should reject an invalid metric name&quot;, () =&gt; {
+        return addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', reportWithBuildTime);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return queryPlatformAndMetric('Mountain Lion', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSON(`/api/measurement-set/?platform=${result.platformId}&amp;metric=${result.metricId}b`);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'InvalidMetric');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should be able to return an empty report&quot;, function (done) {
</del><ins>+    it(&quot;should return 404 when the report is empty&quot;, () =&gt; {
</ins><span class="cx">         const db = TestServer.database();
</span><del>-        Promise.all([
</del><ins>+        return Promise.all([
</ins><span class="cx">             db.insert('tests', {id: 1, name: 'SomeTest'}),
</span><span class="cx">             db.insert('tests', {id: 2, name: 'SomeOtherTest'}),
</span><span class="cx">             db.insert('tests', {id: 3, name: 'ChildTest', parent: 1}),
</span><span class="lines">@@ -213,25 +203,24 @@
</span><span class="cx">             db.insert('test_configurations', {id: 105, metric: 9, platform: 46, type: 'current'}),
</span><span class="cx">             db.insert('test_configurations', {id: 106, metric: 5, platform: 23, type: 'current'}),
</span><span class="cx">             db.insert('test_configurations', {id: 107, metric: 5, platform: 23, type: 'baseline'}),
</span><del>-        ]).then(function () {
-            return TestServer.remoteAPI().getJSONWithStatus(`/api/measurement-set/?platform=46&amp;metric=5`).then(function (response) {
-                assert.equal(response.statusCode, 404);
-            }, function (error) {
</del><ins>+        ]).then(() =&gt; {
+            return TestServer.remoteAPI().getJSONWithStatus(`/api/measurement-set/?platform=46&amp;metric=5`).then((response) =&gt; {
+                assert(false);
+            }, (error) =&gt; {
</ins><span class="cx">                 assert.equal(error, 404);
</span><del>-                done();
</del><span class="cx">             });
</span><del>-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should be able to retrieve a reported value&quot;, function (done) {
-        addBuilderForReport(reportWithBuildTime[0]).then(function () {
</del><ins>+    it(&quot;should be able to retrieve a reported value&quot;, () =&gt; {
+        return addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', reportWithBuildTime);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return queryPlatformAndMetric('Mountain Lion', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().getJSONWithStatus(`/api/measurement-set/?platform=${result.platformId}&amp;metric=${result.metricId}`);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             const buildTime = +(new Date(reportWithBuildTime[0]['buildTime']));
</span><span class="cx"> 
</span><span class="cx">             assert.deepEqual(Object.keys(response).sort(),
</span><span class="lines">@@ -248,7 +237,7 @@
</span><span class="cx"> 
</span><span class="cx">             assert.deepEqual(Object.keys(response['configurations']), ['current']);
</span><span class="cx"> 
</span><del>-            var currentRows = response['configurations']['current'];
</del><ins>+            const currentRows = response['configurations']['current'];
</ins><span class="cx">             assert.equal(currentRows.length, 1);
</span><span class="cx">             assert.equal(currentRows[0].length, response['formatMap'].length);
</span><span class="cx">             assert.deepEqual(format(response['formatMap'], currentRows[0]), {
</span><span class="lines">@@ -261,17 +250,16 @@
</span><span class="cx">                 commitTime: buildTime,
</span><span class="cx">                 buildTime: buildTime,
</span><span class="cx">                 buildNumber: '123'});
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should return return the right IDs for measurement, build, and builder&quot;, function (done) {
-        addBuilderForReport(reportWithBuildTime[0]).then(function () {
</del><ins>+    it(&quot;should return return the right IDs for measurement, build, and builder&quot;, () =&gt; {
+        return addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', reportWithBuildTime);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return queryPlatformAndMetric('Mountain Lion', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const db = TestServer.database();
</span><span class="cx">             return Promise.all([
</span><span class="cx">                 db.selectAll('test_runs'),
</span><span class="lines">@@ -279,7 +267,7 @@
</span><span class="cx">                 db.selectAll('builders'),
</span><span class="cx">                 TestServer.remoteAPI().getJSONWithStatus(`/api/measurement-set/?platform=${result.platformId}&amp;metric=${result.metricId}`),
</span><span class="cx">             ]);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const runs = result[0];
</span><span class="cx">             const builds = result[1];
</span><span class="cx">             const builders = result[2];
</span><span class="lines">@@ -299,24 +287,9 @@
</span><span class="cx">             assert.equal(measurement[response['formatMap'].indexOf('id')], measurementId);
</span><span class="cx">             assert.equal(measurement[response['formatMap'].indexOf('build')], buildId);
</span><span class="cx">             assert.equal(measurement[response['formatMap'].indexOf('builder')], builderId);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    function postReports(reports, callback)
-    {
-        if (!reports.length)
-            return callback();
-
-        postJSON('/api/report/', reports[0], function (response) {
-            assert.equal(response.statusCode, 200);
-            assert.equal(JSON.parse(response.responseText)['status'], 'OK');
-
-            postReports(reports.slice(1), callback);
-        });
-    }
-
</del><span class="cx">     function queryPlatformAndMetricWithRepository(platformName, metricName, repositoryName)
</span><span class="cx">     {
</span><span class="cx">         const db = TestServer.database();
</span><span class="lines">@@ -324,24 +297,22 @@
</span><span class="cx">             db.selectFirstRow('platforms', {name: platformName}),
</span><span class="cx">             db.selectFirstRow('test_metrics', {name: metricName}),
</span><span class="cx">             db.selectFirstRow('repositories', {name: repositoryName}),
</span><del>-        ]).then(function (result) {
-            return {platformId: result[0]['id'], metricId: result[1]['id'], repositoryId: result[2]['id']};
-        });
</del><ins>+        ]).then((result) =&gt; ({platformId: result[0]['id'], metricId: result[1]['id'], repositoryId: result[2]['id']}));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    it(&quot;should order results by commit time&quot;, function (done) {
</del><ins>+    it(&quot;should order results by commit time&quot;, () =&gt; {
</ins><span class="cx">         const remote = TestServer.remoteAPI();
</span><span class="cx">         let repositoryId;
</span><del>-        addBuilderForReport(reportWithBuildTime[0]).then(function () {
</del><ins>+        return addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</ins><span class="cx">             return remote.postJSON('/api/report/', reportWithBuildTime);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return remote.postJSON('/api/report/', reportWithRevision);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return queryPlatformAndMetricWithRepository('Mountain Lion', 'Time', 'WebKit');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             repositoryId = result.repositoryId;
</span><span class="cx">             return remote.getJSONWithStatus(`/api/measurement-set/?platform=${result.platformId}&amp;metric=${result.metricId}`);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             const currentRows = response['configurations']['current'];
</span><span class="cx">             const buildTime = +(new Date(reportWithBuildTime[0]['buildTime']));
</span><span class="cx">             const revisionTime = +(new Date(reportWithRevision[0]['revisions']['WebKit']['timestamp']));
</span><span class="lines">@@ -368,14 +339,13 @@
</span><span class="cx">                 commitTime: buildTime,
</span><span class="cx">                 buildTime: buildTime,
</span><span class="cx">                 buildNumber: '123' });
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should order results by build time when commit times are missing&quot;, function (done) {
</del><ins>+    it(&quot;should order results by build time when commit times are missing&quot;, () =&gt; {
</ins><span class="cx">         const remote = TestServer.remoteAPI();
</span><span class="cx">         let repositoryId;
</span><del>-        addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</del><ins>+        return addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</ins><span class="cx">             const db = TestServer.database();
</span><span class="cx">             return Promise.all([
</span><span class="cx">                 db.insert('repositories', {'id': 1, 'name': 'macOS'}),
</span><span class="lines">@@ -396,7 +366,7 @@
</span><span class="cx">                 &quot;platform&quot;: &quot;Sierra&quot;,
</span><span class="cx">                 &quot;tests&quot;: { &quot;Test&quot;: {&quot;metrics&quot;: {&quot;Time&quot;: { &quot;baseline&quot;: [1, 2, 3, 4, 5] } } } },
</span><span class="cx">             }]);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return remote.postJSON('/api/report/', [{
</span><span class="cx">                 &quot;buildNumber&quot;: &quot;1002&quot;,
</span><span class="cx">                 &quot;buildTime&quot;: '2017-01-19 19:46:37',
</span><span class="lines">@@ -410,11 +380,11 @@
</span><span class="cx">                 &quot;platform&quot;: &quot;Sierra&quot;,
</span><span class="cx">                 &quot;tests&quot;: { &quot;Test&quot;: {&quot;metrics&quot;: {&quot;Time&quot;: { &quot;baseline&quot;: [5, 6, 7, 8, 9] } } } },
</span><span class="cx">             }]);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return queryPlatformAndMetricWithRepository('Sierra', 'Time', 'macOS');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             return remote.getJSONWithStatus(`/api/measurement-set/?platform=${result.platformId}&amp;metric=${result.metricId}`);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             const currentRows = response['configurations']['baseline'];
</span><span class="cx">             assert.equal(currentRows.length, 2);
</span><span class="cx">             assert.deepEqual(format(response['formatMap'], currentRows[0]), {
</span><span class="lines">@@ -437,95 +407,89 @@
</span><span class="cx">                 commitTime: +Date.UTC(2017, 0, 19, 19, 46, 37),
</span><span class="cx">                 buildTime: +Date.UTC(2017, 0, 19, 19, 46, 37),
</span><span class="cx">                 buildNumber: '1002' });
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     function buildNumbers(parsedResult, config)
</span><span class="cx">     {
</span><del>-        return parsedResult['configurations'][config].map(function (row) {
-            return format(parsedResult['formatMap'], row)['buildNumber'];
-        });
</del><ins>+        return parsedResult['configurations'][config].map((row) =&gt; format(parsedResult['formatMap'], row)['buildNumber']);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    it(&quot;should include one data point after the current time range&quot;, function (done) {
</del><ins>+    it(&quot;should include one data point after the current time range&quot;, () =&gt; {
</ins><span class="cx">         const remote = TestServer.remoteAPI();
</span><del>-        addBuilderForReport(reportWithBuildTime[0]).then(function () {
</del><ins>+        return addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</ins><span class="cx">             return remote.postJSON('/api/report/', reportWithAncentRevision);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return remote.postJSON('/api/report/', reportWithNewRevision);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return queryPlatformAndMetric('Mountain Lion', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             return remote.getJSONWithStatus(`/api/measurement-set/?platform=${result.platformId}&amp;metric=${result.metricId}`);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             assert.equal(response['clusterCount'], 2, 'should have two clusters');
</span><span class="cx">             assert.deepEqual(buildNumbers(response, 'current'),
</span><span class="cx">                 [reportWithAncentRevision[0]['buildNumber'], reportWithNewRevision[0]['buildNumber']]);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should always include one old data point before the current time range&quot;, function (done) {
</del><ins>+    it(&quot;should always include one old data point before the current time range&quot;, () =&gt; {
</ins><span class="cx">         const remote = TestServer.remoteAPI();
</span><del>-        addBuilderForReport(reportWithBuildTime[0]).then(function () {
</del><ins>+        return addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</ins><span class="cx">             return remote.postJSON('/api/report/', reportWithBuildTime);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return remote.postJSON('/api/report/', reportWithAncentRevision);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return queryPlatformAndMetric('Mountain Lion', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             return remote.getJSONWithStatus(`/api/measurement-set/?platform=${result.platformId}&amp;metric=${result.metricId}`);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['clusterCount'], 2, 'should have two clusters');
</span><span class="cx">             let currentRows = response['configurations']['current'];
</span><span class="cx">             assert.equal(currentRows.length, 2, 'should contain two data points');
</span><span class="cx">             assert.deepEqual(buildNumbers(response, 'current'), [reportWithAncentRevision[0]['buildNumber'], reportWithBuildTime[0]['buildNumber']]);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should create cached results&quot;, function (done) {
</del><ins>+    it(&quot;should create cached results&quot;, () =&gt; {
</ins><span class="cx">         const remote = TestServer.remoteAPI();
</span><span class="cx">         let cachePrefix;
</span><del>-        addBuilderForReport(reportWithBuildTime[0]).then(function () {
</del><ins>+        return addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</ins><span class="cx">             return remote.postJSON('/api/report/', reportWithAncentRevision);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return remote.postJSON('/api/report/', reportWithRevision);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return remote.postJSON('/api/report/', reportWithNewRevision);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return queryPlatformAndMetric('Mountain Lion', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             cachePrefix = '/data/measurement-set-' + result.platformId + '-' + result.metricId;
</span><span class="cx">             return remote.getJSONWithStatus(`/api/measurement-set/?platform=${result.platformId}&amp;metric=${result.metricId}`);
</span><del>-        }).then(function (newResult) {
-            return remote.getJSONWithStatus(`${cachePrefix}.json`).then(function (cachedResult) {
</del><ins>+        }).then((newResult) =&gt; {
+            return remote.getJSONWithStatus(`${cachePrefix}.json`).then((cachedResult) =&gt; {
</ins><span class="cx">                 assert.deepEqual(newResult, cachedResult);
</span><span class="cx">                 return remote.getJSONWithStatus(`${cachePrefix}-${cachedResult['startTime']}.json`);
</span><del>-            }).then(function (oldResult) {
-                var oldBuildNumbers = buildNumbers(oldResult, 'current');
-                var newBuildNumbers = buildNumbers(newResult, 'current');
</del><ins>+            }).then((oldResult) =&gt; {
+                const oldBuildNumbers = buildNumbers(oldResult, 'current');
+                const newBuildNumbers = buildNumbers(newResult, 'current');
</ins><span class="cx">                 assert(oldBuildNumbers.length &gt;= 2, 'The old cluster should contain at least two data points');
</span><span class="cx">                 assert(newBuildNumbers.length &gt;= 2, 'The new cluster should contain at least two data points');
</span><span class="cx">                 assert.deepEqual(oldBuildNumbers.slice(oldBuildNumbers.length - 2), newBuildNumbers.slice(0, 2),
</span><span class="cx">                     'Two conseqcutive clusters should share two data points');
</span><del>-                done();
</del><span class="cx">             });
</span><del>-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should use lastModified timestamp identical to that in the manifest file&quot;, function (done) {
</del><ins>+    it(&quot;should use lastModified timestamp identical to that in the manifest file&quot;, () =&gt; {
</ins><span class="cx">         const remote = TestServer.remoteAPI();
</span><del>-        addBuilderForReport(reportWithBuildTime[0]).then(function () {
</del><ins>+        return addBuilderForReport(reportWithBuildTime[0]).then(() =&gt; {
</ins><span class="cx">             return remote.postJSON('/api/report/', reportWithRevision);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return queryPlatformAndMetric('Mountain Lion', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             return remote.getJSONWithStatus(`/api/measurement-set/?platform=${result.platformId}&amp;metric=${result.metricId}`);
</span><del>-        }).then(function (primaryCluster) {
-            return remote.getJSONWithStatus('/api/manifest').then(function (content) {
</del><ins>+        }).then((primaryCluster) =&gt; {
+            return remote.getJSONWithStatus('/api/manifest').then((content) =&gt; {
</ins><span class="cx">                 const manifest = Manifest._didFetchManifest(content);
</span><span class="cx"> 
</span><span class="cx">                 const platform = Platform.findByName('Mountain Lion');
</span><span class="lines">@@ -532,10 +496,8 @@
</span><span class="cx">                 assert.equal(Metric.all().length, 1);
</span><span class="cx">                 const metric = Metric.all()[0];
</span><span class="cx">                 assert.equal(platform.lastModified(metric), primaryCluster['lastModified']);
</span><del>-
-                done();
</del><span class="cx">             });
</span><del>-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsapireportcommitstestsjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/api-report-commits-tests.js (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/api-report-commits-tests.js        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/server-tests/api-report-commits-tests.js        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -4,12 +4,10 @@
</span><span class="cx"> 
</span><span class="cx"> const TestServer = require('./resources/test-server.js');
</span><span class="cx"> const addSlaveForReport = require('./resources/common-operations.js').addSlaveForReport;
</span><del>-const connectToDatabaseInEveryTest = require('./resources/common-operations.js').connectToDatabaseInEveryTest;
</del><ins>+const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
</ins><span class="cx"> 
</span><span class="cx"> describe(&quot;/api/report-commits/&quot;, function () {
</span><del>-    this.timeout(1000);
-    TestServer.inject();
-    connectToDatabaseInEveryTest();
</del><ins>+    prepareServerTest(this);
</ins><span class="cx"> 
</span><span class="cx">     const emptyReport = {
</span><span class="cx">         &quot;slaveName&quot;: &quot;someSlave&quot;,
</span><span class="lines">@@ -78,54 +76,49 @@
</span><span class="cx">         ]
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    it(&quot;should reject error when slave name is missing&quot;, function (done) {
-        TestServer.remoteAPI().postJSON('/api/report-commits/', {}).then(function (response) {
</del><ins>+    it(&quot;should reject error when slave name is missing&quot;, () =&gt; {
+        return TestServer.remoteAPI().postJSON('/api/report-commits/', {}).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'MissingSlaveName');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should reject when there are no slaves&quot;, function (done) {
-        TestServer.remoteAPI().postJSON('/api/report-commits/', emptyReport).then(function (response) {
</del><ins>+    it(&quot;should reject when there are no slaves&quot;, () =&gt; {
+        return TestServer.remoteAPI().postJSON('/api/report-commits/', emptyReport).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'SlaveNotFound');
</span><span class="cx">             return TestServer.database().selectAll('commits');
</span><del>-        }).then(function (rows) {
</del><ins>+        }).then((rows) =&gt; {
</ins><span class="cx">             assert.equal(rows.length, 0);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should accept an empty report&quot;, function (done) {
-        addSlaveForReport(emptyReport).then(function () {
</del><ins>+    it(&quot;should accept an empty report&quot;, () =&gt; {
+        return addSlaveForReport(emptyReport).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', emptyReport);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should add a missing repository&quot;, function (done) {
-        const db = TestServer.database();
-        addSlaveForReport(subversionCommit).then(function () {
</del><ins>+    it(&quot;should add a missing repository&quot;, () =&gt; {
+        return addSlaveForReport(subversionCommit).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', subversionCommit);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><del>-            return db.selectAll('repositories');
-        }).then(function (rows) {
</del><ins>+            return TestServer.database().selectAll('repositories');
+        }).then((rows) =&gt; {
</ins><span class="cx">             assert.equal(rows.length, 1);
</span><span class="cx">             assert.equal(rows[0]['name'], subversionCommit.commits[0]['repository']);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should store a commit from a valid slave&quot;, function (done) {
-        const db = TestServer.database();
-        addSlaveForReport(subversionCommit).then(function () {
</del><ins>+    it(&quot;should store a commit from a valid slave&quot;, () =&gt; {
+        return addSlaveForReport(subversionCommit).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', subversionCommit);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><ins>+            const db = TestServer.database();
</ins><span class="cx">             return Promise.all([db.selectAll('commits'), db.selectAll('committers')]);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             let commits = result[0];
</span><span class="cx">             let committers = result[1];
</span><span class="cx">             let reportedData = subversionCommit.commits[0];
</span><span class="lines">@@ -138,31 +131,28 @@
</span><span class="cx">             assert.equal(commits[0]['committer'], committers[0]['id']);
</span><span class="cx">             assert.equal(committers[0]['name'], reportedData['author']['name']);
</span><span class="cx">             assert.equal(committers[0]['account'], reportedData['author']['account']);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should reject an invalid revision number&quot;, function (done) {
-        addSlaveForReport(subversionCommit).then(function () {
</del><ins>+    it(&quot;should reject an invalid revision number&quot;, () =&gt; {
+        return addSlaveForReport(subversionCommit).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', subversionInvalidCommit);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'InvalidRevision');
</span><span class="cx">             return TestServer.database().selectAll('commits');
</span><del>-        }).then(function (rows) {
</del><ins>+        }).then((rows) =&gt; {
</ins><span class="cx">             assert.equal(rows.length, 0);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should store two commits from a valid slave&quot;, function (done) {
-        const db = TestServer.database();
-        addSlaveForReport(subversionTwoCommits).then(function () {
</del><ins>+    it(&quot;should store two commits from a valid slave&quot;, () =&gt; {
+        return addSlaveForReport(subversionTwoCommits).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', subversionTwoCommits);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><ins>+            const db = TestServer.database();
</ins><span class="cx">             return Promise.all([db.selectAll('commits'), db.selectAll('committers')]);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const commits = result[0];
</span><span class="cx">             const committers = result[1];
</span><span class="cx">             assert.equal(commits.length, 2);
</span><span class="lines">@@ -185,38 +175,34 @@
</span><span class="cx">             assert.equal(commits[1]['previous_commit'], commits[0]['id']);
</span><span class="cx">             assert.equal(committers[1]['name'], reportedData['author']['name']);
</span><span class="cx">             assert.equal(committers[1]['account'], reportedData['author']['account']);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should fail if previous commit is invalid&quot;, function (done) {
-        const db = TestServer.database();
-        addSlaveForReport(subversionInvalidPreviousCommit).then(function () {
</del><ins>+    it(&quot;should fail if previous commit is invalid&quot;, () =&gt; {
+        return addSlaveForReport(subversionInvalidPreviousCommit).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', subversionInvalidPreviousCommit);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'FailedToFindPreviousCommit');
</span><del>-            return db.selectAll('commits');
-        }).then(function (result) {
</del><ins>+            return TestServer.database().selectAll('commits');
+        }).then((result) =&gt; {
</ins><span class="cx">             assert.equal(result.length, 0);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should update an existing commit if there is one&quot;, function (done) {
</del><ins>+    it(&quot;should update an existing commit if there is one&quot;, () =&gt; {
</ins><span class="cx">         const db = TestServer.database();
</span><span class="cx">         const reportedData = subversionCommit.commits[0];
</span><del>-        addSlaveForReport(subversionCommit).then(function () {
</del><ins>+        return addSlaveForReport(subversionCommit).then(() =&gt; {
</ins><span class="cx">             return Promise.all([
</span><span class="cx">                 db.insert('repositories', {'id': 1, 'name': 'WebKit'}),
</span><span class="cx">                 db.insert('commits', {'repository': 1, 'revision': reportedData['revision'], 'time': reportedData['time']})
</span><span class="cx">             ]);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', subversionCommit);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return Promise.all([db.selectAll('commits'), db.selectAll('committers')]);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const commits = result[0];
</span><span class="cx">             const committers = result[1];
</span><span class="cx"> 
</span><span class="lines">@@ -226,27 +212,25 @@
</span><span class="cx">             assert.equal(commits[0]['committer'], committers[0]['id']);
</span><span class="cx">             assert.equal(committers[0]['name'], reportedData['author']['name']);
</span><span class="cx">             assert.equal(committers[0]['account'], reportedData['author']['account']);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should not update an unrelated commit&quot;, function (done) {
</del><ins>+    it(&quot;should not update an unrelated commit&quot;, () =&gt; {
</ins><span class="cx">         const db = TestServer.database();
</span><span class="cx">         const firstData = subversionTwoCommits.commits[0];
</span><span class="cx">         const secondData = subversionTwoCommits.commits[1];
</span><del>-        addSlaveForReport(subversionCommit).then(function () {
</del><ins>+        return addSlaveForReport(subversionCommit).then(() =&gt; {
</ins><span class="cx">             return Promise.all([
</span><span class="cx">                 db.insert('repositories', {'id': 1, 'name': 'WebKit'}),
</span><span class="cx">                 db.insert('commits', {'id': 2, 'repository': 1, 'revision': firstData['revision'], 'time': firstData['time']}),
</span><span class="cx">                 db.insert('commits', {'id': 3, 'repository': 1, 'revision': secondData['revision'], 'time': secondData['time']})
</span><span class="cx">             ]);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', subversionCommit);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return Promise.all([db.selectAll('commits'), db.selectAll('committers')]);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const commits = result[0];
</span><span class="cx">             const committers = result[1];
</span><span class="cx"> 
</span><span class="lines">@@ -261,30 +245,27 @@
</span><span class="cx">             assert.equal(commits[1]['id'], 3);
</span><span class="cx">             assert.equal(commits[1]['message'], null);
</span><span class="cx">             assert.equal(commits[1]['committer'], null);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should update an existing committer if there is one&quot;, function (done) {
</del><ins>+    it(&quot;should update an existing committer if there is one&quot;, () =&gt; {
</ins><span class="cx">         const db = TestServer.database();
</span><span class="cx">         const author = subversionCommit.commits[0]['author'];
</span><del>-        addSlaveForReport(subversionCommit).then(function () {
</del><ins>+        return addSlaveForReport(subversionCommit).then(() =&gt; {
</ins><span class="cx">             return Promise.all([
</span><span class="cx">                 db.insert('repositories', {'id': 1, 'name': 'WebKit'}),
</span><span class="cx">                 db.insert('committers', {'repository': 1, 'account': author['account']}),
</span><span class="cx">             ]);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', subversionCommit);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return db.selectAll('committers');
</span><del>-        }).then(function (committers) {
</del><ins>+        }).then((committers) =&gt; {
</ins><span class="cx">             assert.equal(committers.length, 1);
</span><span class="cx">             assert.equal(committers[0]['name'], author['name']);
</span><span class="cx">             assert.equal(committers[0]['account'], author['account']);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     const sameRepositoryNameInSubCommitAndMajorCommit = {
</span><span class="lines">@@ -317,14 +298,13 @@
</span><span class="cx">         ]
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    it(&quot;should distinguish between repositories with the asme name but with a different owner.&quot;, function (done) {
-        const db = TestServer.database();
-        addSlaveForReport(sameRepositoryNameInSubCommitAndMajorCommit).then(function () {
</del><ins>+    it(&quot;should distinguish between repositories with the asme name but with a different owner.&quot;, () =&gt; {
+        return addSlaveForReport(sameRepositoryNameInSubCommitAndMajorCommit).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', sameRepositoryNameInSubCommitAndMajorCommit);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><del>-            return db.selectRows('repositories', {'name': 'WebKit'});
-        }).then(function (result) {
</del><ins>+            return TestServer.database().selectRows('repositories', {'name': 'WebKit'});
+        }).then((result) =&gt; {
</ins><span class="cx">             assert.equal(result.length, 2);
</span><span class="cx">             let osWebKit = result[0];
</span><span class="cx">             let webkitRepository = result[1];
</span><span class="lines">@@ -331,8 +311,7 @@
</span><span class="cx">             assert.notEqual(osWebKit.id, webkitRepository.id);
</span><span class="cx">             assert.equal(osWebKit.name, webkitRepository.name);
</span><span class="cx">             assert.equal(webkitRepository.owner, null);
</span><del>-            done();
-        })
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     const systemVersionCommitWithSubcommits = {
</span><span class="lines">@@ -359,11 +338,11 @@
</span><span class="cx">         ]
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    it(&quot;should accept inserting one commit with some sub commits&quot;, function (done) {
</del><ins>+    it(&quot;should accept inserting one commit with some sub commits&quot;, () =&gt; {
</ins><span class="cx">         const db = TestServer.database();
</span><del>-        addSlaveForReport(systemVersionCommitWithSubcommits).then(function () {
</del><ins>+        return addSlaveForReport(systemVersionCommitWithSubcommits).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', systemVersionCommitWithSubcommits);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return Promise.all([db.selectRows('commits', {'revision': 'Sierra16D32'}),
</span><span class="cx">                 db.selectRows('commits', {'message': 'WebKit Commit'}),
</span><span class="lines">@@ -371,7 +350,7 @@
</span><span class="cx">                 db.selectRows('repositories', {'name': 'OSX'}),
</span><span class="cx">                 db.selectRows('repositories', {'name': &quot;WebKit&quot;}),
</span><span class="cx">                 db.selectRows('repositories', {'name': 'JavaScriptCore'})])
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             assert.equal(result.length, 6);
</span><span class="cx"> 
</span><span class="cx">             assert.equal(result[0].length, 1);
</span><span class="lines">@@ -408,7 +387,7 @@
</span><span class="cx">             return Promise.all([db.selectRows('commit_ownerships', {'owner': osxCommit.id, 'owned': webkitCommit.id}, {'sortBy': 'owner'}),
</span><span class="cx">                 db.selectRows('commit_ownerships', {'owner': osxCommit.id, 'owned': jscCommit.id}, {'sortBy': 'owner'}),
</span><span class="cx">                 db.selectRows('commits', {'repository': webkitRepository.id})]);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             assert.equal(result.length, 3);
</span><span class="cx"> 
</span><span class="cx">             assert.equal(result[0].length, 1);
</span><span class="lines">@@ -420,8 +399,7 @@
</span><span class="cx">             assert.notEqual(ownerCommitForJSCCommit, null);
</span><span class="cx"> 
</span><span class="cx">             assert.equal(result[2].length, 1);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     })
</span><span class="cx"> 
</span><span class="cx">     const multipleSystemVersionCommitsWithSubcommits = {
</span><span class="lines">@@ -465,11 +443,11 @@
</span><span class="cx">         ]
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    it(&quot;should accept inserting multiple commits with multiple sub-commits&quot;, function (done) {
</del><ins>+    it(&quot;should accept inserting multiple commits with multiple sub-commits&quot;, () =&gt; {
</ins><span class="cx">         const db = TestServer.database();
</span><del>-        addSlaveForReport(multipleSystemVersionCommitsWithSubcommits).then(function () {
</del><ins>+        return addSlaveForReport(multipleSystemVersionCommitsWithSubcommits).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', multipleSystemVersionCommitsWithSubcommits);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return Promise.all([db.selectRows('commits', {'revision': 'Sierra16D32'}),
</span><span class="cx">                 db.selectRows('commits', {'revision': 'Sierra16C67'}),
</span><span class="lines">@@ -479,7 +457,7 @@
</span><span class="cx">                 db.selectRows('repositories', {'name': 'OSX'}),
</span><span class="cx">                 db.selectRows('repositories', {'name': &quot;WebKit&quot;}),
</span><span class="cx">                 db.selectRows('repositories', {'name': 'JavaScriptCore'})])
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             assert.equal(result.length, 8);
</span><span class="cx"> 
</span><span class="cx">             assert.equal(result[0].length, 1);
</span><span class="lines">@@ -529,7 +507,7 @@
</span><span class="cx">                 db.selectRows('commit_ownerships', {'owner': osxCommit0.id, 'owned': jscCommit0.id}, {'sortBy': 'owner'}),
</span><span class="cx">                 db.selectRows('commit_ownerships', {'owner': osxCommit1.id, 'owned': jscCommit1.id}, {'sortBy': 'owner'}),
</span><span class="cx">                 db.selectRows('commits', {'repository': webkitRepository.id})]);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             assert.equal(result.length, 5);
</span><span class="cx"> 
</span><span class="cx">             assert.equal(result[0].length, 1);
</span><span class="lines">@@ -549,9 +527,7 @@
</span><span class="cx">             assert.notEqual(ownerCommitForJSCCommit1, null);
</span><span class="cx"> 
</span><span class="cx">             assert.equal(result[4].length, 1);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     const systemVersionCommitWithEmptySubcommits = {
</span><span class="lines">@@ -568,14 +544,14 @@
</span><span class="cx">         ]
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    it(&quot;should accept inserting one commit with no sub commits&quot;, function (done) {
-        const db = TestServer.database();
-        addSlaveForReport(systemVersionCommitWithEmptySubcommits).then(function () {
</del><ins>+    it(&quot;should accept inserting one commit with no sub commits&quot;, () =&gt; {
+        return addSlaveForReport(systemVersionCommitWithEmptySubcommits).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', systemVersionCommitWithEmptySubcommits);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><ins>+            const db = TestServer.database();
</ins><span class="cx">             return Promise.all([db.selectAll('commits'), db.selectAll('repositories'), db.selectAll('commit_ownerships', 'owner')]);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             let commits = result[0];
</span><span class="cx">             let repositories = result[1];
</span><span class="cx">             let commit_ownerships = result[2];
</span><span class="lines">@@ -584,8 +560,7 @@
</span><span class="cx">             assert.equal(commits[0].repository, repositories[0].id);
</span><span class="cx">             assert.equal(repositories[0].name, 'OSX');
</span><span class="cx">             assert.equal(commit_ownerships.length, 0);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     const systemVersionCommitAndSubcommitWithTimestamp = {
</span><span class="lines">@@ -608,13 +583,11 @@
</span><span class="cx">         ]
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    it(&quot;should reject inserting one commit with sub commits that contains timestamp&quot;, function (done) {
-        const db = TestServer.database();
-        addSlaveForReport(systemVersionCommitAndSubcommitWithTimestamp).then(function () {
</del><ins>+    it(&quot;should reject inserting one commit with sub commits that contains timestamp&quot;, () =&gt; {
+        return addSlaveForReport(systemVersionCommitAndSubcommitWithTimestamp).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report-commits/', systemVersionCommitAndSubcommitWithTimestamp);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'SubCommitShouldNotContainTimestamp');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsapireporttestsjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/api-report-tests.js (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/api-report-tests.js        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/server-tests/api-report-tests.js        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -5,12 +5,10 @@
</span><span class="cx"> const TestServer = require('./resources/test-server.js');
</span><span class="cx"> const addBuilderForReport = require('./resources/common-operations.js').addBuilderForReport;
</span><span class="cx"> const addSlaveForReport = require('./resources/common-operations.js').addSlaveForReport;
</span><del>-const connectToDatabaseInEveryTest = require('./resources/common-operations.js').connectToDatabaseInEveryTest;
</del><ins>+const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
</ins><span class="cx"> 
</span><span class="cx"> describe(&quot;/api/report&quot;, function () {
</span><del>-    this.timeout(1000);
-    TestServer.inject();
-    connectToDatabaseInEveryTest();
</del><ins>+    prepareServerTest(this);
</ins><span class="cx"> 
</span><span class="cx">     function emptyReport()
</span><span class="cx">     {
</span><span class="lines">@@ -56,36 +54,33 @@
</span><span class="cx">         };
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    it(&quot;should reject error when builder name is missing&quot;, function (done) {
-        TestServer.remoteAPI().postJSON('/api/report/', [{&quot;buildTime&quot;: &quot;2013-02-28T10:12:03.388304&quot;}]).then(function (response) {
</del><ins>+    it(&quot;should reject error when builder name is missing&quot;, () =&gt; {
+        return TestServer.remoteAPI().postJSON('/api/report/', [{&quot;buildTime&quot;: &quot;2013-02-28T10:12:03.388304&quot;}]).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'MissingBuilderName');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should reject error when build time is missing&quot;, function (done) {
-        addBuilderForReport(emptyReport()).then(function () {
</del><ins>+    it(&quot;should reject error when build time is missing&quot;, () =&gt; {
+        return addBuilderForReport(emptyReport()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [{&quot;builderName&quot;: &quot;someBuilder&quot;, &quot;builderPassword&quot;: &quot;somePassword&quot;}]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'MissingBuildTime');
</span><del>-            done();
</del><span class="cx">         });
</span><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should reject when there are no builders&quot;, function (done) {
-        TestServer.remoteAPI().postJSON('/api/report/', [emptyReport()]).then(function (response) {
</del><ins>+    it(&quot;should reject when there are no builders&quot;, () =&gt; {
+        return TestServer.remoteAPI().postJSON('/api/report/', [emptyReport()]).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'BuilderNotFound');
</span><span class="cx">             assert.equal(response['failureStored'], false);
</span><span class="cx">             assert.equal(response['processedRuns'], 0);
</span><span class="cx">             return TestServer.database().selectAll('reports');
</span><del>-        }).then(function (reports) {
</del><ins>+        }).then((reports) =&gt; {
</ins><span class="cx">             assert.equal(reports.length, 0);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should reject a report without a builder password&quot;, function (done) {
-        addBuilderForReport(emptyReport()).then(function () {
</del><ins>+    it(&quot;should reject a report without a builder password&quot;, () =&gt; {
+        return addBuilderForReport(emptyReport()).then(() =&gt; {
</ins><span class="cx">             var report = [{
</span><span class="cx">                 &quot;buildNumber&quot;: &quot;123&quot;,
</span><span class="cx">                 &quot;buildTime&quot;: &quot;2013-02-28T10:12:03.388304&quot;,
</span><span class="lines">@@ -93,26 +88,25 @@
</span><span class="cx">                 &quot;tests&quot;: {},
</span><span class="cx">                 &quot;revisions&quot;: {}}];
</span><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', report);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'BuilderNotFound');
</span><span class="cx">             assert.equal(response['failureStored'], false);
</span><span class="cx">             assert.equal(response['processedRuns'], 0);
</span><span class="cx">             return TestServer.database().selectAll('reports');
</span><del>-        }).then(function (reports) {
</del><ins>+        }).then((reports) =&gt; {
</ins><span class="cx">             assert.equal(reports.length, 0);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should store a report from a valid builder&quot;, function (done) {
-        addBuilderForReport(emptyReport()).then(function () {
</del><ins>+    it(&quot;should store a report from a valid builder&quot;, () =&gt; {
+        return addBuilderForReport(emptyReport()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [emptyReport()]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             assert.equal(response['failureStored'], false);
</span><span class="cx">             assert.equal(response['processedRuns'], 1);
</span><span class="cx">             return TestServer.database().selectAll('reports');
</span><del>-        }).then(function (reports) {
</del><ins>+        }).then((reports) =&gt; {
</ins><span class="cx">             assert.equal(reports.length, 1);
</span><span class="cx">             const submittedContent = emptyReport();
</span><span class="cx">             const storedContent = JSON.parse(reports[0]['content']);
</span><span class="lines">@@ -121,24 +115,22 @@
</span><span class="cx">             delete submittedContent['tests'];
</span><span class="cx">             delete storedContent['tests'];
</span><span class="cx">             assert.deepEqual(storedContent, submittedContent);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should treat the slave password as the builder password if there is no matching slave&quot;, function (done) {
</del><ins>+    it(&quot;should treat the slave password as the builder password if there is no matching slave&quot;, () =&gt; {
</ins><span class="cx">         let report = emptyReport();
</span><span class="cx">         report['slavePassword'] = report['builderPassword'];
</span><span class="cx">         delete report['builderPassword'];
</span><span class="cx"> 
</span><del>-        addSlaveForReport(report).then(function () {
</del><ins>+        return addSlaveForReport(report).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [report]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             assert.equal(response['failureStored'], false);
</span><span class="cx">             assert.equal(response['processedRuns'], 1);
</span><span class="cx">             return TestServer.database().selectAll('reports');
</span><del>-        }).then(function (reports) {
</del><ins>+        }).then((reports) =&gt; {
</ins><span class="cx">             assert.equal(reports.length, 1);
</span><span class="cx">             const storedContent = JSON.parse(reports[0]['content']);
</span><span class="cx"> 
</span><span class="lines">@@ -146,20 +138,18 @@
</span><span class="cx">             delete report['tests'];
</span><span class="cx">             delete storedContent['tests'];
</span><span class="cx">             assert.deepEqual(storedContent, report);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should store a report from a valid slave&quot;, function (done) {
-        addSlaveForReport(emptySlaveReport()).then(function () {
</del><ins>+    it(&quot;should store a report from a valid slave&quot;, () =&gt; {
+        return addSlaveForReport(emptySlaveReport()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [emptySlaveReport()]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             assert.equal(response['failureStored'], false);
</span><span class="cx">             assert.equal(response['processedRuns'], 1);
</span><span class="cx">             return TestServer.database().selectAll('reports');
</span><del>-        }).then(function (reports) {
</del><ins>+        }).then((reports) =&gt; {
</ins><span class="cx">             assert.equal(reports.length, 1);
</span><span class="cx">             const submittedContent = emptySlaveReport();
</span><span class="cx">             const storedContent = JSON.parse(reports[0]['content']);
</span><span class="lines">@@ -168,76 +158,69 @@
</span><span class="cx">             delete submittedContent['tests'];
</span><span class="cx">             delete storedContent['tests'];
</span><span class="cx">             assert.deepEqual(storedContent, submittedContent);
</span><del>-
-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should store the builder name but not the builder password&quot;, function (done) {
-        addBuilderForReport(emptyReport()).then(function () {
</del><ins>+    it(&quot;should store the builder name but not the builder password&quot;, () =&gt; {
+        return addBuilderForReport(emptyReport()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [emptyReport()]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             return TestServer.database().selectAll('reports');
</span><del>-        }).then(function (reports) {
</del><ins>+        }).then((reports) =&gt; {
</ins><span class="cx">             assert.equal(reports.length, 1);
</span><span class="cx">             const storedContent = JSON.parse(reports[0]['content']);
</span><span class="cx">             assert.equal(storedContent['builderName'], emptyReport()['builderName']);
</span><span class="cx">             assert(!('builderPassword' in storedContent));
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should add a slave if there isn't one and the report was authenticated by a builder&quot;, function (done) {
-        addBuilderForReport(emptyReport()).then(function () {
</del><ins>+    it(&quot;should add a slave if there isn't one and the report was authenticated by a builder&quot;, () =&gt; {
+        return addBuilderForReport(emptyReport()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [emptyReport()]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             return TestServer.database().selectAll('build_slaves');
</span><del>-        }).then(function (slaves) {
</del><ins>+        }).then((slaves) =&gt; {
</ins><span class="cx">             assert.equal(slaves.length, 1);
</span><span class="cx">             assert.equal(slaves[0]['name'], emptyReport()['slaveName']);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should add a builder if there isn't one and the report was authenticated by a slave&quot;, function (done) {
-        addSlaveForReport(emptySlaveReport()).then(function () {
</del><ins>+    it(&quot;should add a builder if there isn't one and the report was authenticated by a slave&quot;, () =&gt; {
+        return addSlaveForReport(emptySlaveReport()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [emptySlaveReport()]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             return TestServer.database().selectAll('builders');
</span><del>-        }).then(function (builders) {
</del><ins>+        }).then((builders) =&gt; {
</ins><span class="cx">             assert.equal(builders.length, 1);
</span><span class="cx">             assert.equal(builders[0]['name'], emptyReport()['builderName']);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should add a build&quot;, function (done) {
-        addBuilderForReport(emptyReport()).then(function () {
</del><ins>+    it(&quot;should add a build&quot;, () =&gt; {
+        return addBuilderForReport(emptyReport()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [emptyReport()]);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.database().selectAll('builds');
</span><del>-        }).then(function (builds) {
</del><ins>+        }).then((builds) =&gt; {
</ins><span class="cx">             assert.strictEqual(builds[0]['number'], 123);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should add the platform&quot;, function (done) {
-        addBuilderForReport(emptyReport()).then(function () {
</del><ins>+    it(&quot;should add the platform&quot;, () =&gt; {
+        return addBuilderForReport(emptyReport()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [emptyReport()]);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.database().selectAll('platforms');
</span><del>-        }).then(function (platforms) {
</del><ins>+        }).then((platforms) =&gt; {
</ins><span class="cx">             assert.equal(platforms.length, 1);
</span><span class="cx">             assert.equal(platforms[0]['name'], 'Mountain Lion');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should add repositories and build revisions&quot;, function (done) {
-        addBuilderForReport(emptyReport()).then(function () {
</del><ins>+    it(&quot;should add repositories and build revisions&quot;, () =&gt; {
+        return addBuilderForReport(emptyReport()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [emptyReport()]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             const db = TestServer.database();
</span><span class="cx">             return Promise.all([
</span><span class="cx">                 db.selectAll('repositories'),
</span><span class="lines">@@ -244,12 +227,12 @@
</span><span class="cx">                 db.selectAll('commits'),
</span><span class="cx">                 db.selectAll('build_commits', 'build_commit'),
</span><span class="cx">             ]);
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const repositories = result[0];
</span><span class="cx">             const commits = result[1];
</span><span class="cx">             const buildCommitsRelations = result[2];
</span><span class="cx">             assert.equal(repositories.length, 2);
</span><del>-            assert.deepEqual(repositories.map(function (row) { return row['name']; }).sort(), ['OS X', 'WebKit']);
</del><ins>+            assert.deepEqual(repositories.map((row) =&gt; { return row['name']; }).sort(), ['OS X', 'WebKit']);
</ins><span class="cx"> 
</span><span class="cx">             assert.equal(commits.length, 2);
</span><span class="cx">             assert.equal(buildCommitsRelations.length, 2);
</span><span class="lines">@@ -269,58 +252,55 @@
</span><span class="cx">             assert.equal(repositoryNameToRevisionRow['WebKit']['revision'], '141977');
</span><span class="cx">             assert.equal(repositoryNameToRevisionRow['WebKit']['time'].toString(),
</span><span class="cx">                 new Date('2013-02-06 08:55:20.9').toString());
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should not create a duplicate build for the same build number if build times are close&quot;, function (done) {
-        let firstReport = emptyReport();
</del><ins>+    it(&quot;should not create a duplicate build for the same build number if build times are close&quot;, () =&gt; {
+        const firstReport = emptyReport();
</ins><span class="cx">         firstReport['buildTime'] = '2013-02-28T10:12:04';
</span><del>-        let secondReport = emptyReport();
</del><ins>+        const secondReport = emptyReport();
</ins><span class="cx">         secondReport['buildTime'] = '2013-02-28T10:22:03';
</span><span class="cx"> 
</span><del>-        addBuilderForReport(emptyReport()).then(function () {
</del><ins>+        return addBuilderForReport(emptyReport()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [firstReport]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return TestServer.database().selectAll('builds');
</span><del>-        }).then(function (builds) {
</del><ins>+        }).then((builds) =&gt; {
</ins><span class="cx">             assert.equal(builds.length, 1);
</span><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [secondReport]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return TestServer.database().selectAll('builds');
</span><del>-        }).then(function (builds) {
</del><ins>+        }).then((builds) =&gt; {
</ins><span class="cx">             assert.equal(builds.length, 1);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should create distinct builds for the same build number if build times are far apart&quot;, function (done) {
-        let firstReport = emptyReport();
</del><ins>+    it(&quot;should create distinct builds for the same build number if build times are far apart&quot;, () =&gt; {
+        const firstReport = emptyReport();
</ins><span class="cx">         firstReport['buildTime'] = '2013-02-28T10:12:03';
</span><del>-        let secondReport = emptyReport();
</del><ins>+        const secondReport = emptyReport();
</ins><span class="cx">         secondReport['buildTime'] = '2014-01-20T22:23:34';
</span><span class="cx"> 
</span><del>-        addBuilderForReport(emptyReport()).then(function () {
</del><ins>+        return addBuilderForReport(emptyReport()).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [firstReport]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return TestServer.database().selectAll('builds');
</span><del>-        }).then(function (builds) {
</del><ins>+        }).then((builds) =&gt; {
</ins><span class="cx">             assert.equal(builds.length, 1);
</span><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [secondReport]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return TestServer.database().selectAll('builds');
</span><del>-        }).then(function (builds) {
</del><ins>+        }).then((builds) =&gt; {
</ins><span class="cx">             assert.equal(builds.length, 2);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should reject a report with mismatching revision info&quot;, function (done) {
-        let firstReport = emptyReport();
</del><ins>+    it(&quot;should reject a report with mismatching revision info&quot;, () =&gt; {
+        const firstReport = emptyReport();
</ins><span class="cx">         firstReport['revisions'] = {
</span><span class="cx">             &quot;WebKit&quot;: {
</span><span class="cx">                 &quot;revision&quot;: &quot;141977&quot;,
</span><span class="lines">@@ -328,7 +308,7 @@
</span><span class="cx">             }
</span><span class="cx">         };
</span><span class="cx"> 
</span><del>-        let secondReport = emptyReport();
</del><ins>+        const secondReport = emptyReport();
</ins><span class="cx">         secondReport['revisions'] = {
</span><span class="cx">             &quot;WebKit&quot;: {
</span><span class="cx">                 &quot;revision&quot;: &quot;150000&quot;,
</span><span class="lines">@@ -336,22 +316,21 @@
</span><span class="cx">             }
</span><span class="cx">         };
</span><span class="cx"> 
</span><del>-        addBuilderForReport(firstReport).then(function () {
</del><ins>+        return addBuilderForReport(firstReport).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [firstReport]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return TestServer.database().selectAll('builds');
</span><del>-        }).then(function (builds) {
</del><ins>+        }).then((builds) =&gt; {
</ins><span class="cx">             assert.equal(builds.length, 1);
</span><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [secondReport]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'MismatchingCommitRevision');
</span><span class="cx">             assert(JSON.stringify(response).indexOf('141977') &gt;= 0);
</span><span class="cx">             assert(JSON.stringify(response).indexOf('150000') &gt;= 0);
</span><span class="cx">             assert.equal(response['failureStored'], true);
</span><span class="cx">             assert.equal(response['processedRuns'], 0);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     const reportWithTwoLevelsOfAggregations = {
</span><span class="lines">@@ -400,15 +379,15 @@
</span><span class="cx"> 
</span><span class="cx">     function reportAfterAddingBuilderAndAggregators(report)
</span><span class="cx">     {
</span><del>-        return addBuilderForReport(report).then(function () {
</del><ins>+        return addBuilderForReport(report).then(() =&gt; {
</ins><span class="cx">             const db = TestServer.database();
</span><span class="cx">             return Promise.all([
</span><span class="cx">                 db.insert('aggregators', {name: 'Arithmetic'}),
</span><span class="cx">                 db.insert('aggregators', {name: 'Geometric'}),
</span><span class="cx">             ]);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [report]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             assert.equal(response['failureStored'], false);
</span><span class="cx">             return response;
</span><span class="lines">@@ -419,34 +398,31 @@
</span><span class="cx">         queryAndFetchAll('SELECT * FROM test_runs WHERE run_config IN'
</span><span class="cx">             + '(SELECT config_id FROM test_configurations, test_metrics, tests WHERE config_metric = metric_id AND metric_test = test_id AND'
</span><span class="cx">             + 'test_name = $1 AND metric_name = $2)',
</span><del>-            ['Arithmetic', 'values.reduce(function (a, b) { return a + b; }) / values.length'], function () {
</del><ins>+            ['Arithmetic', 'values.reduce(function (a, b) { return a + b; }) / values.length'], () =&gt; {
</ins><span class="cx">             queryAndFetchAll('INSERT INTO aggregators (aggregator_name, aggregator_definition) values ($1, $2)',
</span><span class="cx">                 ['Geometric', 'Math.pow(values.reduce(function (a, b) { return a * b; }), 1 / values.length)'], callback);
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    it(&quot;should accept a report with aggregators&quot;, function (done) {
-        reportAfterAddingBuilderAndAggregators(reportWithTwoLevelsOfAggregations).then(function () {
-            done();
-        }).catch(done);
</del><ins>+    it(&quot;should accept a report with aggregators&quot;, () =&gt; {
+        return reportAfterAddingBuilderAndAggregators(reportWithTwoLevelsOfAggregations);
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should add tests&quot;, function (done) {
-        reportAfterAddingBuilderAndAggregators(reportWithTwoLevelsOfAggregations).then(function () {
</del><ins>+    it(&quot;should add tests&quot;, () =&gt; {
+        return reportAfterAddingBuilderAndAggregators(reportWithTwoLevelsOfAggregations).then(() =&gt; {
</ins><span class="cx">             return TestServer.database().selectAll('tests');
</span><del>-        }).then(function (tests) {
-            assert.deepEqual(tests.map(function (row) { return row['name']; }).sort(),
</del><ins>+        }).then((tests) =&gt; {
+            assert.deepEqual(tests.map((row) =&gt; { return row['name']; }).sort(),
</ins><span class="cx">                 ['CSS', 'DOM', 'DummyBenchmark', 'DummyPageLoading', 'ModifyNodes', 'TraverseNodes', 'apple.com', 'webkit.org']);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should add metrics&quot;, function (done) {
-        reportAfterAddingBuilderAndAggregators(reportWithTwoLevelsOfAggregations).then(function () {
</del><ins>+    it(&quot;should add metrics&quot;, () =&gt; {
+        return reportAfterAddingBuilderAndAggregators(reportWithTwoLevelsOfAggregations).then(() =&gt; {
</ins><span class="cx">             return TestServer.database().query('SELECT * FROM tests, test_metrics LEFT JOIN aggregators ON metric_aggregator = aggregator_id WHERE metric_test = test_id');
</span><del>-        }).then(function (result) {
-            let testNameToMetrics = {};
-            result.rows.forEach(function (row) {
</del><ins>+        }).then((result) =&gt; {
+            const testNameToMetrics = {};
+            result.rows.forEach((row) =&gt; {
</ins><span class="cx">                 if (!(row['test_name'] in testNameToMetrics))
</span><span class="cx">                     testNameToMetrics[row['test_name']] = new Array;
</span><span class="cx">                 testNameToMetrics[row['test_name']].push([row['metric_name'], row['aggregator_name']]);
</span><span class="lines">@@ -459,8 +435,7 @@
</span><span class="cx">             assert.deepEqual(testNameToMetrics['TraverseNodes'], [['Time', null]]);
</span><span class="cx">             assert.deepEqual(testNameToMetrics['apple.com'], [['Time', null]]);
</span><span class="cx">             assert.deepEqual(testNameToMetrics['webkit.org'], [['Time', null]]);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     function fetchTestConfig(testName, metricName)
</span><span class="lines">@@ -467,7 +442,7 @@
</span><span class="cx">     {
</span><span class="cx">         return TestServer.database().query(`SELECT * FROM tests, test_metrics, test_configurations
</span><span class="cx">             WHERE test_id = metric_test AND metric_id = config_metric
</span><del>-            AND test_name = $1 AND metric_name = $2`, [testName, metricName]).then(function (result) {
</del><ins>+            AND test_name = $1 AND metric_name = $2`, [testName, metricName]).then((result) =&gt; {
</ins><span class="cx">                 assert.equal(result.rows.length, 1);
</span><span class="cx">                 return result.rows[0];
</span><span class="cx">             });
</span><span class="lines">@@ -476,19 +451,19 @@
</span><span class="cx">     function fetchTestRunIterationsForMetric(testName, metricName)
</span><span class="cx">     {
</span><span class="cx">         const db = TestServer.database();
</span><del>-        return fetchTestConfig(testName, metricName).then(function (config) {
</del><ins>+        return fetchTestConfig(testName, metricName).then((config) =&gt; {
</ins><span class="cx">             return db.selectFirstRow('test_runs', {config: config['config_id']});
</span><del>-        }).then(function (run) {
-            return db.selectRows('run_iterations', {run: run['id']}, {sortBy: 'order'}).then(function (iterations) {
</del><ins>+        }).then((run) =&gt; {
+            return db.selectRows('run_iterations', {run: run['id']}, {sortBy: 'order'}).then((iterations) =&gt; {
</ins><span class="cx">                 return {run: run, iterations: iterations};
</span><span class="cx">             });
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    it(&quot;should store run values&quot;, function (done) {
-        reportAfterAddingBuilderAndAggregators(reportWithTwoLevelsOfAggregations).then(function () {
</del><ins>+    it(&quot;should store run values&quot;, () =&gt; {
+        return reportAfterAddingBuilderAndAggregators(reportWithTwoLevelsOfAggregations).then(() =&gt; {
</ins><span class="cx">             return fetchTestRunIterationsForMetric('apple.com', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const run = result.run;
</span><span class="cx">             const runId = run['id'];
</span><span class="cx">             assert.deepEqual(result.iterations, [
</span><span class="lines">@@ -496,12 +471,12 @@
</span><span class="cx">                 {run: runId, order: 1, group: null, value: 510, relative_time: null},
</span><span class="cx">                 {run: runId, order: 2, group: null, value: 520, relative_time: null},
</span><span class="cx">                 {run: runId, order: 3, group: null, value: 530, relative_time: null}]);
</span><del>-            var sum = 500 + 510 + 520 + 530;
</del><ins>+            const sum = 500 + 510 + 520 + 530;
</ins><span class="cx">             assert.equal(run['mean_cache'], sum / result.iterations.length);
</span><span class="cx">             assert.equal(run['sum_cache'], sum);
</span><span class="cx">             assert.equal(run['square_sum_cache'], 500 * 500 + 510 * 510 + 520 * 520 + 530 * 530);
</span><span class="cx">             return fetchTestRunIterationsForMetric('CSS', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const run = result.run;
</span><span class="cx">             const runId = run['id'];
</span><span class="cx">             assert.deepEqual(result.iterations, [
</span><span class="lines">@@ -529,14 +504,13 @@
</span><span class="cx">             assert.equal(run['mean_cache'], sum / result.iterations.length);
</span><span class="cx">             assert.equal(run['sum_cache'], sum);
</span><span class="cx">             assert.equal(run['square_sum_cache'], squareSum);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should store aggregated run values&quot;, function (done) {
-        reportAfterAddingBuilderAndAggregators(reportWithTwoLevelsOfAggregations).then(function () {
</del><ins>+    it(&quot;should store aggregated run values&quot;, () =&gt; {
+        return reportAfterAddingBuilderAndAggregators(reportWithTwoLevelsOfAggregations).then(() =&gt; {
</ins><span class="cx">             return fetchTestRunIterationsForMetric('DummyPageLoading', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const run = result.run;
</span><span class="cx">             const runId = result.run['id'];
</span><span class="cx">             const expectedValues = [(500 + 100) / 2, (510 + 110) / 2, (520 + 120) / 2, (530 + 130) / 2];
</span><span class="lines">@@ -549,14 +523,13 @@
</span><span class="cx">             assert.equal(run['mean_cache'], sum / result.iterations.length);
</span><span class="cx">             assert.equal(run['sum_cache'], sum);
</span><span class="cx">             assert.equal(run['square_sum_cache'], expectedValues.reduce(function (sum, value) { return sum + value * value; }, 0));
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should be able to compute the aggregation of aggregated values&quot;, function (done) {
-        reportAfterAddingBuilderAndAggregators(reportWithTwoLevelsOfAggregations).then(function () {
</del><ins>+    it(&quot;should be able to compute the aggregation of aggregated values&quot;, () =&gt; {
+        return reportAfterAddingBuilderAndAggregators(reportWithTwoLevelsOfAggregations).then(() =&gt; {
</ins><span class="cx">             return fetchTestRunIterationsForMetric('DummyBenchmark', 'Time');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const run = result.run;
</span><span class="cx">             const runId = run['id'];
</span><span class="cx">             const expectedIterations = [];
</span><span class="lines">@@ -574,8 +547,7 @@
</span><span class="cx">             assert.equal(run['mean_cache'], sum / result.iterations.length);
</span><span class="cx">             assert.equal(run['sum_cache'], sum);
</span><span class="cx">             assert.equal(run['square_sum_cache'], squareSum);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     function reportWithSameSubtestName()
</span><span class="lines">@@ -611,28 +583,25 @@
</span><span class="cx">         };
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    it(&quot;should be able to add a report with same subtest name&quot;, function (done) {
-        reportAfterAddingBuilderAndAggregators(reportWithSameSubtestName()).then(function () {
-            done();
-        }).catch(done);
</del><ins>+    it(&quot;should be able to add a report with same subtest name&quot;, () =&gt; {
+        return reportAfterAddingBuilderAndAggregators(reportWithSameSubtestName());
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should be able to reuse the same test rows&quot;, function (done) {
-        reportAfterAddingBuilderAndAggregators(reportWithSameSubtestName()).then(function () {
</del><ins>+    it(&quot;should be able to reuse the same test rows&quot;, () =&gt; {
+        return reportAfterAddingBuilderAndAggregators(reportWithSameSubtestName()).then(() =&gt; {
</ins><span class="cx">             return TestServer.database().selectAll('tests');
</span><del>-        }).then(function (tests) {
</del><ins>+        }).then((tests) =&gt; {
</ins><span class="cx">             assert.equal(tests.length, 6);
</span><span class="cx">             let newReport = reportWithSameSubtestName();
</span><span class="cx">             newReport.buildNumber = &quot;125&quot;;
</span><span class="cx">             newReport.buildTime = &quot;2013-02-28T12:17:24.1&quot;;
</span><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [newReport]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return TestServer.database().selectAll('tests');
</span><del>-        }).then(function (tests) {
</del><ins>+        }).then((tests) =&gt; {
</ins><span class="cx">             assert.equal(tests.length, 6);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     const reportWithSameSingleValue = {
</span><span class="lines">@@ -655,10 +624,10 @@
</span><span class="cx">             },
</span><span class="cx">         }};
</span><span class="cx"> 
</span><del>-    it(&quot;should be able to add a report with single value results&quot;, function (done) {
-        reportAfterAddingBuilderAndAggregators(reportWithSameSingleValue).then(function () {
</del><ins>+    it(&quot;should be able to add a report with single value results&quot;, () =&gt; {
+        return reportAfterAddingBuilderAndAggregators(reportWithSameSingleValue).then(() =&gt; {
</ins><span class="cx">             return fetchTestRunIterationsForMetric('test1', 'Combined');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const run = result.run;
</span><span class="cx">             assert.equal(run['iteration_count_cache'], 1);
</span><span class="cx">             assert.equal(run['mean_cache'], 3);
</span><span class="lines">@@ -665,14 +634,13 @@
</span><span class="cx">             assert.equal(run['sum_cache'], 3);
</span><span class="cx">             assert.equal(run['square_sum_cache'], 9);
</span><span class="cx">             return fetchTestRunIterationsForMetric('suite', 'Combined');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const run = result.run;
</span><span class="cx">             assert.equal(run['iteration_count_cache'], 1);
</span><span class="cx">             assert.equal(run['mean_cache'], 5);
</span><span class="cx">             assert.equal(run['sum_cache'], 5);
</span><span class="cx">             assert.equal(run['square_sum_cache'], 25);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     const reportWithSameValuePairs = {
</span><span class="lines">@@ -688,10 +656,10 @@
</span><span class="cx">             },
</span><span class="cx">         };
</span><span class="cx"> 
</span><del>-    it(&quot;should be able to add a report with (relative time, value) pairs&quot;, function (done) {
-        reportAfterAddingBuilderAndAggregators(reportWithSameValuePairs).then(function () {
</del><ins>+    it(&quot;should be able to add a report with (relative time, value) pairs&quot;, () =&gt; {
+        return reportAfterAddingBuilderAndAggregators(reportWithSameValuePairs).then(() =&gt; {
</ins><span class="cx">             return fetchTestRunIterationsForMetric('test', 'FrameRate');
</span><del>-        }).then(function (result) {
</del><ins>+        }).then((result) =&gt; {
</ins><span class="cx">             const run = result.run;
</span><span class="cx">             assert.equal(run['iteration_count_cache'], 3);
</span><span class="cx">             assert.equal(run['mean_cache'], 4);
</span><span class="lines">@@ -703,8 +671,7 @@
</span><span class="cx">                 {run: runId, order: 0, group: null, value: 4, relative_time: 0},
</span><span class="cx">                 {run: runId, order: 1, group: null, value: 5, relative_time: 100},
</span><span class="cx">                 {run: runId, order: 2, group: null, value: 3, relative_time: 205}]);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     const reportsUpdatingDifferentTests = [
</span><span class="lines">@@ -734,40 +701,38 @@
</span><span class="cx">         },
</span><span class="cx">     ];
</span><span class="cx"> 
</span><del>-    it(&quot;should update the last modified date of test configurations with new runs&quot;, function (done) {
-        addBuilderForReport(reportsUpdatingDifferentTests[0]).then(function () {
</del><ins>+    it(&quot;should update the last modified date of test configurations with new runs&quot;, () =&gt; {
+        return addBuilderForReport(reportsUpdatingDifferentTests[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [reportsUpdatingDifferentTests[0]]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return fetchTestConfig('test1', 'Time');
</span><del>-        }).then(function (originalConfig) {
-            return TestServer.remoteAPI().postJSON('/api/report/', [reportsUpdatingDifferentTests[2]]).then(function () {
</del><ins>+        }).then((originalConfig) =&gt; {
+            return TestServer.remoteAPI().postJSON('/api/report/', [reportsUpdatingDifferentTests[2]]).then(() =&gt; {
</ins><span class="cx">                 return fetchTestConfig('test1', 'Time');
</span><del>-            }).then(function (config) {
</del><ins>+            }).then((config) =&gt; {
</ins><span class="cx">                 assert(originalConfig['config_runs_last_modified'] instanceof Date);
</span><span class="cx">                 assert(config['config_runs_last_modified'] instanceof Date);
</span><span class="cx">                 assert(+originalConfig['config_runs_last_modified'] &lt; +config['config_runs_last_modified']);
</span><del>-                done();
</del><span class="cx">             });
</span><del>-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should not update the last modified date of unrelated test configurations&quot;, function (done) {
-        addBuilderForReport(reportsUpdatingDifferentTests[0]).then(function () {
</del><ins>+    it(&quot;should not update the last modified date of unrelated test configurations&quot;, () =&gt; {
+        return addBuilderForReport(reportsUpdatingDifferentTests[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', [reportsUpdatingDifferentTests[0]]);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return fetchTestConfig('test1', 'Time');
</span><del>-        }).then(function (originalConfig) {
-            return TestServer.remoteAPI().postJSON('/api/report/', [reportsUpdatingDifferentTests[1]]).then(function (response) {
</del><ins>+        }).then((originalConfig) =&gt; {
+            return TestServer.remoteAPI().postJSON('/api/report/', [reportsUpdatingDifferentTests[1]]).then((response) =&gt; {
</ins><span class="cx">                 assert.equal(response['status'], 'OK');
</span><span class="cx">                 return fetchTestConfig('test1', 'Time');
</span><del>-            }).then(function (config) {
</del><ins>+            }).then((config) =&gt; {
</ins><span class="cx">                 assert(originalConfig['config_runs_last_modified'] instanceof Date);
</span><span class="cx">                 assert(config['config_runs_last_modified'] instanceof Date);
</span><span class="cx">                 assert.equal(+originalConfig['config_runs_last_modified'], +config['config_runs_last_modified']);
</span><del>-                done();
</del><span class="cx">             });
</span><del>-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsapiupdatetriggerablejs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/api-update-triggerable.js (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/api-update-triggerable.js        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/server-tests/api-update-triggerable.js        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -7,12 +7,10 @@
</span><span class="cx"> const TestServer = require('./resources/test-server.js');
</span><span class="cx"> const MockData = require('./resources/mock-data.js');
</span><span class="cx"> const addSlaveForReport = require('./resources/common-operations.js').addSlaveForReport;
</span><del>-const connectToDatabaseInEveryTest = require('./resources/common-operations.js').connectToDatabaseInEveryTest;
</del><ins>+const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
</ins><span class="cx"> 
</span><span class="cx"> describe('/api/update-triggerable/', function () {
</span><del>-    this.timeout(1000);
-    TestServer.inject();
-    connectToDatabaseInEveryTest();
</del><ins>+    prepareServerTest(this);
</ins><span class="cx"> 
</span><span class="cx">     const emptyUpdate = {
</span><span class="cx">         'slaveName': 'someSlave',
</span><span class="lines">@@ -30,85 +28,78 @@
</span><span class="cx">         ],
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    it('should reject when slave name is missing', function (done) {
-        TestServer.remoteAPI().postJSON('/api/update-triggerable/', {}).then(function (response) {
</del><ins>+    it('should reject when slave name is missing', () =&gt; {
+        return TestServer.remoteAPI().postJSON('/api/update-triggerable/', {}).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'MissingSlaveName');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should reject when there are no slaves', function (done) {
</del><ins>+    it('should reject when there are no slaves', () =&gt; {
</ins><span class="cx">         const update = {slaveName: emptyUpdate.slaveName, slavePassword: emptyUpdate.slavePassword};
</span><del>-        TestServer.remoteAPI().postJSON('/api/update-triggerable/', update).then(function (response) {
</del><ins>+        return TestServer.remoteAPI().postJSON('/api/update-triggerable/', update).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'SlaveNotFound');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should reject when the slave password doesn\'t match', function (done) {
-        MockData.addMockData(TestServer.database()).then(function () {
</del><ins>+    it('should reject when the slave password doesn\'t match', () =&gt; {
+        return MockData.addMockData(TestServer.database()).then(() =&gt; {
</ins><span class="cx">             return addSlaveForReport(emptyUpdate);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             const report = {slaveName: emptyUpdate.slaveName, slavePassword: 'badPassword'};
</span><span class="cx">             return TestServer.remoteAPI().postJSON('/api/update-triggerable/', emptyUpdate);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should accept an empty report', function (done) {
-        MockData.addMockData(TestServer.database()).then(function () {
</del><ins>+    it('should accept an empty report', () =&gt; {
+        return MockData.addMockData(TestServer.database()).then(() =&gt; {
</ins><span class="cx">             return addSlaveForReport(emptyUpdate);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/update-triggerable/', emptyUpdate);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('delete existing configurations when accepting an empty report', function (done) {
</del><ins>+    it('delete existing configurations when accepting an empty report', () =&gt; {
</ins><span class="cx">         const db = TestServer.database();
</span><del>-        MockData.addMockData(db).then(function () {
</del><ins>+        return MockData.addMockData(db).then(() =&gt; {
</ins><span class="cx">             return Promise.all([
</span><span class="cx">                 addSlaveForReport(emptyUpdate),
</span><span class="cx">                 db.insert('triggerable_configurations',
</span><span class="cx">                     {'triggerable': 1 /* build-webkit */, 'test': MockData.someTestId(), 'platform': MockData.somePlatformId()})
</span><span class="cx">             ]);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/update-triggerable/', emptyUpdate);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return db.selectAll('triggerable_configurations', 'test');
</span><del>-        }).then(function (rows) {
</del><ins>+        }).then((rows) =&gt; {
</ins><span class="cx">             assert.equal(rows.length, 0);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should add configurations in the update', function (done) {
</del><ins>+    it('should add configurations in the update', () =&gt; {
</ins><span class="cx">         const db = TestServer.database();
</span><del>-        MockData.addMockData(db).then(function () {
</del><ins>+        return MockData.addMockData(db).then(() =&gt; {
</ins><span class="cx">             return addSlaveForReport(smallUpdate);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/update-triggerable/', smallUpdate);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return db.selectAll('triggerable_configurations', 'test');
</span><del>-        }).then(function (rows) {
</del><ins>+        }).then((rows) =&gt; {
</ins><span class="cx">             assert.equal(rows.length, 1);
</span><span class="cx">             assert.equal(rows[0]['test'], smallUpdate.configurations[0]['test']);
</span><span class="cx">             assert.equal(rows[0]['platform'], smallUpdate.configurations[0]['platform']);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it('should reject when a configuration is malformed', function (done) {
-        const db = TestServer.database();
-        MockData.addMockData(db).then(function () {
</del><ins>+    it('should reject when a configuration is malformed', () =&gt; {
+        return MockData.addMockData(TestServer.database()).then(() =&gt; {
</ins><span class="cx">             return addSlaveForReport(smallUpdate);
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             const update = {
</span><span class="cx">                 'slaveName': 'someSlave',
</span><span class="cx">                 'slavePassword': 'somePassword',
</span><span class="lines">@@ -116,10 +107,9 @@
</span><span class="cx">                 'configurations': [{}],
</span><span class="cx">             };
</span><span class="cx">             return TestServer.remoteAPI().postJSON('/api/update-triggerable/', update);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'InvalidConfigurationEntry');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsprivilegedapiupaterunstatusjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/privileged-api-upate-run-status.js (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/privileged-api-upate-run-status.js        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/server-tests/privileged-api-upate-run-status.js        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -6,12 +6,10 @@
</span><span class="cx"> 
</span><span class="cx"> const TestServer = require('./resources/test-server.js');
</span><span class="cx"> const addBuilderForReport = require('./resources/common-operations.js').addBuilderForReport;
</span><del>-const connectToDatabaseInEveryTest = require('./resources/common-operations.js').connectToDatabaseInEveryTest;
</del><ins>+const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
</ins><span class="cx"> 
</span><span class="cx"> describe(&quot;/privileged-api/update-run-status&quot;, function () {
</span><del>-    this.timeout(1000);
-    TestServer.inject();
-    connectToDatabaseInEveryTest();
</del><ins>+    prepareServerTest(this);
</ins><span class="cx"> 
</span><span class="cx">     const reportWithRevision = [{
</span><span class="cx">         &quot;buildNumber&quot;: &quot;124&quot;,
</span><span class="lines">@@ -35,15 +33,15 @@
</span><span class="cx">             },
</span><span class="cx">         }}];
</span><span class="cx"> 
</span><del>-    it(&quot;should be able to mark a run as an outlier&quot;, function (done) {
</del><ins>+    it(&quot;should be able to mark a run as an outlier&quot;, () =&gt; {
</ins><span class="cx">         const db = TestServer.database();
</span><span class="cx">         let id;
</span><del>-        addBuilderForReport(reportWithRevision[0]).then(function () {
</del><ins>+        return addBuilderForReport(reportWithRevision[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', reportWithRevision);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return db.selectAll('test_runs');
</span><del>-        }).then(function (runRows) {
</del><ins>+        }).then((runRows) =&gt; {
</ins><span class="cx">             assert.equal(runRows.length, 1);
</span><span class="cx">             assert.equal(runRows[0]['mean_cache'], 11);
</span><span class="cx">             assert.equal(runRows[0]['iteration_count_cache'], 1);
</span><span class="lines">@@ -50,85 +48,80 @@
</span><span class="cx">             assert.equal(runRows[0]['marked_outlier'], false);
</span><span class="cx">             id = runRows[0]['id'];
</span><span class="cx">             return PrivilegedAPI.requestCSRFToken();
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return PrivilegedAPI.sendRequest('update-run-status', {'run': id, 'markedOutlier': true, 'token': PrivilegedAPI._token});
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return db.selectAll('test_runs');
</span><del>-        }).then(function (runRows) {
</del><ins>+        }).then((runRows) =&gt; {
</ins><span class="cx">             assert.equal(runRows.length, 1);
</span><span class="cx">             assert.equal(runRows[0]['mean_cache'], 11);
</span><span class="cx">             assert.equal(runRows[0]['iteration_count_cache'], 1);
</span><span class="cx">             assert.equal(runRows[0]['marked_outlier'], true);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should reject when the token is not set in cookie&quot;, function (done) {
</del><ins>+    it(&quot;should reject when the token is not set in cookie&quot;, () =&gt; {
</ins><span class="cx">         const db = TestServer.database();
</span><del>-        addBuilderForReport(reportWithRevision[0]).then(function () {
</del><ins>+        return addBuilderForReport(reportWithRevision[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', reportWithRevision);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return db.selectAll('test_runs');
</span><del>-        }).then(function (runRows) {
</del><ins>+        }).then((runRows) =&gt; {
</ins><span class="cx">             assert.equal(runRows.length, 1);
</span><span class="cx">             assert.equal(runRows[0]['marked_outlier'], false);
</span><span class="cx">             return PrivilegedAPI.requestCSRFToken();
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             RemoteAPI.clearCookies();
</span><span class="cx">             return RemoteAPI.postJSONWithStatus('/privileged-api/update-run-status', {token: PrivilegedAPI._token});
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             assert(false, 'PrivilegedAPI.sendRequest should reject');
</span><del>-        }, function (response) {
</del><ins>+        }, (response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'InvalidToken');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should reject when the token in the request content is bad&quot;, function (done) {
-        const db = TestServer.database();
-        addBuilderForReport(reportWithRevision[0]).then(function () {
</del><ins>+    it(&quot;should reject when the token in the request content is bad&quot;, () =&gt; {
+        return addBuilderForReport(reportWithRevision[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', reportWithRevision);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><del>-            return db.selectAll('test_runs');
-        }).then(function (runRows) {
</del><ins>+            return TestServer.database().selectAll('test_runs');
+        }).then((runRows) =&gt; {
</ins><span class="cx">             assert.equal(runRows.length, 1);
</span><span class="cx">             assert.equal(runRows[0]['marked_outlier'], false);
</span><span class="cx">             return PrivilegedAPI.requestCSRFToken();
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return RemoteAPI.postJSONWithStatus('/privileged-api/update-run-status', {token: 'bad'});
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             assert(false, 'PrivilegedAPI.sendRequest should reject');
</span><del>-        }, function (response) {
</del><ins>+        }, (response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'InvalidToken');
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    it(&quot;should be able to unmark a run as an outlier&quot;, function (done) {
</del><ins>+    it(&quot;should be able to unmark a run as an outlier&quot;, () =&gt; {
</ins><span class="cx">         const db = TestServer.database();
</span><del>-        addBuilderForReport(reportWithRevision[0]).then(function () {
</del><ins>+        return addBuilderForReport(reportWithRevision[0]).then(() =&gt; {
</ins><span class="cx">             return TestServer.remoteAPI().postJSON('/api/report/', reportWithRevision);
</span><del>-        }).then(function (response) {
</del><ins>+        }).then((response) =&gt; {
</ins><span class="cx">             assert.equal(response['status'], 'OK');
</span><span class="cx">             return db.selectAll('test_runs');
</span><del>-        }).then(function (runRows) {
</del><ins>+        }).then((runRows) =&gt; {
</ins><span class="cx">             assert.equal(runRows.length, 1);
</span><span class="cx">             assert.equal(runRows[0]['marked_outlier'], false);
</span><span class="cx">             return PrivilegedAPI.sendRequest('update-run-status', {'run': runRows[0]['id'], 'markedOutlier': true});
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return db.selectAll('test_runs');
</span><del>-        }).then(function (runRows) {
</del><ins>+        }).then((runRows) =&gt; {
</ins><span class="cx">             assert.equal(runRows.length, 1);
</span><span class="cx">             assert.equal(runRows[0]['marked_outlier'], true);
</span><span class="cx">             return PrivilegedAPI.sendRequest('update-run-status', {'run': runRows[0]['id'], 'markedOutlier': false});
</span><del>-        }).then(function () {
</del><ins>+        }).then(() =&gt; {
</ins><span class="cx">             return db.selectAll('test_runs');
</span><del>-        }).then(function (runRows) {
</del><ins>+        }).then((runRows) =&gt; {
</ins><span class="cx">             assert.equal(runRows.length, 1);
</span><span class="cx">             assert.equal(runRows[0]['marked_outlier'], false);
</span><del>-            done();
-        }).catch(done);
</del><ins>+        });
</ins><span class="cx">     });
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsresourcescommonoperationsjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/resources/common-operations.js (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/resources/common-operations.js        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/server-tests/resources/common-operations.js        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -17,9 +17,14 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function connectToDatabaseInEveryTest()
</del><ins>+function prepareServerTest(test)
</ins><span class="cx"> {
</span><ins>+    test.timeout(1000);
+    TestServer.inject();
+
</ins><span class="cx">     beforeEach(function () {
</span><ins>+        if (typeof(MockData) != 'undefined')
+            MockData.resetV3Models();
</ins><span class="cx">         TestServer.database().connect({keepAlive: true});
</span><span class="cx">     });
</span><span class="cx"> 
</span><span class="lines">@@ -41,6 +46,6 @@
</span><span class="cx"> if (typeof module != 'undefined') {
</span><span class="cx">     module.exports.addBuilderForReport = addBuilderForReport;
</span><span class="cx">     module.exports.addSlaveForReport = addSlaveForReport;
</span><del>-    module.exports.connectToDatabaseInEveryTest = connectToDatabaseInEveryTest;
</del><ins>+    module.exports.prepareServerTest = prepareServerTest;
</ins><span class="cx">     module.exports.submitReport = submitReport;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgserverteststoolsbuildbottriggerabletestsjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js (213968 => 213969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js        2017-03-15 02:08:37 UTC (rev 213968)
+++ trunk/Websites/perf.webkit.org/server-tests/tools-buildbot-triggerable-tests.js        2017-03-15 03:19:02 UTC (rev 213969)
</span><span class="lines">@@ -6,7 +6,7 @@
</span><span class="cx"> const MockData = require('./resources/mock-data.js');
</span><span class="cx"> const MockRemoteAPI = require('../unit-tests/resources/mock-remote-api.js').MockRemoteAPI;
</span><span class="cx"> const TestServer = require('./resources/test-server.js');
</span><del>-const connectToDatabaseInEveryTest = require('./resources/common-operations.js').connectToDatabaseInEveryTest;
</del><ins>+const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
</ins><span class="cx"> 
</span><span class="cx"> class MockLogger {
</span><span class="cx">     constructor()
</span><span class="lines">@@ -19,8 +19,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> describe('BuildbotTriggerable', function () {
</span><del>-    this.timeout(1000);
-    TestServer.inject();
</del><ins>+    prepareServerTest(this);
</ins><span class="cx"> 
</span><span class="cx">     beforeEach(function () {
</span><span class="cx">         MockData.resetV3Models();
</span><span class="lines">@@ -27,23 +26,20 @@
</span><span class="cx">         MockRemoteAPI.reset('http://build.webkit.org');
</span><span class="cx">     });
</span><span class="cx"> 
</span><del>-    describe('syncOnce', function () {
-        it('should schedule the next build request when there are no pending builds', function (done) {
-            let db = TestServer.database();
</del><ins>+    describe('syncOnce', () =&gt; {
+        it('should schedule the next build request when there are no pending builds', () =&gt; {
+            const db = TestServer.database();
</ins><span class="cx">             let syncPromise;
</span><del>-            db.connect().then(function () {
-                return MockData.addMockData(db, ['completed', 'running', 'pending', 'pending']);
-            }).then(function () {
</del><ins>+            return MockData.addMockData(db, ['completed', 'running', 'pending', 'pending']).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><del>-            }).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);
</del><ins>+            }).then(() =&gt; {
+                const config = MockData.mockTestSyncConfigWithSingleBuilder();
+                const logger = new MockLogger;
+                const slaveInfo = {name: 'sync-slave', password: 'password'};
+                const triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</ins><span class="cx">                 syncPromise = triggerable.syncOnce();
</span><del>-                syncPromise.catch(done);
</del><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'completed');
</span><span class="cx">                 assert.equal(BuildRequest.findById(701).status(), 'running');
</span><span class="lines">@@ -53,75 +49,71 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[0].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[1].resolve({[-1]: MockData.runningBuild(), [-2]: MockData.finishedBuild()});
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].method, 'POST');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].url, '/builders/some-builder-1/force');
</span><span class="cx">                 assert.deepEqual(MockRemoteAPI.requests[2].data, {'wk': '191622', 'os': '10.11 15A284', 'build-request-id': '702'});
</span><span class="cx">                 MockRemoteAPI.requests[2].resolve('OK');
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[3].resolve([MockData.pendingBuild()])
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[4].resolve({[-1]: MockData.runningBuild(), [-2]: MockData.finishedBuild()});
</span><span class="cx">                 return syncPromise;
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithSingleBuilder().triggerableName);
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'completed');
</span><span class="cx">                 assert.equal(BuildRequest.findById(701).status(), 'running');
</span><span class="cx">                 assert.equal(BuildRequest.findById(702).status(), 'scheduled');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><del>-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx"> 
</span><del>-        it('should not schedule the next build request when there is a pending build', function (done) {
-            let db = TestServer.database();
</del><ins>+        it('should not schedule the next build request when there is a pending build', () =&gt; {
+            const db = TestServer.database();
</ins><span class="cx">             let syncPromise;
</span><del>-            db.connect().then(function () {
-                return MockData.addMockData(db, ['completed', 'running', 'pending', 'pending']);
-            }).then(function () {
</del><ins>+            return MockData.addMockData(db, ['completed', 'running', 'pending', 'pending']).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 let config = MockData.mockTestSyncConfigWithSingleBuilder();
</span><span class="cx">                 let logger = new MockLogger;
</span><span class="cx">                 let slaveInfo = {name: 'sync-slave', password: 'password'};
</span><span class="cx">                 let triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</span><span class="cx">                 syncPromise = triggerable.syncOnce();
</span><del>-                syncPromise.catch(done);
</del><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[0].resolve([MockData.pendingBuild()]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[1].resolve({[-1]: MockData.runningBuild(), [-2]: MockData.finishedBuild()});
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[2].resolve([MockData.pendingBuild()])
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[3].resolve({[-1]: MockData.runningBuild(), [-2]: MockData.finishedBuild()});
</span><span class="cx">                 return syncPromise;
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'completed');
</span><span class="cx">                 assert.equal(BuildRequest.findById(701).status(), 'running');
</span><span class="lines">@@ -128,32 +120,28 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(702).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><span class="cx">                 return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithSingleBuilder().triggerableName);
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'completed');
</span><span class="cx">                 assert.equal(BuildRequest.findById(701).status(), 'running');
</span><span class="cx">                 assert.equal(BuildRequest.findById(702).status(), 'scheduled');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><del>-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx"> 
</span><del>-        it('should schedule the build request on a builder without a pending build if it\'s the first request in the group', function (done) {
-            let db = TestServer.database();
</del><ins>+        it('should schedule the build request on a builder without a pending build if it\'s the first request in the group', () =&gt; {
+            const db = TestServer.database();
</ins><span class="cx">             let syncPromise;
</span><del>-            db.connect().then(function () {
-                return MockData.addMockData(db, ['pending', 'pending', 'pending', 'pending']);
-            }).then(function () {
</del><ins>+            return MockData.addMockData(db, ['pending', 'pending', 'pending', 'pending']).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><del>-            }).then(function () {
-                let config = MockData.mockTestSyncConfigWithTwoBuilders();
-                let logger = new MockLogger;
-                let slaveInfo = {name: 'sync-slave', password: 'password'};
-                let triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</del><ins>+            }).then(() =&gt; {
+                const config = MockData.mockTestSyncConfigWithTwoBuilders();
+                const logger = new MockLogger;
+                const slaveInfo = {name: 'sync-slave', password: 'password'};
+                const triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</ins><span class="cx">                 syncPromise = triggerable.syncOnce();
</span><del>-                syncPromise.catch(done);
</del><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 2);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="lines">@@ -162,7 +150,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some%20builder%202/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[1].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 4);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="lines">@@ -171,7 +159,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some%20builder%202/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[3].resolve({});
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 5);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].method, 'POST');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].url, '/builders/some%20builder%202/force');
</span><span class="lines">@@ -178,7 +166,7 @@
</span><span class="cx">                 assert.deepEqual(MockRemoteAPI.requests[4].data, {'wk': '191622', 'os': '10.11 15A284', 'build-request-id': '700'});
</span><span class="cx">                 MockRemoteAPI.requests[4].resolve('OK');
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 7);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[5].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[5].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="lines">@@ -187,7 +175,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[6].url, '/json/builders/some%20builder%202/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[6].resolve([MockData.pendingBuild({builder: 'some builder 2', buildRequestId: 700})]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 9);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[7].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[7].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="lines">@@ -196,7 +184,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[8].url, '/json/builders/some%20builder%202/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[8].resolve({});
</span><span class="cx">                 return syncPromise;
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), null);
</span><span class="lines">@@ -207,7 +195,7 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).statusUrl(), null);
</span><span class="cx">                 return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithTwoBuilders().triggerableName);
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'scheduled');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), 'http://build.webkit.org/builders/some%20builder%202/');
</span><span class="lines">@@ -217,26 +205,22 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(702).statusUrl(), null);
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).statusUrl(), null);
</span><del>-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx"> 
</span><del>-        it('should not schedule a build request on a different builder than the one the first build request is pending', function (done) {
-            let db = TestServer.database();
</del><ins>+        it('should not schedule a build request on a different builder than the one the first build request is pending', () =&gt; {
+            const db = TestServer.database();
</ins><span class="cx">             let syncPromise;
</span><del>-            db.connect().then(function () {
-                return MockData.addMockData(db, ['pending', 'pending', 'pending', 'pending']);
-            }).then(function () {
</del><ins>+            return MockData.addMockData(db, ['pending', 'pending', 'pending', 'pending']).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 let config = MockData.mockTestSyncConfigWithTwoBuilders();
</span><span class="cx">                 let logger = new MockLogger;
</span><span class="cx">                 let slaveInfo = {name: 'sync-slave', password: 'password'};
</span><span class="cx">                 let triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</span><span class="cx">                 syncPromise = triggerable.syncOnce();
</span><del>-                syncPromise.catch(done);
</del><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 2);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="lines">@@ -245,7 +229,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some%20builder%202/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[1].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 4);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="lines">@@ -254,7 +238,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some%20builder%202/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[3].resolve({});
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 6);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="lines">@@ -263,7 +247,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[5].url, '/json/builders/some%20builder%202/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[5].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 8);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[6].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[6].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="lines">@@ -272,7 +256,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[7].url, '/json/builders/some%20builder%202/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[7].resolve({});
</span><span class="cx">                 return syncPromise;
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), null);
</span><span class="lines">@@ -283,7 +267,7 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).statusUrl(), null);
</span><span class="cx">                 return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithTwoBuilders().triggerableName);
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'scheduled');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), 'http://build.webkit.org/builders/some-builder-1/');
</span><span class="lines">@@ -293,26 +277,22 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(702).statusUrl(), null);
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).statusUrl(), null);
</span><del>-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx"> 
</span><del>-        it('should update the status of a pending build and schedule a new build if the pending build had started running', function (done) {
-            let db = TestServer.database();
</del><ins>+        it('should update the status of a pending build and schedule a new build if the pending build had started running', () =&gt; {
+            const db = TestServer.database();
</ins><span class="cx">             let syncPromise;
</span><del>-            db.connect().then(function () {
-                return MockData.addMockData(db, ['pending', 'pending', 'pending', 'pending']);
-            }).then(function () {
</del><ins>+            return MockData.addMockData(db, ['pending', 'pending', 'pending', 'pending']).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><del>-            }).then(function () {
-                let config = MockData.mockTestSyncConfigWithTwoBuilders();
-                let logger = new MockLogger;
-                let slaveInfo = {name: 'sync-slave', password: 'password'};
-                let triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</del><ins>+            }).then(() =&gt; {
+                const config = MockData.mockTestSyncConfigWithTwoBuilders();
+                const logger = new MockLogger;
+                const slaveInfo = {name: 'sync-slave', password: 'password'};
+                const triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</ins><span class="cx">                 syncPromise = triggerable.syncOnce();
</span><del>-                syncPromise.catch(done);
</del><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 2);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="lines">@@ -321,7 +301,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some%20builder%202/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[1].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 4);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="lines">@@ -330,7 +310,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some%20builder%202/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[3].resolve({});
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 5);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].method, 'POST');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].url, '/builders/some-builder-1/force');
</span><span class="lines">@@ -337,7 +317,7 @@
</span><span class="cx">                 assert.deepEqual(MockRemoteAPI.requests[4].data, {'wk': '191622', 'os': '10.11 15A284', 'build-request-id': '702'});
</span><span class="cx">                 MockRemoteAPI.requests[4].resolve('OK');
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 7);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[5].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[5].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="lines">@@ -346,7 +326,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[6].url, '/json/builders/some%20builder%202/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[6].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 9);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[7].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[7].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="lines">@@ -355,7 +335,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[8].url, '/json/builders/some%20builder%202/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[8].resolve({});
</span><span class="cx">                 return syncPromise;
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), null);
</span><span class="lines">@@ -366,7 +346,7 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).statusUrl(), null);
</span><span class="cx">                 return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithTwoBuilders().triggerableName);
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'failed');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), 'http://build.webkit.org/builders/some-builder-1/builds/123');
</span><span class="lines">@@ -376,50 +356,46 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(702).statusUrl(), 'http://build.webkit.org/builders/some-builder-1/');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).statusUrl(), null);
</span><del>-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx"> 
</span><del>-        it('should update the status of a scheduled build if the pending build had started running', function (done) {
-            let db = TestServer.database();
</del><ins>+        it('should update the status of a scheduled build if the pending build had started running', () =&gt; {
+            const db = TestServer.database();
</ins><span class="cx">             let syncPromise;
</span><del>-            db.connect().then(function () {
-                return MockData.addMockData(db, ['scheduled', 'pending', 'pending', 'pending']);
-            }).then(function () {
</del><ins>+            return MockData.addMockData(db, ['scheduled', 'pending', 'pending', 'pending']).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 let config = MockData.mockTestSyncConfigWithSingleBuilder();
</span><span class="cx">                 let logger = new MockLogger;
</span><span class="cx">                 let slaveInfo = {name: 'sync-slave', password: 'password'};
</span><span class="cx">                 let triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</span><span class="cx">                 syncPromise = triggerable.syncOnce();
</span><del>-                syncPromise.catch(done);
</del><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 1);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[0].resolve([MockData.pendingBuild({buildRequestId: 700})]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 2);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[1].resolve({});
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 3);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[2].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 4);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[3].resolve({[-1]: MockData.runningBuild({buildRequestId: 700})});
</span><span class="cx">                 return syncPromise;
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'scheduled');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), null);
</span><span class="lines">@@ -430,7 +406,7 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).statusUrl(), null);
</span><span class="cx">                 return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithTwoBuilders().triggerableName);
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'running');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), 'http://build.webkit.org/builders/some-builder-1/builds/124');
</span><span class="lines">@@ -440,29 +416,25 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(702).statusUrl(), null);
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).statusUrl(), null);
</span><del>-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx"> 
</span><del>-        it('should schedule a build request on a builder without pending builds if the request belongs to a new test group', function (done) {
-            let db = TestServer.database();
</del><ins>+        it('should schedule a build request on a builder without pending builds if the request belongs to a new test group', () =&gt; {
+            const db = TestServer.database();
</ins><span class="cx">             let syncPromise;
</span><del>-            db.connect().then(function () {
-                return Promise.all([
-                    MockData.addMockData(db, ['completed', 'pending', 'pending', 'pending']),
-                    MockData.addAnotherMockTestGroup(db, ['pending', 'pending', 'pending', 'pending'])
-                ]);
-            }).then(function () {
</del><ins>+            return Promise.all([
+                MockData.addMockData(db, ['completed', 'pending', 'pending', 'pending']),
+                MockData.addAnotherMockTestGroup(db, ['pending', 'pending', 'pending', 'pending'])
+            ]).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><del>-            }).then(function () {
-                let config = MockData.mockTestSyncConfigWithTwoBuilders();
-                let logger = new MockLogger;
-                let slaveInfo = {name: 'sync-slave', password: 'password'};
-                let triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</del><ins>+            }).then(() =&gt; {
+                const config = MockData.mockTestSyncConfigWithTwoBuilders();
+                const logger = new MockLogger;
+                const slaveInfo = {name: 'sync-slave', password: 'password'};
+                const triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</ins><span class="cx">                 syncPromise = triggerable.syncOnce();
</span><del>-                syncPromise.catch(done);
</del><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 2);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="lines">@@ -471,7 +443,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some%20builder%202/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[1].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 4);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="lines">@@ -480,7 +452,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some%20builder%202/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[3].resolve({});
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 5);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].method, 'POST');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].url, '/builders/some%20builder%202/force');
</span><span class="lines">@@ -487,7 +459,7 @@
</span><span class="cx">                 assert.deepEqual(MockRemoteAPI.requests[4].data, {'wk': '191622', 'os': '10.11 15A284', 'build-request-id': '710'});
</span><span class="cx">                 MockRemoteAPI.requests[4].resolve('OK');
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 7);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[5].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[5].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="lines">@@ -496,7 +468,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[6].url, '/json/builders/some%20builder%202/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[6].resolve([MockData.pendingBuild({builder: 'some builder 2', buildRequestId: 710})]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 9);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[7].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[7].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="lines">@@ -505,7 +477,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[8].url, '/json/builders/some%20builder%202/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[8].resolve({});
</span><span class="cx">                 return syncPromise;
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 8);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'completed');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), null);
</span><span class="lines">@@ -524,7 +496,7 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(713).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(713).statusUrl(), null);
</span><span class="cx">                 return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithTwoBuilders().triggerableName);
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 8);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'completed');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), 'http://build.webkit.org/builders/some-builder-1/builds/123');
</span><span class="lines">@@ -542,29 +514,25 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(712).statusUrl(), null);
</span><span class="cx">                 assert.equal(BuildRequest.findById(713).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(713).statusUrl(), null);
</span><del>-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx"> 
</span><del>-        it('should schedule a build request on the same scheduler the first request had ran', function (done) {
-            let db = TestServer.database();
</del><ins>+        it('should schedule a build request on the same scheduler the first request had ran', () =&gt; {
+            const db = TestServer.database();
</ins><span class="cx">             let syncPromise;
</span><del>-            db.connect().then(function () {
-                return Promise.all([
-                    MockData.addMockData(db, ['running', 'pending', 'pending', 'pending']),
-                    MockData.addAnotherMockTestGroup(db, ['running', 'pending', 'pending', 'pending'])
-                ]);
-            }).then(function () {
</del><ins>+            return Promise.all([
+                MockData.addMockData(db, ['running', 'pending', 'pending', 'pending']),
+                MockData.addAnotherMockTestGroup(db, ['running', 'pending', 'pending', 'pending'])
+            ]).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><del>-            }).then(function () {
-                let config = MockData.mockTestSyncConfigWithTwoBuilders();
-                let logger = new MockLogger;
-                let slaveInfo = {name: 'sync-slave', password: 'password'};
-                let triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</del><ins>+            }).then(() =&gt; {
+                const config = MockData.mockTestSyncConfigWithTwoBuilders();
+                const logger = new MockLogger;
+                const slaveInfo = {name: 'sync-slave', password: 'password'};
+                const triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</ins><span class="cx">                 syncPromise = triggerable.syncOnce();
</span><del>-                syncPromise.catch(done);
</del><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 2);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="lines">@@ -573,7 +541,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some%20builder%202/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[1].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 4);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="lines">@@ -582,7 +550,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some%20builder%202/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[3].resolve({[-1]: MockData.runningBuild({builder: 'some builder 2', buildRequestId: 700})});
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 6);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].method, 'POST');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].url, '/builders/some%20builder%202/force');
</span><span class="lines">@@ -593,7 +561,7 @@
</span><span class="cx">                 assert.deepEqual(MockRemoteAPI.requests[5].data, {'wk': '192736', 'os': '10.11 15A284', 'build-request-id': '711'});
</span><span class="cx">                 MockRemoteAPI.requests[5].resolve('OK');
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 8);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[6].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[6].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="lines">@@ -602,7 +570,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[7].url, '/json/builders/some%20builder%202/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[7].resolve([MockData.pendingBuild({builder: 'some builder 2',buildRequestId: 701})]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 10);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[8].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[8].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="lines">@@ -611,7 +579,7 @@
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[9].url, '/json/builders/some%20builder%202/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[9].resolve({[-1]: MockData.runningBuild({builder: 'some builder 2', buildRequestId: 700})});
</span><span class="cx">                 return syncPromise;
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 8);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'running');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), null);
</span><span class="lines">@@ -630,7 +598,7 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(713).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(713).statusUrl(), null);
</span><span class="cx">                 return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithTwoBuilders().triggerableName);
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 8);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'running');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), 'http://build.webkit.org/builders/some%20builder%202/builds/124');
</span><span class="lines">@@ -648,53 +616,49 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(712).statusUrl(), null);
</span><span class="cx">                 assert.equal(BuildRequest.findById(713).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(713).statusUrl(), null);
</span><del>-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx"> 
</span><del>-        it('should recover from multiple test groups running simultenously', function (done) {
-            let db = TestServer.database();
</del><ins>+        it('should recover from multiple test groups running simultenously', () =&gt; {
+            const db = TestServer.database();
</ins><span class="cx">             let syncPromise;
</span><del>-            db.connect().then(function () {
-                return Promise.all([
-                    MockData.addMockData(db, ['completed', 'pending', 'pending', 'pending']),
-                    MockData.addAnotherMockTestGroup(db, ['completed', 'pending', 'pending', 'pending'])
-                ]);
-            }).then(function () {
</del><ins>+            return Promise.all([
+                MockData.addMockData(db, ['completed', 'pending', 'pending', 'pending']),
+                MockData.addAnotherMockTestGroup(db, ['completed', 'pending', 'pending', 'pending'])
+            ]).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><del>-            }).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);
</del><ins>+            }).then(() =&gt; {
+                const config = MockData.mockTestSyncConfigWithSingleBuilder();
+                const logger = new MockLogger;
+                const slaveInfo = {name: 'sync-slave', password: 'password'};
+                const triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</ins><span class="cx">                 syncPromise = triggerable.syncOnce();
</span><del>-                syncPromise.catch(done);
</del><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 1);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[0].resolve([MockData.pendingBuild({buildRequestId: 711})]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 2);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[1].resolve({[-1]: MockData.runningBuild({buildRequestId: 700}), [-2]: MockData.finishedBuild({buildRequestId: 710})});
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 3);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[2].resolve([MockData.pendingBuild({buildRequestId: 701})]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 4);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[3].resolve({[-1]: MockData.runningBuild({buildRequestId: 700}), [-2]: MockData.finishedBuild({buildRequestId: 710})});
</span><span class="cx">                 return syncPromise;
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 8);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'completed');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), null);
</span><span class="lines">@@ -713,7 +677,7 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(713).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(713).statusUrl(), null);
</span><span class="cx">                 return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithTwoBuilders().triggerableName);
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 8);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'completed');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), 'http://build.webkit.org/builders/some-builder-1/builds/124');
</span><span class="lines">@@ -731,40 +695,34 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(712).statusUrl(), null);
</span><span class="cx">                 assert.equal(BuildRequest.findById(713).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(713).statusUrl(), null);
</span><del>-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx"> 
</span><del>-        it('should recover from missing failed build request', function (done) {
-            let db = TestServer.database();
</del><ins>+        it('should recover from missing failed build request', () =&gt; {
+            const db = TestServer.database();
</ins><span class="cx">             let syncPromise;
</span><del>-            db.connect().then(function () {
-                return Promise.all([
-                    MockData.addMockData(db, ['failed', 'pending', 'pending', 'pending']),
-                ]);
-            }).then(function () {
</del><ins>+            return MockData.addMockData(db, ['failed', 'pending', 'pending', 'pending']).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><del>-            }).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);
</del><ins>+            }).then(() =&gt; {
+                const config = MockData.mockTestSyncConfigWithSingleBuilder();
+                const logger = new MockLogger;
+                const slaveInfo = {name: 'sync-slave', password: 'password'};
+                const triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</ins><span class="cx">                 syncPromise = triggerable.syncOnce();
</span><del>-                syncPromise.catch(done);
</del><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 1);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[0].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 2);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[1].resolve({});
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 3);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].method, 'POST');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].url, '/builders/some-builder-1/force');
</span><span class="lines">@@ -771,19 +729,19 @@
</span><span class="cx">                 assert.deepEqual(MockRemoteAPI.requests[2].data, {'wk': '192736', 'os': '10.11 15A284', 'build-request-id': '701'});
</span><span class="cx">                 MockRemoteAPI.requests[2].resolve('OK');
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 4);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[3].resolve([MockData.pendingBuild({buildRequestId: 701})]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 5);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[4].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[4].resolve({});
</span><span class="cx">                 return syncPromise;
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'failed');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), null);
</span><span class="lines">@@ -794,7 +752,7 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).statusUrl(), null);
</span><span class="cx">                 return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithTwoBuilders().triggerableName);
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'failed');
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).statusUrl(), null);
</span><span class="lines">@@ -804,50 +762,46 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(702).statusUrl(), null);
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).statusUrl(), null);
</span><del>-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx"> 
</span><del>-        it('should update the status of a supposedly scheduled build that went missing', function (done) {
-            let db = TestServer.database();
</del><ins>+        it('should update the status of a supposedly scheduled build that went missing', () =&gt; {
+            const db = TestServer.database();
</ins><span class="cx">             let syncPromise;
</span><del>-            db.connect().then(function () {
-                return MockData.addMockData(db, ['scheduled', 'pending', 'pending', 'pending']);
-            }).then(function () {
</del><ins>+            return MockData.addMockData(db, ['scheduled', 'pending', 'pending', 'pending']).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><del>-            }).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);
</del><ins>+            }).then(() =&gt; {
+                const config = MockData.mockTestSyncConfigWithSingleBuilder();
+                const logger = new MockLogger;
+                const slaveInfo = {name: 'sync-slave', password: 'password'};
+                const triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</ins><span class="cx">                 syncPromise = triggerable.syncOnce();
</span><del>-                syncPromise.catch(done);
</del><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 1);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[0].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 2);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[1].resolve({});
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 3);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[2].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 4);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[3].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[3].resolve({});
</span><span class="cx">                 return syncPromise;
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'scheduled');
</span><span class="cx">                 assert.equal(BuildRequest.findById(701).status(), 'pending');
</span><span class="lines">@@ -854,63 +808,56 @@
</span><span class="cx">                 assert.equal(BuildRequest.findById(702).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><span class="cx">                 return BuildRequest.fetchForTriggerable(MockData.mockTestSyncConfigWithTwoBuilders().triggerableName);
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(BuildRequest.all().length, 4);
</span><span class="cx">                 assert.equal(BuildRequest.findById(700).status(), 'failed');
</span><span class="cx">                 assert.equal(BuildRequest.findById(701).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(702).status(), 'pending');
</span><span class="cx">                 assert.equal(BuildRequest.findById(703).status(), 'pending');
</span><del>-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx"> 
</span><del>-        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();
</del><ins>+        it('should schedule a build request of an user created test group before ones created by automatic change detection', () =&gt; {
+            const db = TestServer.database();
</ins><span class="cx">             let syncPromise;
</span><del>-            db.connect().then(function () {
-                return Promise.all([
-                    MockData.addMockData(db, ['pending', 'pending', 'pending', 'pending']),
-                    MockData.addAnotherMockTestGroup(db, ['pending', 'pending', 'pending', 'pending'], 'rniwa'),
-                ]);
-            }).then(function () {
</del><ins>+            return Promise.all([
+                MockData.addMockData(db, ['pending', 'pending', 'pending', 'pending']),
+                MockData.addAnotherMockTestGroup(db, ['pending', 'pending', 'pending', 'pending'], 'rniwa'),
+            ]).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><del>-            }).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);
</del><ins>+            }).then(() =&gt; {
+                const config = MockData.mockTestSyncConfigWithSingleBuilder();
+                const logger = new MockLogger;
+                const slaveInfo = {name: 'sync-slave', password: 'password'};
+                const triggerable = new BuildbotTriggerable(config, TestServer.remoteAPI(), MockRemoteAPI, slaveInfo, logger);
</ins><span class="cx">                 syncPromise = triggerable.syncOnce();
</span><del>-                syncPromise.catch(done);
</del><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 1);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[0].url, '/json/builders/some-builder-1/pendingBuilds');
</span><span class="cx">                 MockRemoteAPI.requests[0].resolve([]);
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 2);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].method, 'GET');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[1].url, '/json/builders/some-builder-1/builds/?select=-1&amp;select=-2');
</span><span class="cx">                 MockRemoteAPI.requests[1].resolve({});
</span><span class="cx">                 return MockRemoteAPI.waitForRequest();
</span><del>-            }).then(function () {
</del><ins>+            }).then(() =&gt; {
</ins><span class="cx">                 assert.equal(MockRemoteAPI.requests.length, 3);
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].method, 'POST');
</span><span class="cx">                 assert.equal(MockRemoteAPI.requests[2].url, '/builders/some-builder-1/force');
</span><span class="cx">                 assert.deepEqual(MockRemoteAPI.requests[2].data, {'wk': '191622', 'os': '10.11 15A284', 'build-request-id': '710'});
</span><span class="cx">                 MockRemoteAPI.requests[2].resolve('OK');
</span><del>-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx">     });
</span><span class="cx"> 
</span><del>-    describe('updateTriggerables', function () {
-        connectToDatabaseInEveryTest();
-
-        it('should update available triggerables', function (done) {
-            let db = TestServer.database();
-            MockData.addMockData(db).then(() =&gt; {
</del><ins>+    describe('updateTriggerables', () =&gt; {
+        it('should update available triggerables', () =&gt; {
+            const db = TestServer.database();
+            return MockData.addMockData(db).then(() =&gt; {
</ins><span class="cx">                 return Manifest.fetch();
</span><span class="cx">             }).then(() =&gt; {
</span><span class="cx">                 return db.selectAll('triggerable_configurations', 'test');
</span><span class="lines">@@ -949,9 +896,7 @@
</span><span class="cx">                 let platform = Platform.findById(MockData.somePlatformId());
</span><span class="cx">                 let triggerable = Triggerable.findByTestConfiguration(test, platform);
</span><span class="cx">                 assert.equal(triggerable.name(), 'build-webkit');
</span><del>-
-                done();
-            }).catch(done);
</del><ins>+            });
</ins><span class="cx">         });
</span><span class="cx">     });
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>