From 4d306e772a9ace1513c6c94b87c9669051aa1aa4 Mon Sep 17 00:00:00 2001 From: Michele Mancioppi Date: Mon, 6 Nov 2023 18:14:40 +0100 Subject: [PATCH] chore: add retries to validation test to reduce flakiness --- packages/otelbin-validation/.projenrc.js | 7 ++++++- packages/otelbin-validation/package-lock.json | 1 + packages/otelbin-validation/package.json | 1 + packages/otelbin-validation/test/main.test.ts | 4 +++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/otelbin-validation/.projenrc.js b/packages/otelbin-validation/.projenrc.js index cd74cfd9..d5023ea1 100644 --- a/packages/otelbin-validation/.projenrc.js +++ b/packages/otelbin-validation/.projenrc.js @@ -4,7 +4,7 @@ const project = new awscdk.AwsCdkTypeScriptApp({ defaultReleaseBranch: 'main', name: 'otelbin-validation', deps: ['aws-lambda'], - devDeps: ['@jest/globals', '@types/aws-lambda', 'axios', 'esbuild'], + devDeps: ['@jest/globals', '@types/aws-lambda', 'axios', 'esbuild', 'jest-circus'], github: false, // Skip GitHub integration, as this CDK app is not in the repo's root packageManager: 'npm', eslintOptions: { @@ -17,5 +17,10 @@ const project = new awscdk.AwsCdkTypeScriptApp({ 'src/images/otelcol-validator/', ], }, + jestOptions: { + jestConfig: { + testRunner: 'jest-circus/runner', + }, + }, }); project.synth(); diff --git a/packages/otelbin-validation/package-lock.json b/packages/otelbin-validation/package-lock.json index f0012dd4..f3b159fd 100644 --- a/packages/otelbin-validation/package-lock.json +++ b/packages/otelbin-validation/package-lock.json @@ -28,6 +28,7 @@ "eslint-import-resolver-typescript": "^3.5.5", "eslint-plugin-import": "^2.27.5", "jest": "^29.6.4", + "jest-circus": "^29.7.0", "jest-junit": "^15", "npm-check-updates": "^16", "projen": "^0.73.37", diff --git a/packages/otelbin-validation/package.json b/packages/otelbin-validation/package.json index 541bdc0e..ebf4e470 100644 --- a/packages/otelbin-validation/package.json +++ b/packages/otelbin-validation/package.json @@ -38,6 +38,7 @@ "eslint-import-resolver-typescript": "^3.5.5", "eslint-plugin-import": "^2.27.5", "jest": "^29.6.4", + "jest-circus": "^29.7.0", "jest-junit": "^15", "npm-check-updates": "^16", "projen": "^0.73.37", diff --git a/packages/otelbin-validation/test/main.test.ts b/packages/otelbin-validation/test/main.test.ts index 2432aa8e..3ee69922 100644 --- a/packages/otelbin-validation/test/main.test.ts +++ b/packages/otelbin-validation/test/main.test.ts @@ -4,7 +4,7 @@ import { readFileSync } from 'fs'; import { join } from 'path'; -import { describe, expect, test } from '@jest/globals'; +import { describe, expect, jest, test } from '@jest/globals'; import axios from 'axios'; import { Distributions } from '../src/main'; @@ -56,6 +56,8 @@ const otelcolConfigInvalidUndeclaredReceiver = readConfig('config-undeclared-rec describe.each(enumerateTestCases())('Validation API', (distributionName, release) => { + jest.retryTimes(5); + const validationReleasePath = `validation/${distributionName}/${release}`; const validationUrl = `${apiUrl}/${validationReleasePath}`;