airbyte-faros-destination 0.5.53 → 0.5.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/converters/circleci/common.d.ts +8 -3
- package/lib/converters/circleci/common.js +23 -4
- package/lib/converters/circleci/common.js.map +1 -1
- package/lib/converters/circleci/models.d.ts +49 -6
- package/lib/converters/circleci/models.js.map +1 -1
- package/lib/converters/circleci/pipelines.js +5 -17
- package/lib/converters/circleci/pipelines.js.map +1 -1
- package/lib/converters/circleci/projects.js.map +1 -1
- package/lib/converters/circleci/tests.d.ts +17 -0
- package/lib/converters/circleci/tests.js +177 -0
- package/lib/converters/circleci/tests.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/resources/source-specific-configs/circleci.json +19 -0
- package/resources/source-specific-configs/spec.json +3 -0
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
-
import { Converter } from '../converter';
|
|
3
|
-
import { BuildKey,
|
|
2
|
+
import { Converter, StreamContext } from '../converter';
|
|
3
|
+
import { BuildKey, CommitKey, Vcs } from './models';
|
|
4
|
+
export interface CircleCIConfig {
|
|
5
|
+
skip_writing_test_cases: boolean;
|
|
6
|
+
}
|
|
4
7
|
export declare class CircleCICommon {
|
|
5
|
-
static
|
|
8
|
+
static getCommitKey(vcs: Vcs, project_slug: string): CommitKey;
|
|
9
|
+
static getBuildKey(workflow_id: string, pipeline_id: string, project_slug: string, source: string): BuildKey;
|
|
6
10
|
static getOrganization(projectSlug: string): string;
|
|
7
11
|
static getProject(projectSlug: string): string;
|
|
8
12
|
static convertStatus(status: string | undefined): {
|
|
@@ -19,4 +23,5 @@ export declare abstract class CircleCIConverter extends Converter {
|
|
|
19
23
|
source: string;
|
|
20
24
|
/** Almost every CircleCI record have id property */
|
|
21
25
|
id(record: AirbyteRecord): any;
|
|
26
|
+
protected circleCIConfig(ctx: StreamContext): CircleCIConfig;
|
|
22
27
|
}
|
|
@@ -4,13 +4,28 @@ exports.CircleCIConverter = exports.CircleCICommon = void 0;
|
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
const converter_1 = require("../converter");
|
|
6
6
|
class CircleCICommon {
|
|
7
|
-
static
|
|
7
|
+
static getCommitKey(vcs, project_slug) {
|
|
8
|
+
const repoName = CircleCICommon.getProject(project_slug);
|
|
8
9
|
return {
|
|
9
|
-
|
|
10
|
+
sha: vcs.revision,
|
|
11
|
+
uid: vcs.revision,
|
|
12
|
+
repository: {
|
|
13
|
+
name: repoName,
|
|
14
|
+
uid: repoName,
|
|
15
|
+
organization: {
|
|
16
|
+
uid: CircleCICommon.getOrganization(project_slug),
|
|
17
|
+
source: vcs.provider_name,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
static getBuildKey(workflow_id, pipeline_id, project_slug, source) {
|
|
23
|
+
return {
|
|
24
|
+
uid: `${(0, lodash_1.toLower)(pipeline_id)}__${(0, lodash_1.toLower)(workflow_id)}`,
|
|
10
25
|
pipeline: {
|
|
11
|
-
uid: this.getProject(
|
|
26
|
+
uid: this.getProject(project_slug),
|
|
12
27
|
organization: {
|
|
13
|
-
uid: this.getOrganization(
|
|
28
|
+
uid: this.getOrganization(project_slug),
|
|
14
29
|
source,
|
|
15
30
|
},
|
|
16
31
|
},
|
|
@@ -72,6 +87,10 @@ class CircleCIConverter extends converter_1.Converter {
|
|
|
72
87
|
var _a, _b;
|
|
73
88
|
return (_b = (_a = record === null || record === void 0 ? void 0 : record.record) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.id;
|
|
74
89
|
}
|
|
90
|
+
circleCIConfig(ctx) {
|
|
91
|
+
var _a, _b;
|
|
92
|
+
return (_b = (_a = ctx.config.source_specific_configs) === null || _a === void 0 ? void 0 : _a.circleci) !== null && _b !== void 0 ? _b : {};
|
|
93
|
+
}
|
|
75
94
|
}
|
|
76
95
|
exports.CircleCIConverter = CircleCIConverter;
|
|
77
96
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/circleci/common.ts"],"names":[],"mappings":";;;AACA,mCAA+B;AAE/B,
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/circleci/common.ts"],"names":[],"mappings":";;;AACA,mCAA+B;AAE/B,4CAAsD;AAOtD,MAAa,cAAc;IACzB,MAAM,CAAC,YAAY,CAAC,GAAQ,EAAE,YAAoB;QAChD,MAAM,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QACzD,OAAO;YACL,GAAG,EAAE,GAAG,CAAC,QAAQ;YACjB,GAAG,EAAE,GAAG,CAAC,QAAQ;YACjB,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,GAAG,EAAE,QAAQ;gBACb,YAAY,EAAE;oBACZ,GAAG,EAAE,cAAc,CAAC,eAAe,CAAC,YAAY,CAAC;oBACjD,MAAM,EAAE,GAAG,CAAC,aAAa;iBAC1B;aACF;SACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,WAAW,CAChB,WAAmB,EACnB,WAAmB,EACnB,YAAoB,EACpB,MAAc;QAEd,OAAO;YACL,GAAG,EAAE,GAAG,IAAA,gBAAO,EAAC,WAAW,CAAC,KAAK,IAAA,gBAAO,EAAC,WAAW,CAAC,EAAE;YACvD,QAAQ,EAAE;gBACR,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;gBAClC,YAAY,EAAE;oBACZ,GAAG,EAAE,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC;oBACvC,MAAM;iBACP;aACF;SACF,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,eAAe,CAAC,WAAmB;QACxC,OAAO,IAAA,gBAAO,EAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CA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,CAAC;YAC5C,KAAK,QAAQ;gBACX,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC;YAC5C;gBACE,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC;SAC7C;IACH,CAAC;CACF;AAlFD,wCAkFC;AAED,8BAA8B;AAC9B,MAAsB,iBAAkB,SAAQ,qBAAS;IAAzD;;QACE,WAAM,GAAG,UAAU,CAAC;IAUtB,CAAC;IARC,oDAAoD;IACpD,EAAE,CAAC,MAAqB;;QACtB,OAAO,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,IAAI,0CAAE,EAAE,CAAC;IAClC,CAAC;IAES,cAAc,CAAC,GAAkB;;QACzC,OAAO,MAAA,MAAA,GAAG,CAAC,MAAM,CAAC,uBAAuB,0CAAE,QAAQ,mCAAI,EAAE,CAAC;IAC5D,CAAC;CACF;AAXD,8CAWC"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
export interface Project {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
slug: string;
|
|
3
|
+
organization_name: string;
|
|
4
|
+
organization_id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
id: string;
|
|
7
|
+
organization_slug: string;
|
|
8
|
+
vcs_info: VcsInfo;
|
|
9
|
+
}
|
|
10
|
+
export interface VcsInfo {
|
|
11
|
+
vcs_url: string;
|
|
12
|
+
provider: string;
|
|
13
|
+
default_branch: string;
|
|
8
14
|
}
|
|
9
15
|
export interface Actor {
|
|
10
16
|
login: string;
|
|
@@ -57,6 +63,31 @@ export interface Job {
|
|
|
57
63
|
type: string;
|
|
58
64
|
stopped_at: string;
|
|
59
65
|
}
|
|
66
|
+
export interface TestMetadata {
|
|
67
|
+
pipeline_id: string;
|
|
68
|
+
pipeline_vcs: Vcs;
|
|
69
|
+
project_slug: string;
|
|
70
|
+
workflow_id: string;
|
|
71
|
+
workflow_name: string;
|
|
72
|
+
job_number: number;
|
|
73
|
+
job_started_at: Date;
|
|
74
|
+
job_stopped_at: Date;
|
|
75
|
+
message: string;
|
|
76
|
+
source: string;
|
|
77
|
+
run_time: number;
|
|
78
|
+
file: string;
|
|
79
|
+
result: string;
|
|
80
|
+
name: string;
|
|
81
|
+
classname: string;
|
|
82
|
+
}
|
|
83
|
+
export interface qa_TestExecutionStats {
|
|
84
|
+
failure: number;
|
|
85
|
+
success: number;
|
|
86
|
+
skipped: number;
|
|
87
|
+
unknown: number;
|
|
88
|
+
custom: number;
|
|
89
|
+
total: number;
|
|
90
|
+
}
|
|
60
91
|
export interface TaskType {
|
|
61
92
|
category: string;
|
|
62
93
|
detail?: string;
|
|
@@ -70,6 +101,18 @@ export declare enum SyncEntity {
|
|
|
70
101
|
Org = "Org",
|
|
71
102
|
Project = "Project"
|
|
72
103
|
}
|
|
104
|
+
export interface CommitKey {
|
|
105
|
+
readonly sha: string;
|
|
106
|
+
readonly uid: string;
|
|
107
|
+
readonly repository: {
|
|
108
|
+
readonly name: string;
|
|
109
|
+
readonly uid: string;
|
|
110
|
+
readonly organization: {
|
|
111
|
+
readonly uid: string;
|
|
112
|
+
readonly source: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
}
|
|
73
116
|
export interface BuildKey {
|
|
74
117
|
readonly uid: string;
|
|
75
118
|
readonly pipeline: PipelineKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/converters/circleci/models.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/converters/circleci/models.ts"],"names":[],"mappings":";;;AA6GA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,yBAAW,CAAA;IACX,iCAAmB,CAAA;AACrB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB"}
|
|
@@ -14,13 +14,12 @@ class Pipelines extends common_1.CircleCIConverter {
|
|
|
14
14
|
];
|
|
15
15
|
}
|
|
16
16
|
async convert(record) {
|
|
17
|
-
var _a, _b
|
|
17
|
+
var _a, _b;
|
|
18
18
|
const source = this.streamName.source;
|
|
19
19
|
const pipeline = record.record.data;
|
|
20
20
|
const res = [];
|
|
21
|
-
for (const workflow of pipeline.workflows) {
|
|
22
|
-
const buildKey = common_1.CircleCICommon.getBuildKey(workflow, pipeline, source);
|
|
23
|
-
const repoName = common_1.CircleCICommon.getProject(pipeline.project_slug);
|
|
21
|
+
for (const workflow of (_a = pipeline.workflows) !== null && _a !== void 0 ? _a : []) {
|
|
22
|
+
const buildKey = common_1.CircleCICommon.getBuildKey(workflow.id, pipeline.id, pipeline.project_slug, source);
|
|
24
23
|
res.push({
|
|
25
24
|
model: 'cicd_Build',
|
|
26
25
|
record: {
|
|
@@ -37,21 +36,10 @@ class Pipelines extends common_1.CircleCIConverter {
|
|
|
37
36
|
model: 'cicd_BuildCommitAssociation',
|
|
38
37
|
record: {
|
|
39
38
|
build: buildKey,
|
|
40
|
-
commit:
|
|
41
|
-
sha: (_a = pipeline.vcs) === null || _a === void 0 ? void 0 : _a.revision,
|
|
42
|
-
uid: (_b = pipeline.vcs) === null || _b === void 0 ? void 0 : _b.revision,
|
|
43
|
-
repository: {
|
|
44
|
-
name: repoName,
|
|
45
|
-
uid: repoName,
|
|
46
|
-
organization: {
|
|
47
|
-
uid: common_1.CircleCICommon.getOrganization(pipeline.project_slug),
|
|
48
|
-
source: (_c = pipeline.vcs) === null || _c === void 0 ? void 0 : _c.provider_name,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
39
|
+
commit: common_1.CircleCICommon.getCommitKey(pipeline.vcs, pipeline.project_slug),
|
|
52
40
|
},
|
|
53
41
|
});
|
|
54
|
-
for (const job of workflow.jobs) {
|
|
42
|
+
for (const job of (_b = workflow.jobs) !== null && _b !== void 0 ? _b : []) {
|
|
55
43
|
res.push({
|
|
56
44
|
model: 'cicd_BuildStep',
|
|
57
45
|
record: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipelines.js","sourceRoot":"","sources":["../../../src/converters/circleci/pipelines.ts"],"names":[],"mappings":";;;AACA,qDAAsC;AACtC,mCAA+B;AAG/B,qCAA2D;AAG3D,MAAa,SAAU,SAAQ,0BAAiB;IAAhD;;QACW,sBAAiB,GAAoC;YAC5D,YAAY;YACZ,6BAA6B;YAC7B,gBAAgB;SACjB,CAAC;
|
|
1
|
+
{"version":3,"file":"pipelines.js","sourceRoot":"","sources":["../../../src/converters/circleci/pipelines.ts"],"names":[],"mappings":";;;AACA,qDAAsC;AACtC,mCAA+B;AAG/B,qCAA2D;AAG3D,MAAa,SAAU,SAAQ,0BAAiB;IAAhD;;QACW,sBAAiB,GAAoC;YAC5D,YAAY;YACZ,6BAA6B;YAC7B,gBAAgB;SACjB,CAAC;IAyDJ,CAAC;IAvDC,KAAK,CAAC,OAAO,CACX,MAAqB;;QAErB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAgB,CAAC;QAChD,MAAM,GAAG,GAAwB,EAAE,CAAC;QAEpC,KAAK,MAAM,QAAQ,IAAI,MAAA,QAAQ,CAAC,SAAS,mCAAI,EAAE,EAAE;YAC/C,MAAM,QAAQ,GAAG,uBAAc,CAAC,WAAW,CACzC,QAAQ,CAAC,EAAE,EACX,QAAQ,CAAC,EAAE,EACX,QAAQ,CAAC,YAAY,EACrB,MAAM,CACP,CAAC;YACF,GAAG,CAAC,IAAI,CAAC;gBACP,KAAK,EAAE,YAAY;gBACnB,MAAM,EAAE;oBACN,GAAG,QAAQ;oBACX,MAAM,EAAE,QAAQ,CAAC,MAAM;oBACvB,IAAI,EAAE,GAAG,uBAAc,CAAC,UAAU,CAAC,QAAQ,CAAC,YA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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../../src/converters/circleci/projects.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../../src/converters/circleci/projects.ts"],"names":[],"mappings":";;;AAGA,qCAA2D;AAG3D,MAAa,QAAS,SAAQ,0BAAiB;IAA/C;;QACW,sBAAiB,GAAoC;YAC5D,mBAAmB;YACnB,eAAe;SAChB,CAAC;IA4BJ,CAAC;IA1BC,KAAK,CAAC,OAAO,CACX,MAAqB;QAErB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAe,CAAC;QAC9C,MAAM,UAAU,GAAG,uBAAc,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,uBAAc,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,GAAG,GAAwB,EAAE,CAAC;QACpC,GAAG,CAAC,IAAI,CAAC;YACP,KAAK,EAAE,mBAAmB;YAC1B,MAAM,EAAE;gBACN,GAAG,EAAE,MAAM;gBACX,IAAI,EAAE,OAAO,CAAC,iBAAiB;gBAC/B,MAAM;aACP;SACF,CAAC,CAAC;QACH,GAAG,CAAC,IAAI,CAAC;YACP,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE;gBACN,GAAG,EAAE,UAAU;gBACf,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,YAAY,EAAE,EAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAC;aACpC;SACF,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAhCD,4BAgCC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { CircleCIConverter } from './common';
|
|
4
|
+
export declare class Tests extends CircleCIConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
private skipWritingTestCases;
|
|
7
|
+
private readonly testCases;
|
|
8
|
+
private readonly testSuites;
|
|
9
|
+
private readonly testExecutionCommits;
|
|
10
|
+
private readonly testExecutions;
|
|
11
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
12
|
+
onProcessingComplete(): Promise<ReadonlyArray<DestinationRecord>>;
|
|
13
|
+
convertTestStatus(testResult: string): {
|
|
14
|
+
category: string;
|
|
15
|
+
detail: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tests = void 0;
|
|
4
|
+
const faros_js_client_1 = require("faros-js-client");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class Tests extends common_1.CircleCIConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = [
|
|
10
|
+
'qa_TestSuite',
|
|
11
|
+
'qa_TestSuiteTestCaseAssociation',
|
|
12
|
+
'qa_TestCase',
|
|
13
|
+
'qa_TestExecution',
|
|
14
|
+
'qa_TestCaseResult',
|
|
15
|
+
'qa_TestExecutionCommitAssociation',
|
|
16
|
+
];
|
|
17
|
+
this.skipWritingTestCases = undefined;
|
|
18
|
+
this.testCases = new Set();
|
|
19
|
+
this.testSuites = new Set();
|
|
20
|
+
this.testExecutionCommits = new Set();
|
|
21
|
+
this.testExecutions = {};
|
|
22
|
+
}
|
|
23
|
+
async convert(record, ctx) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
if (this.skipWritingTestCases === undefined) {
|
|
26
|
+
const skipWritingTestCases = (_a = this.circleCIConfig(ctx)) === null || _a === void 0 ? void 0 : _a.skip_writing_test_cases;
|
|
27
|
+
this.skipWritingTestCases =
|
|
28
|
+
skipWritingTestCases === undefined ? true : skipWritingTestCases;
|
|
29
|
+
}
|
|
30
|
+
const source = this.streamName.source;
|
|
31
|
+
const test = record.record.data;
|
|
32
|
+
const res = [];
|
|
33
|
+
const testSuiteUid = `${test.pipeline_id}__${test.workflow_name}_${test.classname}`;
|
|
34
|
+
const testCaseUid = `${testSuiteUid}__${test.name}`;
|
|
35
|
+
const testCaseResultUid = `${testCaseUid}__${test.job_number}`;
|
|
36
|
+
const testExecutionUid = `${testSuiteUid}__${test.job_number}`;
|
|
37
|
+
// Write test case & test suite association only once
|
|
38
|
+
if (!this.skipWritingTestCases && !this.testCases.has(testCaseUid)) {
|
|
39
|
+
res.push({
|
|
40
|
+
model: 'qa_TestCase',
|
|
41
|
+
record: {
|
|
42
|
+
uid: testCaseUid,
|
|
43
|
+
name: `${common_1.CircleCICommon.getProject(test.project_slug)}: ${test.name}`,
|
|
44
|
+
description: test.file
|
|
45
|
+
? `${test.file}: ${test.classname}`
|
|
46
|
+
: test.classname,
|
|
47
|
+
source,
|
|
48
|
+
type: { category: 'Custom', detail: 'unknown' },
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
res.push({
|
|
52
|
+
model: 'qa_TestSuiteTestCaseAssociation',
|
|
53
|
+
record: {
|
|
54
|
+
testSuite: { uid: testSuiteUid, source },
|
|
55
|
+
testCase: { uid: testCaseUid, source },
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
this.testCases.add(testCaseUid);
|
|
59
|
+
}
|
|
60
|
+
// Write the test case result on every test outcome
|
|
61
|
+
const testCaseResultStatus = this.convertTestStatus(test.result);
|
|
62
|
+
if (!this.skipWritingTestCases) {
|
|
63
|
+
res.push({
|
|
64
|
+
model: 'qa_TestCaseResult',
|
|
65
|
+
record: {
|
|
66
|
+
uid: testCaseResultUid,
|
|
67
|
+
description: (_b = test.message) === null || _b === void 0 ? void 0 : _b.substring(0, 256),
|
|
68
|
+
status: testCaseResultStatus,
|
|
69
|
+
testCase: { uid: testCaseUid, source },
|
|
70
|
+
testExecution: { uid: testExecutionUid, source },
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
// Write the test suite only once
|
|
75
|
+
if (!this.testSuites.has(testSuiteUid)) {
|
|
76
|
+
res.push({
|
|
77
|
+
model: 'qa_TestSuite',
|
|
78
|
+
record: {
|
|
79
|
+
uid: testSuiteUid,
|
|
80
|
+
name: test.workflow_name,
|
|
81
|
+
source,
|
|
82
|
+
type: { category: 'Custom', detail: 'unknown' },
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
this.testSuites.add(testSuiteUid);
|
|
86
|
+
}
|
|
87
|
+
// Write the commit association only once
|
|
88
|
+
if (!this.testExecutionCommits.has(testExecutionUid)) {
|
|
89
|
+
res.push({
|
|
90
|
+
model: 'qa_TestExecutionCommitAssociation',
|
|
91
|
+
record: {
|
|
92
|
+
testExecution: { uid: testExecutionUid, source },
|
|
93
|
+
commit: common_1.CircleCICommon.getCommitKey(test.pipeline_vcs, test.project_slug),
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
this.testExecutionCommits.add(testExecutionUid);
|
|
97
|
+
}
|
|
98
|
+
if (!(testExecutionUid in this.testExecutions)) {
|
|
99
|
+
this.testExecutions[testExecutionUid] = {
|
|
100
|
+
uid: testExecutionUid,
|
|
101
|
+
name: `${test.workflow_name} - ${test.job_number}`,
|
|
102
|
+
source,
|
|
103
|
+
status: { category: 'Success', detail: null },
|
|
104
|
+
startedAt: faros_js_client_1.Utils.toDate(test.job_started_at),
|
|
105
|
+
endedAt: faros_js_client_1.Utils.toDate(test.job_stopped_at),
|
|
106
|
+
testCaseResultsStats: {
|
|
107
|
+
failure: 0,
|
|
108
|
+
success: 0,
|
|
109
|
+
skipped: 0,
|
|
110
|
+
unknown: 0,
|
|
111
|
+
custom: 0,
|
|
112
|
+
total: 0,
|
|
113
|
+
},
|
|
114
|
+
suite: { uid: testSuiteUid, source },
|
|
115
|
+
build: common_1.CircleCICommon.getBuildKey(test.workflow_id, test.pipeline_id, test.project_slug, source),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// Update test execution status & stats
|
|
119
|
+
const te = this.testExecutions[testExecutionUid];
|
|
120
|
+
if (testCaseResultStatus.category === 'Failure') {
|
|
121
|
+
te.status = { category: 'Failure', detail: null };
|
|
122
|
+
te.testCaseResultsStats.failure += 1;
|
|
123
|
+
}
|
|
124
|
+
else if (testCaseResultStatus.category === 'Success') {
|
|
125
|
+
te.testCaseResultsStats.success += 1;
|
|
126
|
+
}
|
|
127
|
+
else if (testCaseResultStatus.category === 'Skipped') {
|
|
128
|
+
te.testCaseResultsStats.skipped += 1;
|
|
129
|
+
}
|
|
130
|
+
else if (testCaseResultStatus.category === 'Custom') {
|
|
131
|
+
te.testCaseResultsStats.custom += 1;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
te.testCaseResultsStats.unknown += 1;
|
|
135
|
+
}
|
|
136
|
+
te.testCaseResultsStats.total += 1;
|
|
137
|
+
return res;
|
|
138
|
+
}
|
|
139
|
+
async onProcessingComplete() {
|
|
140
|
+
const res = [];
|
|
141
|
+
for (const record of Object.values(this.testExecutions)) {
|
|
142
|
+
res.push({ model: 'qa_TestExecution', record });
|
|
143
|
+
}
|
|
144
|
+
return res;
|
|
145
|
+
}
|
|
146
|
+
convertTestStatus(testResult) {
|
|
147
|
+
if (!testResult) {
|
|
148
|
+
return { category: 'Unknown', detail: 'undefined' };
|
|
149
|
+
}
|
|
150
|
+
const detail = testResult;
|
|
151
|
+
switch (testResult.toLowerCase()) {
|
|
152
|
+
case 'success':
|
|
153
|
+
case 'succeed':
|
|
154
|
+
case 'succeeded':
|
|
155
|
+
case 'pass':
|
|
156
|
+
case 'passed':
|
|
157
|
+
return { category: 'Success', detail };
|
|
158
|
+
case 'skip':
|
|
159
|
+
case 'skipped':
|
|
160
|
+
case 'disable':
|
|
161
|
+
case 'disabled':
|
|
162
|
+
case 'ignore':
|
|
163
|
+
case 'ignored':
|
|
164
|
+
return { category: 'Skipped', detail };
|
|
165
|
+
case 'fail':
|
|
166
|
+
case 'failed':
|
|
167
|
+
case 'failure':
|
|
168
|
+
case 'error':
|
|
169
|
+
case 'errored':
|
|
170
|
+
return { category: 'Failure', detail };
|
|
171
|
+
default:
|
|
172
|
+
return { category: 'Custom', detail };
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.Tests = Tests;
|
|
177
|
+
//# sourceMappingURL=tests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tests.js","sourceRoot":"","sources":["../../../src/converters/circleci/tests.ts"],"names":[],"mappings":";;;AACA,qDAAsC;AAItC,qCAA2D;AAG3D,MAAa,KAAM,SAAQ,0BAAiB;IAA5C;;QACW,sBAAiB,GAAoC;YAC5D,cAAc;YACd,iCAAiC;YACjC,aAAa;YACb,kBAAkB;YAClB,mBAAmB;YACnB,mCAAmC;SACpC,CAAC;QAEM,yBAAoB,GAAwB,SAAS,CAAC;QAC7C,cAAS,GAAgB,IAAI,GAAG,EAAU,CAAC;QAC3C,eAAU,GAAgB,IAAI,GAAG,EAAU,CAAC;QAC5C,yBAAoB,GAAgB,IAAI,GAAG,EAAU,CAAC;QACtD,mBAAc,GAAoB,EAAE,CAAC;IAyKxD,CAAC;IAvKC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;;QAElB,IAAI,IAAI,CAAC,oBAAoB,KAAK,SAAS,EAAE;YAC3C,MAAM,oBAAoB,GACxB,MAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,0CAAE,uBAAuB,CAAC;YACpD,IAAI,CAAC,oBAAoB;gBACvB,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC;SACpE;QAED,MAAM,MAAM,GAAG,IAA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