haikuwebkit/Websites/perf.webkit.org/server-tests/api-test-groups.js

188 lines
12 KiB
JavaScript
Raw Permalink Normal View History

Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
'use strict';
const assert = require('assert');
const MockData = require('./resources/mock-data.js');
const TestServer = require('./resources/test-server.js');
const prepareServerTest = require('./resources/common-operations.js').prepareServerTest;
describe('/api/test-groups', function () {
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
prepareServerTest(this, 'node');
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
describe('/api/test-groups/ready-for-notification', () => {
it('should give an empty list if there is not existing test group at all', async () => {
const content = await TestServer.remoteAPI().getJSON('/api/test-groups/ready-for-notification');
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(content.status, 'OK');
assert.deepStrictEqual(content.testGroups, []);
assert.deepStrictEqual(content.buildRequests, []);
assert.deepStrictEqual(content.commitSets, []);
assert.deepStrictEqual(content.commits, []);
assert.deepStrictEqual(content.uploadedFiles, []);
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
});
it('should not include a test group with "canceled" state in at least one build request', async () => {
await MockData.addMockData(TestServer.database(), ['completed', 'completed', 'completed', 'canceled']);
const content = await TestServer.remoteAPI().getJSON('/api/test-groups/ready-for-notification');
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(content.status, 'OK');
assert.deepStrictEqual(content.testGroups, []);
assert.deepStrictEqual(content.buildRequests, []);
assert.deepStrictEqual(content.commitSets, []);
assert.deepStrictEqual(content.commits, []);
assert.deepStrictEqual(content.uploadedFiles, []);
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
});
it('should list all test groups with pending notification', async () => {
await MockData.addMockData(TestServer.database(), ['completed', 'completed', 'completed', 'completed']);
const content = await TestServer.remoteAPI().getJSON('/api/test-groups/ready-for-notification');
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(content.testGroups.length, 1);
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
const testGroup = content.testGroups[0];
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(parseInt(testGroup.id), 600);
assert.strictEqual(parseInt(testGroup.task), 500);
assert.strictEqual(testGroup.name, 'some test group');
assert.strictEqual(testGroup.author, null);
assert.strictEqual(testGroup.hidden, false);
assert.strictEqual(testGroup.needsNotification, true);
assert.strictEqual(parseInt(testGroup.platform), 65);
assert.deepStrictEqual(testGroup.buildRequests, ['700','701', '702', '703']);
assert.deepStrictEqual(testGroup.commitSets, ['401', '402', '401', '402']);
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
});
it('should not list hidden test group', async () => {
const database = TestServer.database();
await MockData.addMockData(database, ['completed', 'completed', 'completed', 'completed']);
await database.query('UPDATE analysis_test_groups SET testgroup_hidden = TRUE WHERE testgroup_id = 600');
const content = await TestServer.remoteAPI().getJSON('/api/test-groups/ready-for-notification');
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(content.status, 'OK');
assert.deepStrictEqual(content.testGroups, []);
assert.deepStrictEqual(content.buildRequests, []);
assert.deepStrictEqual(content.commitSets, []);
assert.deepStrictEqual(content.commits, []);
assert.deepStrictEqual(content.uploadedFiles, []);
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
});
it('should not list test groups without needs notification flag', async () => {
const database = TestServer.database();
await MockData.addMockData(database, ['completed', 'completed', 'completed', 'completed']);
await database.query('UPDATE analysis_test_groups SET testgroup_needs_notification = FALSE WHERE testgroup_id = 600');
const content = await TestServer.remoteAPI().getJSON('/api/test-groups/ready-for-notification');
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(content.status, 'OK');
assert.deepStrictEqual(content.testGroups, []);
assert.deepStrictEqual(content.buildRequests, []);
assert.deepStrictEqual(content.commitSets, []);
assert.deepStrictEqual(content.commits, []);
assert.deepStrictEqual(content.uploadedFiles, []);
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
});
it('should not list a test group that has some incompleted build requests', async () => {
const database = TestServer.database();
await MockData.addMockData(database, ['completed', 'completed', 'completed', 'running']);
const content = await TestServer.remoteAPI().getJSON('/api/test-groups/ready-for-notification');
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(content.status, 'OK');
assert.deepStrictEqual(content.testGroups, []);
assert.deepStrictEqual(content.buildRequests, []);
assert.deepStrictEqual(content.commitSets, []);
assert.deepStrictEqual(content.commits, []);
assert.deepStrictEqual(content.uploadedFiles, []);
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
});
});
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
describe('/api/test-groups/<triggerables>', () => {
it('should set "testgroup_may_need_more_requests" when a build request is set to "failed" due to "failedIfNotCompleted"', async () => {
const database = TestServer.database();
await MockData.addMockData(database, ['completed', 'completed', 'completed', 'running']);
let data = await TestServer.remoteAPI().getJSON('/api/test-groups/600');
assert.ok(!data['testGroups'][0].mayNeedMoreRequests);
[perf dashboard] Remove non-inclusive words from perf dashboard. https://bugs.webkit.org/show_bug.cgi?id=223505 Reviewed by Ryosuke Niwa. Removed most of non-inclusive terminology and replaced it with 'worker'. Make impacted APIs backward compatible during transition. The non-inclusive terminology will be removed after transition. * ReadMe.md: Removed non-inclusive words. * init-database.sql: Rename tables with non-inclusive words. * migrate-database.sql: Added migration SQL for existing database. * public/admin/build-workers.php: Renamed from Websites/perf.webkit.org/public/admin/build-slaves.php. * public/api/build-requests.php: * public/api/measurement-set.php: * public/api/report-commits.php: * public/api/runs.php: * public/api/update-triggerable.php: * public/api/upload-root.php: * public/include/admin-header.php: * public/include/json-header.php: * public/include/report-processor.php: * public/privileged-api/add-build-requests.php: * public/privileged-api/create-analysis-task.php: * public/privileged-api/create-test-group.php: * public/privileged-api/update-test-group.php: * public/v2/js/ember.js: * server-tests/api-build-requests-tests.js: * server-tests/api-commits-tests.js: * server-tests/api-report-commits-tests.js: * server-tests/api-report-tests.js: (emptyReport): (reportWitMismatchingCommitTime): (reportWithOneSecondCommitTimeDifference): (emptyWorkerReport): (emptySlaveReport): Deleted. * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (updateWithOSXRepositoryGroup): (updateWithMacWebKitRepositoryGroups): * server-tests/api-upload-root-tests.js: (makeReport): (addWorkerAndCreateRootFile): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (async addTriggerableAndCreateTask): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): (async addTriggerableAndCreateTask): * server-tests/resources/common-operations.js: * server-tests/resources/mock-data.js: (MockData.addMockConfiguration): (MockData.set mockTestSyncConfigWithSingleBuilder): (MockData.sampleBuildData): * server-tests/resources/test-server.js: (TestServer.prototype.testConfig): * server-tests/tools-buildbot-triggerable-tests.js: * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (createTriggerable): * tools/detect-changes.js: (loadServerConfig): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.buildTag): (BuildbotSyncer): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer.prototype.scheduleRequestInGroupIfAvailable): (BuildbotSyncer.prototype.pullBuildbot): (BuildbotSyncer._loadConfig): (BuildbotSyncer._validateAndMergeConfig): (BuildbotBuildEntry.prototype.slaveName): Deleted. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable): (BuildbotTriggerable.prototype.updateTriggerable): (BuildbotTriggerable.prototype.async syncOnce): (BuildbotTriggerable.prototype.async _scheduleRequest): (BuildbotTriggerable.prototype._scheduleRequestIfWorkerIsAvailable): (BuildbotTriggerable.prototype._scheduleRequestWithLog): (BuildbotTriggerable._testGroupMapForBuildRequests): (BuildbotTriggerable.prototype._scheduleRequestIfSlaveIsAvailable): Deleted. * tools/js/database.js: * tools/js/os-build-fetcher.js: (prototype.async _reportCommits): * tools/js/privileged-api.js: (NodePrivilegedAPI.prototype.sendRequest): (NodePrivilegedAPI.configure): (NodePrivilegedAPI): * tools/pull-os-versions.py: (OSBuildFetcher.fetch_and_report_new_builds): * tools/run-analysis.js: (async analysisLoop): * tools/sync-buildbot.js: (syncLoop.const.makeTriggerable): (syncLoop): * tools/sync-commits.py: (Repository.fetch_commits_and_submit): * tools/sync-os-versions.js: (syncLoop): * tools/util.py: (submit_commits): * unit-tests/analysis-task-tests.js: * unit-tests/buildbot-syncer-tests.js: (sampleiOSConfig): (sampleBuildData): (async const): * unit-tests/checkconfig.js: * unit-tests/measurement-set-analyzer-tests.js: * unit-tests/privileged-api-tests.js: * unit-tests/retry-failed-build-requests-tests.js: * unit-tests/test-groups-tests.js: Canonical link: https://commits.webkit.org/235601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274800 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-22 21:23:38 +00:00
await TestServer.remoteAPI().postJSON('/api/build-requests/build-webkit', {workerName: 'test', workerPassword: 'password',
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
buildRequestUpdates: {703: {status: 'failedIfNotCompleted', url: 'http://webkit.org/build/1'}}});
data = await TestServer.remoteAPI().getJSON('/api/test-groups/600');
assert.ok(data['testGroups'][0].mayNeedMoreRequests);
});
it('should set "testgroup_may_need_more_requests" when a build request is set to "failed"', async () => {
const database = TestServer.database();
await MockData.addMockData(database, ['completed', 'completed', 'completed', 'running']);
let data = await TestServer.remoteAPI().getJSON('/api/test-groups/600');
assert.ok(!data['testGroups'][0].mayNeedMoreRequests);
[perf dashboard] Remove non-inclusive words from perf dashboard. https://bugs.webkit.org/show_bug.cgi?id=223505 Reviewed by Ryosuke Niwa. Removed most of non-inclusive terminology and replaced it with 'worker'. Make impacted APIs backward compatible during transition. The non-inclusive terminology will be removed after transition. * ReadMe.md: Removed non-inclusive words. * init-database.sql: Rename tables with non-inclusive words. * migrate-database.sql: Added migration SQL for existing database. * public/admin/build-workers.php: Renamed from Websites/perf.webkit.org/public/admin/build-slaves.php. * public/api/build-requests.php: * public/api/measurement-set.php: * public/api/report-commits.php: * public/api/runs.php: * public/api/update-triggerable.php: * public/api/upload-root.php: * public/include/admin-header.php: * public/include/json-header.php: * public/include/report-processor.php: * public/privileged-api/add-build-requests.php: * public/privileged-api/create-analysis-task.php: * public/privileged-api/create-test-group.php: * public/privileged-api/update-test-group.php: * public/v2/js/ember.js: * server-tests/api-build-requests-tests.js: * server-tests/api-commits-tests.js: * server-tests/api-report-commits-tests.js: * server-tests/api-report-tests.js: (emptyReport): (reportWitMismatchingCommitTime): (reportWithOneSecondCommitTimeDifference): (emptyWorkerReport): (emptySlaveReport): Deleted. * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (updateWithOSXRepositoryGroup): (updateWithMacWebKitRepositoryGroups): * server-tests/api-upload-root-tests.js: (makeReport): (addWorkerAndCreateRootFile): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (async addTriggerableAndCreateTask): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): (async addTriggerableAndCreateTask): * server-tests/resources/common-operations.js: * server-tests/resources/mock-data.js: (MockData.addMockConfiguration): (MockData.set mockTestSyncConfigWithSingleBuilder): (MockData.sampleBuildData): * server-tests/resources/test-server.js: (TestServer.prototype.testConfig): * server-tests/tools-buildbot-triggerable-tests.js: * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (createTriggerable): * tools/detect-changes.js: (loadServerConfig): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.buildTag): (BuildbotSyncer): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer.prototype.scheduleRequestInGroupIfAvailable): (BuildbotSyncer.prototype.pullBuildbot): (BuildbotSyncer._loadConfig): (BuildbotSyncer._validateAndMergeConfig): (BuildbotBuildEntry.prototype.slaveName): Deleted. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable): (BuildbotTriggerable.prototype.updateTriggerable): (BuildbotTriggerable.prototype.async syncOnce): (BuildbotTriggerable.prototype.async _scheduleRequest): (BuildbotTriggerable.prototype._scheduleRequestIfWorkerIsAvailable): (BuildbotTriggerable.prototype._scheduleRequestWithLog): (BuildbotTriggerable._testGroupMapForBuildRequests): (BuildbotTriggerable.prototype._scheduleRequestIfSlaveIsAvailable): Deleted. * tools/js/database.js: * tools/js/os-build-fetcher.js: (prototype.async _reportCommits): * tools/js/privileged-api.js: (NodePrivilegedAPI.prototype.sendRequest): (NodePrivilegedAPI.configure): (NodePrivilegedAPI): * tools/pull-os-versions.py: (OSBuildFetcher.fetch_and_report_new_builds): * tools/run-analysis.js: (async analysisLoop): * tools/sync-buildbot.js: (syncLoop.const.makeTriggerable): (syncLoop): * tools/sync-commits.py: (Repository.fetch_commits_and_submit): * tools/sync-os-versions.js: (syncLoop): * tools/util.py: (submit_commits): * unit-tests/analysis-task-tests.js: * unit-tests/buildbot-syncer-tests.js: (sampleiOSConfig): (sampleBuildData): (async const): * unit-tests/checkconfig.js: * unit-tests/measurement-set-analyzer-tests.js: * unit-tests/privileged-api-tests.js: * unit-tests/retry-failed-build-requests-tests.js: * unit-tests/test-groups-tests.js: Canonical link: https://commits.webkit.org/235601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274800 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-22 21:23:38 +00:00
await TestServer.remoteAPI().postJSON('/api/build-requests/build-webkit', {workerName: 'test', workerPassword: 'password',
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
buildRequestUpdates: {703: {status: 'failed', url: 'http://webkit.org/build/1'}}});
data = await TestServer.remoteAPI().getJSON('/api/test-groups/600');
assert.ok(data['testGroups'][0].mayNeedMoreRequests);
});
it('should set "testgroup_may_need_more_requests" to all test groups those have failed build request', async () => {
const database = TestServer.database();
await MockData.addMockData(database, ['completed', 'completed', 'completed', 'running']);
await MockData.addAnotherMockTestGroup(database, ['completed', 'completed', 'completed', 'running'], 'webkit');
let data = await TestServer.remoteAPI().getJSON('/api/test-groups/600');
assert.ok(!data['testGroups'][0].mayNeedMoreRequests);
data = await TestServer.remoteAPI().getJSON('/api/test-groups/601');
assert.ok(!data['testGroups'][0].mayNeedMoreRequests);
[perf dashboard] Remove non-inclusive words from perf dashboard. https://bugs.webkit.org/show_bug.cgi?id=223505 Reviewed by Ryosuke Niwa. Removed most of non-inclusive terminology and replaced it with 'worker'. Make impacted APIs backward compatible during transition. The non-inclusive terminology will be removed after transition. * ReadMe.md: Removed non-inclusive words. * init-database.sql: Rename tables with non-inclusive words. * migrate-database.sql: Added migration SQL for existing database. * public/admin/build-workers.php: Renamed from Websites/perf.webkit.org/public/admin/build-slaves.php. * public/api/build-requests.php: * public/api/measurement-set.php: * public/api/report-commits.php: * public/api/runs.php: * public/api/update-triggerable.php: * public/api/upload-root.php: * public/include/admin-header.php: * public/include/json-header.php: * public/include/report-processor.php: * public/privileged-api/add-build-requests.php: * public/privileged-api/create-analysis-task.php: * public/privileged-api/create-test-group.php: * public/privileged-api/update-test-group.php: * public/v2/js/ember.js: * server-tests/api-build-requests-tests.js: * server-tests/api-commits-tests.js: * server-tests/api-report-commits-tests.js: * server-tests/api-report-tests.js: (emptyReport): (reportWitMismatchingCommitTime): (reportWithOneSecondCommitTimeDifference): (emptyWorkerReport): (emptySlaveReport): Deleted. * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (updateWithOSXRepositoryGroup): (updateWithMacWebKitRepositoryGroups): * server-tests/api-upload-root-tests.js: (makeReport): (addWorkerAndCreateRootFile): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (async addTriggerableAndCreateTask): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): (async addTriggerableAndCreateTask): * server-tests/resources/common-operations.js: * server-tests/resources/mock-data.js: (MockData.addMockConfiguration): (MockData.set mockTestSyncConfigWithSingleBuilder): (MockData.sampleBuildData): * server-tests/resources/test-server.js: (TestServer.prototype.testConfig): * server-tests/tools-buildbot-triggerable-tests.js: * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (createTriggerable): * tools/detect-changes.js: (loadServerConfig): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.buildTag): (BuildbotSyncer): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer.prototype.scheduleRequestInGroupIfAvailable): (BuildbotSyncer.prototype.pullBuildbot): (BuildbotSyncer._loadConfig): (BuildbotSyncer._validateAndMergeConfig): (BuildbotBuildEntry.prototype.slaveName): Deleted. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable): (BuildbotTriggerable.prototype.updateTriggerable): (BuildbotTriggerable.prototype.async syncOnce): (BuildbotTriggerable.prototype.async _scheduleRequest): (BuildbotTriggerable.prototype._scheduleRequestIfWorkerIsAvailable): (BuildbotTriggerable.prototype._scheduleRequestWithLog): (BuildbotTriggerable._testGroupMapForBuildRequests): (BuildbotTriggerable.prototype._scheduleRequestIfSlaveIsAvailable): Deleted. * tools/js/database.js: * tools/js/os-build-fetcher.js: (prototype.async _reportCommits): * tools/js/privileged-api.js: (NodePrivilegedAPI.prototype.sendRequest): (NodePrivilegedAPI.configure): (NodePrivilegedAPI): * tools/pull-os-versions.py: (OSBuildFetcher.fetch_and_report_new_builds): * tools/run-analysis.js: (async analysisLoop): * tools/sync-buildbot.js: (syncLoop.const.makeTriggerable): (syncLoop): * tools/sync-commits.py: (Repository.fetch_commits_and_submit): * tools/sync-os-versions.js: (syncLoop): * tools/util.py: (submit_commits): * unit-tests/analysis-task-tests.js: * unit-tests/buildbot-syncer-tests.js: (sampleiOSConfig): (sampleBuildData): (async const): * unit-tests/checkconfig.js: * unit-tests/measurement-set-analyzer-tests.js: * unit-tests/privileged-api-tests.js: * unit-tests/retry-failed-build-requests-tests.js: * unit-tests/test-groups-tests.js: Canonical link: https://commits.webkit.org/235601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274800 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-22 21:23:38 +00:00
await TestServer.remoteAPI().postJSON('/api/build-requests/build-webkit', {workerName: 'test', workerPassword: 'password',
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
buildRequestUpdates: {
703: {status: 'failed', url: 'http://webkit.org/build/1'},
713: {status: 'failedIfNotCompleted', url: 'http://webkit.org/build/11'},
}});
data = await TestServer.remoteAPI().getJSON('/api/test-groups/600');
assert.ok(data['testGroups'][0].mayNeedMoreRequests);
data = await TestServer.remoteAPI().getJSON('/api/test-groups/601');
assert.ok(data['testGroups'][0].mayNeedMoreRequests);
});
});
describe('/api/test-groups/need-more-requests', () => {
it('should list all test groups potentially need additional build requests', async () => {
await MockData.addMockData(TestServer.database(), ['completed', 'completed', 'failed', 'completed'], false);
await TestServer.database().query('UPDATE analysis_test_groups SET testgroup_may_need_more_requests = TRUE WHERE testgroup_id = 600');
const content = await TestServer.remoteAPI().getJSON('/api/test-groups/need-more-requests');
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(content.testGroups.length, 1);
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
const testGroup = content.testGroups[0];
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(parseInt(testGroup.id), 600);
assert.strictEqual(parseInt(testGroup.task), 500);
assert.strictEqual(testGroup.name, 'some test group');
assert.strictEqual(testGroup.author, null);
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
assert.ok(!testGroup.hidden);
assert.ok(!testGroup.needsNotification);
assert.ok(testGroup.mayNeedMoreRequests);
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(parseInt(testGroup.platform), 65);
assert.deepStrictEqual(testGroup.buildRequests, ['700','701', '702', '703']);
assert.deepStrictEqual(testGroup.commitSets, ['401', '402', '401', '402']);
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
});
it('should list all test groups may need additional build requests', async () => {
await MockData.addMockData(TestServer.database(), ['completed', 'completed', 'completed', 'completed']);
await MockData.addAnotherMockTestGroup(TestServer.database(), ['completed', 'completed', 'failed', 'completed'], 'webkit');
await TestServer.database().query('UPDATE analysis_test_groups SET testgroup_may_need_more_requests = TRUE WHERE testgroup_id = 600');
await TestServer.database().query('UPDATE analysis_test_groups SET testgroup_may_need_more_requests = TRUE WHERE testgroup_id = 601');
const content = await TestServer.remoteAPI().getJSON('/api/test-groups/need-more-requests');
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(content.testGroups.length, 2);
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
const oneTestGroup = content.testGroups[0];
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(parseInt(oneTestGroup.id), 600);
assert.strictEqual(parseInt(oneTestGroup.task), 500);
assert.strictEqual(oneTestGroup.name, 'some test group');
assert.strictEqual(oneTestGroup.author, null);
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
assert.ok(!oneTestGroup.hidden);
assert.ok(oneTestGroup.needsNotification);
assert.ok(oneTestGroup.mayNeedMoreRequests);
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(parseInt(oneTestGroup.platform), 65);
assert.deepStrictEqual(oneTestGroup.buildRequests, ['700','701', '702', '703']);
assert.deepStrictEqual(oneTestGroup.commitSets, ['401', '402', '401', '402']);
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
const anotherTestGroup = content.testGroups[1];
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(parseInt(anotherTestGroup.id), 601);
assert.strictEqual(parseInt(anotherTestGroup.task), 500);
assert.strictEqual(anotherTestGroup.name, 'another test group');
assert.strictEqual(anotherTestGroup.author, 'webkit');
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
assert.ok(!anotherTestGroup.hidden);
assert.ok(!anotherTestGroup.needsNotification);
assert.ok(anotherTestGroup.mayNeedMoreRequests);
Make server test run with new node version https://bugs.webkit.org/show_bug.cgi?id=222463 Change assert.equal to assert.strictEqual since node deprecated this API Add a new function console.assert to make sure it will throw an error Reviewed by Ryosuke Niwa. * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): (Repository): * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-commits-tests.js: (assertCommitIsSameAsOneSubmitted): (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-manifest-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/api-measurement-set-tests.js: * server-tests/api-report-commits-tests.js: (emptyReport.then): (async initialReportCommits): (async setUpTestsWithExpectedStatus): (async testWithExpectedFailure): * server-tests/api-report-tests.js: (emptyReport.then): * server-tests/api-test-groups.js: * server-tests/api-update-triggerable-tests.js: (update.then): (then.response.db.selectAll.string_appeared_here.then): (then.db.selectAll.string_appeared_here.then): (then.Manifest.fetch.then): * server-tests/api-upload-root-tests.js: * server-tests/api-uploaded-file-tests.js: (return.TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/privileged-api-add-build-requests-tests.js: (async createAnalysisTask): (const.commitSet.of.updatedGroups.0.requestedCommitSets): * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): (return.createAnalysisTask.string_appeared_here.then): (return.addTriggerableAndCreateTask.string_appeared_here.then): (string_appeared_here.then): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async createAnalysisTask): * server-tests/privileged-api-upload-file-tests.js: (TestServer.testConfig.uploadFileLimitInMB.1.then): * server-tests/resources/common-operations.js: (async assertThrows): * server-tests/resources/temporary-file.js: (TemporaryFile.makeTemporaryFileOfSizeInMB): * server-tests/tools-buildbot-triggerable-tests.js: (assertRequestAndResolve): (then.refetchManifest.then): (getBuilderNameToIDMapPromise.then): * server-tests/tools-os-build-fetcher-tests.js: * server-tests/tools-sync-buildbot-integration-tests.js: (assertAndResolveRequest): * tools/js/assert-override.js: Added. (makeConsoleAssertThrow): * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): (BuildbotBuildEntry): (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer._loadConfig): (BuildbotSyncer._parseRepositoryGroup): (BuildbotSyncer._validateAndMergeConfig): (BuildbotSyncer): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._validateRequests): * tools/js/markup-component.js: (const.MarkupDocument.new.MarkupDocument.prototype._idForClone): (const.MarkupDocument.new.MarkupDocument.prototype.markup): * tools/js/os-build-fetcher.js: (prototype._addOwnedCommitsForBuild): * tools/js/remote.js: (NodeRemoteAPI.prototype.configure): * tools/js/v3-models.js: * unit-tests/commit-set-tests.js: Canonical link: https://commits.webkit.org/234972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 14:31:56 +00:00
assert.strictEqual(parseInt(anotherTestGroup.platform), 65);
assert.deepStrictEqual(anotherTestGroup.buildRequests, ['710','711', '712', '713']);
assert.deepStrictEqual(anotherTestGroup.commitSets, ['401', '402', '401', '402']);
Add retry for test groups with failed build requests. https://bugs.webkit.org/show_bug.cgi?id=190188 Reviewed by Ryosuke Niwa. Added retry logic in run-analysis script. Current retry logic will only be triggered when there is at least one successful build request for each commit set in a test group. * init-database.sql: Added 'testgroup_initial_repetition_count' and 'testgroup_may_need_more_requests'. SQL to update existing database: ''' BEGIN; ALTER TABLE analysis_test_groups ADD COLUMN testgroup_initial_repetition_count integer DEFAULT NULL, ADD COLUMN testgroup_may_need_more_requests boolean DEFAULT FALSE; UPDATE analysis_test_groups SET testgroup_initial_repetition_count = ( SELECT DISTINCT(COUNT(*)) FROM build_requests WHERE request_group = testgroup_id AND request_order >= 0 GROUP BY request_commit_set ); ALTER TABLE analysis_test_groups ALTER COLUMN testgroup_initial_repetition_count DROP DEFAULT, ALTER COLUMN testgroup_may_need_more_requests SET NOT NULL; END; ''' 'testgroup_initial_repetition_count' represents the number of successful build request for each commit set when test group is created. 'testgroup_may_need_more_requests' will be set when any build request in test group is set to 'failed'. * public/api/build-requests.php: Added the logic to set 'testgroup_may_need_more_requests'. * public/api/test-groups.php: Updated 'ready-for-notification' to 'ready-for-further-processing' so that it returns finished test groups those either have 'needs_notification' or 'may_need_more_requests' set. * public/include/commit-sets-helpers.php: Set 'initial_repetition_count' to repetition count. * public/privileged-api/update-test-group.php: Added APIs to add build request for a test group and update 'may_need_more_requests' flag. * public/v3/models/test-group.js: (TestGroup): Added '_mayNeedMoreRequests' and '_initialRepetitionCount' field. Refactored code that interacts with '/api/update-test-group'. (TestGroup.prototype.updateSingleton): (TestGroup.prototype.mayNeedMoreRequests): (TestGroup.prototype.initialRepetitionCount): (TestGroup.prototype.async._updateBuildRequest): (TestGroup.prototype.updateName): (TestGroup.prototype.updateHiddenFlag): (TestGroup.prototype.async.didSendNotification): (TestGroup.prototype.async.addMoreBuildRequests): (TestGroup.prototype.async.clearMayNeedMoreBuildRequests): Added API to clear 'may_need_more_requests' flag. (TestGroup.fetchAllReadyForFurtherProcessing): Refactored 'TestGroup.fetchAllWithNotificationReady' to return test groups either have 'needs_notification' or 'may_need_more_requests' set. (TestGroup.fetchAllThatMayNeedMoreRequests): Fetches test groups those may need more build requests. * server-tests/api-test-groups.js: Added unit tests. * server-tests/privileged-api-add-build-requests-tests.js: Added unit tests for 'add-build-requests' API. * server-tests/privileged-api-update-test-group-tests.js: Added unit tests. * server-tests/resources/mock-data.js: (MockData.addMockData): * server-tests/resources/test-server.js: (TestServer.prototype._determinePgsqlDirectory): Fixed a bug that 'childProcess.execFileSync' may return a buffer. * tools/run-analysis.js: Added logic to add extra build request before sennding notification. * tools/js/retry-failed-build-requests.js: (async.createAdditionalBuildRequestsForTestGroupsWithFailedRequests): Module that add extra build requests. * unit-tests/retry-failed-build-requests-tests.js: Added. * unit-tests/test-groups-tests.js: Added unit tests. Canonical link: https://commits.webkit.org/205257@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 00:17:49 +00:00
});
});
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
});