Fix perf dashboard tests for node v8
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Jan 2018 06:06:50 +0000 (06:06 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Jan 2018 06:06:50 +0000 (06:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181782

Reviewed by Wenson Hsieh.

Fixed the various tests for node.js v8, which is the latest LTS version.

* server-tests/api-manifest-tests.js: Replaced the missing Triggerable.acceptsTest by Triggerable.acceptedTests
after r226836.
* server-tests/api-measurement-set-tests.js: Added "Z" to the end timestamps to force UTF timezone now that Date
in node.js parses using the local timezone by default.
* server-tests/resources/test-server.js:
(TestServer.prototype._restoreDataDirectory): Fixed the bug that this function was erroneously using the async
function to rename a directory per new warnings. This code was racy, and it used to cause a test error occasionally.
* server-tests/tools-os-build-fetcher-tests.js: Fixed the assertions to make it work in the latest node.js.
* unit-tests/measurement-set-tests.js:
(waitForMeasurementSet): Wait for setTimeout to cycle through all microtasks instead of just two microtask cycles.

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

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/server-tests/api-manifest-tests.js
Websites/perf.webkit.org/server-tests/api-measurement-set-tests.js
Websites/perf.webkit.org/server-tests/resources/test-server.js
Websites/perf.webkit.org/server-tests/tools-os-build-fetcher-tests.js
Websites/perf.webkit.org/unit-tests/measurement-set-tests.js

index 152380c..c554eea 100644 (file)
@@ -1,3 +1,23 @@
+2018-01-17  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Fix perf dashboard tests for node v8
+        https://bugs.webkit.org/show_bug.cgi?id=181782
+
+        Reviewed by Wenson Hsieh.
+
+        Fixed the various tests for node.js v8, which is the latest LTS version.
+
+        * server-tests/api-manifest-tests.js: Replaced the missing Triggerable.acceptsTest by Triggerable.acceptedTests
+        after r226836.
+        * server-tests/api-measurement-set-tests.js: Added "Z" to the end timestamps to force UTF timezone now that Date
+        in node.js parses using the local timezone by default.
+        * server-tests/resources/test-server.js:
+        (TestServer.prototype._restoreDataDirectory): Fixed the bug that this function was erroneously using the async
+        function to rename a directory per new warnings. This code was racy, and it used to cause a test error occasionally.
+        * server-tests/tools-os-build-fetcher-tests.js: Fixed the assertions to make it work in the latest node.js.
+        * unit-tests/measurement-set-tests.js:
+        (waitForMeasurementSet): Wait for setTimeout to cycle through all microtasks instead of just two microtask cycles.
+
 2018-01-11  Ryosuke Niwa  <rniwa@webkit.org>
 
         Cannot trigger Dromaeo tests on internal perf try bots
index 20af381..9a895e4 100644 (file)
@@ -383,7 +383,7 @@ describe('/api/manifest', function () {
 
             const macTriggerable = Triggerable.findByTestConfiguration(someTest, sierra);
             assert.equal(macTriggerable.name(), 'mac-build.webkit.org');
-            assert(macTriggerable.acceptsTest(someTest));
+            assert(macTriggerable.acceptedTests().has(someTest));
 
             const groups = macTriggerable.repositoryGroups();
             assert.deepEqual(groups.length, 2);
index 588c472..7ab4089 100644 (file)
@@ -65,7 +65,7 @@ describe("/api/measurement-set", function () {
 
     const reportWithRevision = [{
         "buildNumber": "124",
-        "buildTime": "2013-02-28T15:34:51",
+        "buildTime": "2013-02-28T15:34:51Z",
         "revisions": {
             "WebKit": {
                 "revision": "144000",
@@ -87,7 +87,7 @@ describe("/api/measurement-set", function () {
 
     const reportWithNewRevision = [{
         "buildNumber": "125",
-        "buildTime": "2013-02-28T21:45:17",
+        "buildTime": "2013-02-28T21:45:17Z",
         "revisions": {
             "WebKit": {
                 "revision": "160609",
@@ -109,7 +109,7 @@ describe("/api/measurement-set", function () {
 
     const reportWithAncentRevision = [{
         "buildNumber": "126",
-        "buildTime": "2013-02-28T23:07:25",
+        "buildTime": "2013-02-28T23:07:25Z",
         "revisions": {
             "WebKit": {
                 "revision": "137793",
index 87bee45..a76d194 100644 (file)
@@ -107,7 +107,7 @@ class TestServer {
     {
         childProcess.execFileSync('rm', ['-rf', this._dataDirectory]);
         if (this._backupDataPath)
-            fs.rename(this._backupDataPath, this._dataDirectory);
+            fs.renameSync(this._backupDataPath, this._dataDirectory);
     }
 
     cleanDataDirectory()
index a4c62cb..efb11c0 100644 (file)
@@ -109,15 +109,15 @@ describe('OSBuildFetcher', function() {
 
         it('should throw assertion error when given a invalid revision', () => {
             const fetcher = new OSBuildFetcher({});
-            assert.throws(() => fetcher._computeOrder('invalid'), (error) => error.name == 'AssertionError');
-            assert.throws(() => fetcher._computeOrder(''), (error) => error.name == 'AssertionError');
-            assert.throws(() => fetcher._computeOrder('16'), (error) => error.name == 'AssertionError');
-            assert.throws(() => fetcher._computeOrder('16D'), (error) => error.name == 'AssertionError');
-            assert.throws(() => fetcher._computeOrder('123'), (error) => error.name == 'AssertionError');
-            assert.throws(() => fetcher._computeOrder('D123'), (error) => error.name == 'AssertionError');
-            assert.throws(() => fetcher._computeOrder('123z'), (error) => error.name == 'AssertionError');
-            assert.throws(() => fetcher._computeOrder('16[163'), (error) => error.name == 'AssertionError');
-            assert.throws(() => fetcher._computeOrder('16D163['), (error) => error.name == 'AssertionError');
+            assert.throws(() => fetcher._computeOrder('invalid'), 'AssertionError [ERR_ASSERTION]');
+            assert.throws(() => fetcher._computeOrder(''), 'AssertionError [ERR_ASSERTION]');
+            assert.throws(() => fetcher._computeOrder('16'), 'AssertionError [ERR_ASSERTION]');
+            assert.throws(() => fetcher._computeOrder('16D'), 'AssertionError [ERR_ASSERTION]');
+            assert.throws(() => fetcher._computeOrder('123'), 'AssertionError [ERR_ASSERTION]');
+            assert.throws(() => fetcher._computeOrder('D123'), 'AssertionError [ERR_ASSERTION]');
+            assert.throws(() => fetcher._computeOrder('123z'), 'AssertionError [ERR_ASSERTION]');
+            assert.throws(() => fetcher._computeOrder('16[163'), 'AssertionError [ERR_ASSERTION]');
+            assert.throws(() => fetcher._computeOrder('16D163['), 'AssertionError [ERR_ASSERTION]');
         })
     });
 
@@ -206,7 +206,7 @@ describe('OSBuildFetcher', function() {
                     assert(false, 'should never be reached');
                 }, (error_output) => {
                     assert(error_output);
-                    assert.equal(error_output.name, 'AssertionError');
+                    assert.equal(error_output.name, 'AssertionError [ERR_ASSERTION]');
                 });
             });
         })
index dd28a07..1b2fab1 100644 (file)
@@ -18,11 +18,7 @@ describe('MeasurementSet', () => {
 
     function waitForMeasurementSet()
     {
-        return Promise.resolve().then(() => {
-            return Promise.resolve();
-        }).then(() => {
-            return Promise.resolve();
-        });
+        return new Promise((resolve) => setTimeout(resolve, 0));
     }
 
     describe('findSet', () => {