Skip to content

Commit 79e0c69

Browse files
committed
add automation service field to TestPlanRun model
1 parent 98776c1 commit 79e0c69

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

server/controllers/AutomationController.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ const {
1818
findOrCreateBrowserVersion
1919
} = require('../models/services/BrowserService');
2020
const { HttpQueryError } = require('apollo-server-core');
21-
const { COLLECTION_JOB_STATUS, isJobStatusFinal } = require('../util/enums');
21+
const {
22+
COLLECTION_JOB_STATUS,
23+
isJobStatusFinal,
24+
AUTOMATION_SERVICE
25+
} = require('../util/enums');
2226
const populateData = require('../services/PopulatedData/populateData');
2327
const {
2428
getFinalizedTestResults

server/models/TestPlanRun.js

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const { AUTOMATION_SERVICE } = require('../util/enums');
2+
13
const MODEL_NAME = 'TestPlanRun';
24

35
module.exports = function (sequelize, DataTypes) {
@@ -18,6 +20,11 @@ module.exports = function (sequelize, DataTypes) {
1820
allowNull: false,
1921
defaultValue: false
2022
},
23+
automationService: {
24+
type: DataTypes.STRING,
25+
allowNull: true,
26+
defaultValue: null
27+
},
2128
isPrimary: {
2229
type: DataTypes.BOOLEAN,
2330
allowNull: true,
@@ -30,6 +37,9 @@ module.exports = function (sequelize, DataTypes) {
3037
}
3138
);
3239

40+
Model.GITHUB_ACTIONS = AUTOMATION_SERVICE.GITHUB_ACTIONS;
41+
Model.AZURE_PIPELINES = AUTOMATION_SERVICE.AZURE_PIPELINES;
42+
3343
Model.TEST_RESULT_ASSOCIATION = { as: 'testResults' };
3444

3545
Model.TEST_PLAN_REPORT_ASSOCIATION = { foreignKey: 'testPlanReportId' };

server/models/services/TestPlanRunService.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ const getTestPlanRuns = async ({
217217
/**
218218
* @param {object} options
219219
* @param {object} options.values - values to be used to create the TestPlanRun
220+
* @param {string} options.values.automationService
220221
* @param {string[]} options.testPlanRunAttributes - TestPlanRun attributes to be returned in the result
221222
* @param {string[]} options.nestedTestPlanRunAttributes - TestPlanRun attributes associated to the TestPlanReport model to be returned
222223
* @param {string[]} options.testPlanReportAttributes - TestPlanReport attributes to be returned in the result
@@ -233,7 +234,8 @@ const createTestPlanRun = async ({
233234
testerUserId,
234235
testPlanReportId,
235236
testResults = [],
236-
isAutomated = false
237+
isAutomated = false,
238+
automationService = null
237239
},
238240
testPlanRunAttributes = TEST_PLAN_RUN_ATTRIBUTES,
239241
nestedTestPlanRunAttributes = TEST_PLAN_RUN_ATTRIBUTES,
@@ -270,7 +272,8 @@ const createTestPlanRun = async ({
270272
testerUserId,
271273
testPlanReportId,
272274
testResults,
273-
initiatedByAutomation: isAutomated
275+
initiatedByAutomation: isAutomated,
276+
automationService
274277
},
275278
transaction
276279
});

server/util/enums.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,18 @@ const isJobStatusFinal = status =>
1111
status === COLLECTION_JOB_STATUS.CANCELLED ||
1212
status === COLLECTION_JOB_STATUS.ERROR;
1313

14+
/**
15+
* Enum for possible workflow services
16+
* @readonly
17+
* @enum {string}
18+
*/
19+
const AUTOMATION_SERVICE = Object.freeze({
20+
GITHUB_ACTIONS: 'GITHUB_ACTIONS',
21+
AZURE_PIPELINES: 'AZURE_PIPELINES'
22+
});
23+
1424
module.exports = {
1525
COLLECTION_JOB_STATUS,
16-
isJobStatusFinal
26+
isJobStatusFinal,
27+
AUTOMATION_SERVICE
1728
};

0 commit comments

Comments
 (0)