Skip to content

Commit 3386026

Browse files
ci(tests): add windows tests to CI as non blocking (#3289)
1 parent c69bc00 commit 3386026

File tree

8 files changed

+126
-18
lines changed

8 files changed

+126
-18
lines changed

.github/workflows/run-distributed-tests.yml

+50
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,55 @@ jobs:
100100
echo "LAMBDA_IMAGE_VERSION=${{ inputs.COMMIT_SHA }}" >> $GITHUB_ENV
101101
# runs the single test file from `package` workspace in the `file`, as defined in the matrix output
102102
- run: npm run test:aws:ci --workspace ${{fromJson(needs.generate-test-matrix.outputs.matrix).namesToFiles[matrix.testName].package }} -- --files ${{ fromJson(needs.generate-test-matrix.outputs.matrix).namesToFiles[matrix.testName].file }}
103+
env:
104+
FORCE_COLOR: 1
105+
106+
run-tests-windows:
107+
needs: generate-test-matrix
108+
timeout-minutes: 60
109+
runs-on: ubuntu-latest
110+
continue-on-error: true
111+
permissions:
112+
contents: read
113+
id-token: write
114+
env:
115+
ARTILLERY_CLOUD_ENDPOINT: ${{ secrets.ARTILLERY_CLOUD_ENDPOINT_TEST }}
116+
ARTILLERY_CLOUD_API_KEY: ${{ secrets.ARTILLERY_CLOUD_API_KEY_TEST }}
117+
DD_TESTS_API_KEY: ${{ secrets.DD_TESTS_API_KEY }}
118+
DD_TESTS_APP_KEY: ${{ secrets.DD_TESTS_APP_KEY }}
119+
GITHUB_REPO: ${{ github.repository }}
120+
GITHUB_ACTOR: ${{ github.actor }}
121+
HAS_ARM64_BUILD: ${{ inputs.HAS_ARM64_BUILD }}
122+
steps:
123+
- uses: actions/checkout@v3
124+
with:
125+
ref: ${{ inputs.COMMIT_SHA || null }} # in a PR we make a collaborator check, otherwise this would override pull_request_target
126+
- name: Configure AWS Credentials
127+
uses: aws-actions/configure-aws-credentials@v2
128+
env:
129+
SHOW_STACK_TRACE: true
130+
with:
131+
aws-region: eu-west-1
132+
role-to-assume: ${{ secrets.AWS_TEST_EXECUTION_ROLE_ARN_TEST5 }}
133+
role-session-name: OIDCSession
134+
mask-aws-account-id: true
135+
- name: Use Node.js 18.x
136+
uses: actions/setup-node@v2
137+
with:
138+
node-version: 18.x
139+
- run: .github/workflows/scripts/npm-command-retry.sh install
140+
- run: npm run build
141+
- name: Install Specific Artillery Version if needed
142+
if: ${{ inputs.ARTILLERY_VERSION_OVERRIDE || false }}
143+
run: mkdir __artillery__ && cd __artillery__ && npm init -y && ../.github/workflows/scripts/npm-command-retry.sh install artillery@${{ inputs.ARTILLERY_VERSION_OVERRIDE }}
144+
- name: Set A9_PATH
145+
if: ${{ inputs.ARTILLERY_VERSION_OVERRIDE || false }}
146+
run: echo "A9_PATH=${{ github.workspace }}/__artillery__/node_modules/.bin/artillery" >> $GITHUB_ENV
147+
- name: Set ECR Image Version if needed
148+
if: ${{ inputs.COMMIT_SHA }}
149+
run: |
150+
echo "ECR_IMAGE_VERSION=${{ inputs.COMMIT_SHA }}" >> $GITHUB_ENV
151+
echo "LAMBDA_IMAGE_VERSION=${{ inputs.COMMIT_SHA }}" >> $GITHUB_ENV
152+
- run: npm run test:aws:windows --workspace artillery
103153
env:
104154
FORCE_COLOR: 1

.github/workflows/run-tests.yml

+37
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,42 @@ jobs:
4949
with:
5050
status: ${{ job.status }}
5151
fields: repo,message,commit,author,eventName,job,took,pullRequest
52+
env:
53+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
54+
55+
test-windows:
56+
timeout-minutes: 60
57+
runs-on: windows-latest
58+
needs: generate-matrix-with-packages
59+
continue-on-error: true
60+
permissions:
61+
contents: read
62+
id-token: write
63+
steps:
64+
- uses: actions/checkout@v3
65+
- name: Use Node.js 20.x
66+
uses: actions/setup-node@v3
67+
with:
68+
node-version: 20.x
69+
- run: npm install
70+
- run: npm run build
71+
- name: Run windows tests and capture exit code
72+
continue-on-error: true
73+
run: |
74+
try {
75+
npm run test:windows --workspace artillery
76+
$global:ExitCode = 0
77+
} catch {
78+
$global:ExitCode = $LASTEXITCODE
79+
}
80+
echo "ExitCode=$global:ExitCode" >> $env:GITHUB_ENV
81+
env:
82+
FORCE_COLOR: 1
83+
- name: Notify about failures
84+
if: ${{ env.ExitCode }} != 0
85+
uses: 8398a7/[email protected]
86+
with:
87+
status: failure
88+
fields: repo,message,commit,author,eventName,job,took,pullRequest
5289
env:
5390
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

packages/artillery/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"test:windows": "npm run test:unit && tap --timeout=420 test/cli/*.test.js",
5050
"test:aws": "tap --timeout=4200 test/cloud-e2e/**/*.test.js",
5151
"test:aws:ci": "tap --timeout=4200",
52-
"test:aws:windows": "tap --timeout=420 test/cloud-e2e/fargate/*.test.js --grep \"Run simple-bom\"",
52+
"test:aws:windows": "tap --timeout=420 test/cloud-e2e/**/*.test.js --grep \"@windows\"",
5353
"lint": "eslint --ext \".js,.ts,.tsx\" .",
5454
"lint-fix": "npm run lint -- --fix"
5555
},

packages/artillery/test/cloud-e2e/fargate/bom.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ beforeEach(async (t) => {
2626
reportFilePath = generateTmpReportPath(t.name, 'json');
2727
});
2828

29-
test('Run simple-bom', async (t) => {
29+
test('Run simple-bom @windows', async (t) => {
3030
const scenarioPath = toCorrectPath(
3131
`${__dirname}/fixtures/simple-bom/simple-bom.yml`
3232
);

packages/artillery/test/cloud-e2e/fargate/processors.test.js

+18-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ const { test, before, beforeEach } = require('tap');
22
const { $ } = require('zx');
33
const fs = require('fs');
44
const path = require('path');
5-
const { generateTmpReportPath, getTestTags } = require('../../helpers');
5+
const {
6+
generateTmpReportPath,
7+
getTestTags,
8+
toCorrectPath
9+
} = require('../../helpers');
610
const {
711
checkForNegativeValues,
812
checkAggregateCounterSums
@@ -21,11 +25,15 @@ beforeEach(async (t) => {
2125
reportFilePath = generateTmpReportPath(t.name, 'json');
2226
});
2327

24-
test('Run with typescript processor and external package', async (t) => {
25-
const scenarioPath = `${__dirname}/fixtures/ts-external-pkg/with-external-foreign-pkg.yml`;
28+
test('Run with typescript processor and external package @windows', async (t) => {
29+
const scenarioPath = toCorrectPath(
30+
`${__dirname}/fixtures/ts-external-pkg/with-external-foreign-pkg.yml`
31+
);
2632

2733
const output =
28-
await $`${A9_PATH} run-fargate ${scenarioPath} --output ${reportFilePath} --record --tags ${baseTags},typescript:true`;
34+
await $`${A9_PATH} run-fargate ${scenarioPath} --output ${toCorrectPath(
35+
reportFilePath
36+
)} --record --tags ${baseTags},typescript:true`;
2937

3038
t.equal(output.exitCode, 0, 'CLI Exit Code should be 0');
3139

@@ -45,14 +53,16 @@ test('Run with typescript processor and external package', async (t) => {
4553
checkAggregateCounterSums(t, report);
4654
});
4755

48-
test('Run a test with an ESM processor', async (t) => {
56+
test('Run a test with an ESM processor @windows', async (t) => {
4957
// The main thing we're checking here is that ESM + dependencies get bundled correctly by BOM
50-
const scenarioPath = path.resolve(
51-
`${__dirname}/../../scripts/scenario-async-esm-hooks/test.yml`
58+
const scenarioPath = toCorrectPath(
59+
path.resolve(`${__dirname}/../../scripts/scenario-async-esm-hooks/test.yml`)
5260
);
5361

5462
const output =
55-
await $`${A9_PATH} run-fargate ${scenarioPath} --output ${reportFilePath} --record --tags ${baseTags}`;
63+
await $`${A9_PATH} run-fargate ${scenarioPath} --output ${toCorrectPath(
64+
reportFilePath
65+
)} --record --tags ${baseTags}`;
5666

5767
t.equal(output.exitCode, 0, 'CLI exit code should be 0');
5868

packages/artillery/test/cloud-e2e/lambda/lambda-bom.test.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const { $ } = require('zx');
44
const {
55
getTestTags,
66
generateTmpReportPath,
7-
getImageArchitecture
7+
getImageArchitecture,
8+
toCorrectPath
89
} = require('../../helpers');
910
const {
1011
checkForNegativeValues,
@@ -26,8 +27,10 @@ tap.beforeEach(async (t) => {
2627
reportFilePath = generateTmpReportPath(t.name, 'json');
2728
});
2829

29-
tap.test('Run simple-bom', async (t) => {
30-
const scenarioPath = `${__dirname}/../fargate/fixtures/simple-bom/simple-bom.yml`;
30+
tap.test('Run simple-bom @windows', async (t) => {
31+
const scenarioPath = toCorrectPath(
32+
`${__dirname}/../fargate/fixtures/simple-bom/simple-bom.yml`
33+
);
3134

3235
const output =
3336
await $`${A9_PATH} run-lambda ${scenarioPath} --architecture ${ARCHITECTURE} -e test --tags ${tags} --output ${reportFilePath} --count 51 --record`;

packages/artillery/test/cloud-e2e/lambda/lambda-smoke.test.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const { $ } = require('zx');
44
const {
55
getTestTags,
66
generateTmpReportPath,
7-
getImageArchitecture
7+
getImageArchitecture,
8+
toCorrectPath
89
} = require('../../helpers');
910
const {
1011
checkForNegativeValues,
@@ -57,12 +58,16 @@ tap.test('Run a test on AWS Lambda using containers', async (t) => {
5758
});
5859

5960
tap.test(
60-
'Run in Lambda container with typescript processor and external package',
61+
'Run in Lambda container with typescript processor and external package @windows',
6162
async (t) => {
62-
const scenarioPath = `${__dirname}/fixtures/ts-external-pkg/with-external-foreign-pkg.yml`;
63+
const scenarioPath = toCorrectPath(
64+
`${__dirname}/fixtures/ts-external-pkg/with-external-foreign-pkg.yml`
65+
);
6366

6467
const output =
65-
await $`${A9_PATH} run-lambda ${scenarioPath} --architecture ${ARCHITECTURE} --record --output ${reportFilePath} --tags ${tags},typescript:true`;
68+
await $`${A9_PATH} run-lambda ${scenarioPath} --architecture ${ARCHITECTURE} --record --output ${toCorrectPath(
69+
reportFilePath
70+
)} --tags ${tags},typescript:true`;
6671

6772
t.equal(output.exitCode, 0, 'CLI Exit Code should be 0');
6873

packages/artillery/test/helpers/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ function getTestTags(additionalTags) {
4343
const actorTag = `actor:${process.env.GITHUB_ACTOR || 'localhost'}`;
4444
const repoTag = `repo:${process.env.GITHUB_REPO || 'artilleryio/artillery'}`;
4545
const ciTag = `ci:${process.env.GITHUB_ACTIONS ? 'true' : 'false'}`;
46+
const platformTag = `plat:${process.platform}`;
4647

47-
return `${repoTag},${actorTag},${ciTag},${additionalTags.join(',')}`;
48+
return `${repoTag},${actorTag},${ciTag},${platformTag},${additionalTags.join(
49+
','
50+
)}`;
4851
}
4952

5053
const getImageArchitecture = () => {

0 commit comments

Comments
 (0)