Skip to content

Commit

Permalink
junit
Browse files Browse the repository at this point in the history
  • Loading branch information
williamputraintan committed Feb 6, 2024
1 parent 9be6c95 commit c70a326
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ data/

Brewfile.lock.json
*.xml

target/
10 changes: 10 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,14 @@ module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
reporters: [
'default',
[
'jest-junit',
{
outputDirectory: 'target/report',
outputName: 'infrastructureTest.xml',
},
],
],
};
55 changes: 49 additions & 6 deletions lib/pipeline/orcabus-stateless-pipeline-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,56 @@ export class StatelessPipelineStack extends cdk.Stack {
connectionArn: codeStarArn,
});

const synthAction = new pipelines.CodeBuildStep('Synth', {
commands: [
'yarn install --frozen-lockfile',
'make suite',
'yarn run cdk-stateless-pipeline synth',
],
const unitTestReports = new codebuild.ReportGroup(this, `CodebuildTestReport`, {
reportGroupName: `UnitTestReport`,
removalPolicy: cdk.RemovalPolicy.DESTROY,
});

const unitTest = new pipelines.CodeBuildStep('UnitTest', {
commands: ['yarn install --frozen-lockfile', 'make suite'],
input: sourceFile,
primaryOutputDirectory: '.',
buildEnvironment: {
privileged: true,
computeType: codebuild.ComputeType.LARGE,
buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0,
environmentVariables: {
NODE_OPTIONS: {
value: '--max-old-space-size=8192',
},
},
},
partialBuildSpec: codebuild.BuildSpec.fromObject({
reports: {
infrastructureReports: {
files: ['target/report/*.xml'],
'file-format': 'JUNITXML',
},
microserviceReports: {
files: ['**/target/report/*.xml'],
'file-format': 'JUNITXML',
},
},
version: '0.2',
}),
rolePolicyStatements: [
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: [
'codebuild:CreateReportGroup',
'codebuild:CreateReport',
'codebuild:UpdateReport',
'codebuild:BatchPutTestCases',
'codebuild:BatchPutCodeCoverages',
],
resources: [unitTestReports.reportGroupArn],
}),
],
});

const synthAction = new pipelines.CodeBuildStep('Synth', {
commands: ['yarn install --frozen-lockfile', 'yarn run cdk-stateless-pipeline synth'],
input: unitTest,
primaryOutputDirectory: 'cdk.out',
rolePolicyStatements: [
new iam.PolicyStatement({
Expand Down
10 changes: 10 additions & 0 deletions lib/workload/stateless/metadata_manager/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,14 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/tests/'],
reporters: [
'default',
[
'jest-junit',
{
outputDirectory: 'target/report',
outputName: 'metadataManager.xml',
},
],
],
};
1 change: 1 addition & 0 deletions lib/workload/stateless/metadata_manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@types/lodash": "^4.14.202",
"@types/node": "^20.11.5",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"nodemon": "^3.0.3",
"ts-jest": "^29.1.1",
"ts-to-zod": "^3.6.1",
Expand Down
31 changes: 30 additions & 1 deletion lib/workload/stateless/metadata_manager/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3670,6 +3670,18 @@ __metadata:
languageName: node
linkType: hard

"jest-junit@npm:^16.0.0":
version: 16.0.0
resolution: "jest-junit@npm:16.0.0"
dependencies:
mkdirp: ^1.0.4
strip-ansi: ^6.0.1
uuid: ^8.3.2
xml: ^1.0.1
checksum: 412aa4bfeec4254a9b34f417fda79107c7cbd295e56ffeb299ac9c977545910fbabe57c91c6cd1f12b700d4a1f60f79872b0075003f02da87d463e30fc2d9d78
languageName: node
linkType: hard

"jest-leak-detector@npm:^29.7.0":
version: 29.7.0
resolution: "jest-leak-detector@npm:29.7.0"
Expand Down Expand Up @@ -4382,7 +4394,7 @@ __metadata:
languageName: node
linkType: hard

"mkdirp@npm:^1.0.3":
"mkdirp@npm:^1.0.3, mkdirp@npm:^1.0.4":
version: 1.0.4
resolution: "mkdirp@npm:1.0.4"
bin:
Expand Down Expand Up @@ -5384,6 +5396,7 @@ __metadata:
google-auth-library: ^9.4.2
google-spreadsheet: ^4.1.1
jest: ^29.7.0
jest-junit: ^16.0.0
lodash: ^4.17.21
nodemon: ^3.0.3
pino: ^8.17.2
Expand Down Expand Up @@ -5953,6 +5966,15 @@ __metadata:
languageName: node
linkType: hard

"uuid@npm:^8.3.2":
version: 8.3.2
resolution: "uuid@npm:8.3.2"
bin:
uuid: dist/bin/uuid
checksum: 5575a8a75c13120e2f10e6ddc801b2c7ed7d8f3c8ac22c7ed0c7b2ba6383ec0abda88c905085d630e251719e0777045ae3236f04c812184b7c765f63a70e58df
languageName: node
linkType: hard

"v8-compile-cache-lib@npm:^3.0.1":
version: 3.0.1
resolution: "v8-compile-cache-lib@npm:3.0.1"
Expand Down Expand Up @@ -6138,6 +6160,13 @@ __metadata:
languageName: node
linkType: hard

"xml@npm:^1.0.1":
version: 1.0.1
resolution: "xml@npm:1.0.1"
checksum: 11b5545ef3f8fec3fa29ce251f50ad7b6c97c103ed4d851306ec23366f5fa4699dd6a942262df52313a0cd1840ab26256da253c023bad3309d8ce46fe6020ca0
languageName: node
linkType: hard

"y18n@npm:^5.0.5":
version: 5.0.8
resolution: "y18n@npm:5.0.8"
Expand Down
9 changes: 2 additions & 7 deletions lib/workload/stateless/sequence_run_manager/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@ lint:
lint-fix:
@black -t py312 ./src --exclude skel --exclude .venv

# full mock suite test pipeline - install deps, bring up compose stack, wait a bit, run suite, bring down compose stack
test: install up wait suite down

# heuristic wait 8s to make sure the database is fully up
# todo we could improve this
wait:
@sleep 8
# full mock suite test pipeline - install deps, bring up compose stack, run suite, bring down compose stack
test: install up suite down

suite:
@python manage.py test
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.6.1",
"jest-junit": "^16.0.0",
"prettier": "^3.2.4",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
Expand Down
31 changes: 30 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3156,6 +3156,18 @@ __metadata:
languageName: node
linkType: hard

"jest-junit@npm:^16.0.0":
version: 16.0.0
resolution: "jest-junit@npm:16.0.0"
dependencies:
mkdirp: ^1.0.4
strip-ansi: ^6.0.1
uuid: ^8.3.2
xml: ^1.0.1
checksum: 412aa4bfeec4254a9b34f417fda79107c7cbd295e56ffeb299ac9c977545910fbabe57c91c6cd1f12b700d4a1f60f79872b0075003f02da87d463e30fc2d9d78
languageName: node
linkType: hard

"jest-leak-detector@npm:^29.7.0":
version: 29.7.0
resolution: "jest-leak-detector@npm:29.7.0"
Expand Down Expand Up @@ -3812,7 +3824,7 @@ __metadata:
languageName: node
linkType: hard

"mkdirp@npm:^1.0.3":
"mkdirp@npm:^1.0.3, mkdirp@npm:^1.0.4":
version: 1.0.4
resolution: "mkdirp@npm:1.0.4"
bin:
Expand Down Expand Up @@ -3974,6 +3986,7 @@ __metadata:
eslint-config-prettier: ^9.1.0
eslint-plugin-prettier: ^5.1.3
jest: ^29.6.1
jest-junit: ^16.0.0
prettier: ^3.2.4
rust.aws-cdk-lambda: ^1.2.1
source-map-support: ^0.5.21
Expand Down Expand Up @@ -4933,6 +4946,15 @@ __metadata:
languageName: node
linkType: hard

"uuid@npm:^8.3.2":
version: 8.3.2
resolution: "uuid@npm:8.3.2"
bin:
uuid: dist/bin/uuid
checksum: 5575a8a75c13120e2f10e6ddc801b2c7ed7d8f3c8ac22c7ed0c7b2ba6383ec0abda88c905085d630e251719e0777045ae3236f04c812184b7c765f63a70e58df
languageName: node
linkType: hard

"v8-compile-cache-lib@npm:^3.0.1":
version: 3.0.1
resolution: "v8-compile-cache-lib@npm:3.0.1"
Expand Down Expand Up @@ -5028,6 +5050,13 @@ __metadata:
languageName: node
linkType: hard

"xml@npm:^1.0.1":
version: 1.0.1
resolution: "xml@npm:1.0.1"
checksum: 11b5545ef3f8fec3fa29ce251f50ad7b6c97c103ed4d851306ec23366f5fa4699dd6a942262df52313a0cd1840ab26256da253c023bad3309d8ce46fe6020ca0
languageName: node
linkType: hard

"y18n@npm:^5.0.5":
version: 5.0.8
resolution: "y18n@npm:5.0.8"
Expand Down

0 comments on commit c70a326

Please sign in to comment.