Skip to content

test: advanced test use cases #3737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .github/scripts/get_pr_info.js

This file was deleted.

24 changes: 14 additions & 10 deletions .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@ jobs:
env:
NODE_ENV: dev
PR_NUMBER: ${{ inputs.prNumber }}
GH_TOKEN: ${{ github.token }}
permissions:
id-token: write # needed to interact with GitHub's OIDC Token endpoint.
contents: read
strategy:
max-parallel: 30
max-parallel: 25
matrix:
package:
[
layers,
packages/idempotency,
packages/logger,
packages/metrics,
packages/tracer,
packages/parameters,
packages/idempotency,
packages/tracer,
layers,
]
version: [18, 20, 22]
arch: [x86_64, arm64]
Expand All @@ -42,11 +43,14 @@ jobs:
- name: Extract PR details
id: extract_PR_details
if: ${{ inputs.prNumber != '' }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const script = require('.github/scripts/get_pr_info.js');
await script({github, context, core});
run: |
# Get the PR number from the input
pr_number=${{ inputs.prNumber }}
# Get the headSHA of the PR
head_sha=$(gh pr view $pr_number --json headRefOid -q '.headRefOid')
# Set the headSHA as an output variable
echo "headSHA=$head_sha" >> $GITHUB_OUTPUT
echo "headSHA=$head_sha"
# Only if a PR Number was passed and the headSHA of the PR extracted,
# we checkout the PR at that point in time
- name: Checkout PR code
Expand Down Expand Up @@ -75,4 +79,4 @@ jobs:
ARCH: ${{ matrix.arch }}
JSII_SILENCE_WARNING_DEPRECATED_NODE_VERSION: true
RUNNER_DEBUG: ${{ env.RUNNER_DEBUG }}
run: npm run test:e2e -w ${{ matrix.package }}
run: npm run test:e2e -w ${{ matrix.package }}
4 changes: 0 additions & 4 deletions layers/tests/e2e/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
export const RESOURCE_NAME_PREFIX = 'Layers-E2E';
export const ONE_MINUTE = 60 * 1000;
export const TEST_CASE_TIMEOUT = 3 * ONE_MINUTE;
export const SETUP_TIMEOUT = 7 * ONE_MINUTE;
export const TEARDOWN_TIMEOUT = 5 * ONE_MINUTE;
10 changes: 3 additions & 7 deletions layers/tests/e2e/layerPublisher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ import { LayerVersion } from 'aws-cdk-lib/aws-lambda';
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
import packageJson from '../../package.json';
import { LayerPublisherStack } from '../../src/layer-publisher-stack.js';
import {
RESOURCE_NAME_PREFIX,
SETUP_TIMEOUT,
TEARDOWN_TIMEOUT,
} from './constants.js';
import { RESOURCE_NAME_PREFIX } from './constants.js';

/**
* This test has two stacks:
Expand Down Expand Up @@ -121,7 +117,7 @@ describe('Layers E2E tests', () => {
})
);
}
}, SETUP_TIMEOUT);
});

it.each(cases)(
'imports and instantiates all utilities (%s)',
Expand Down Expand Up @@ -198,5 +194,5 @@ describe('Layers E2E tests', () => {
await testLayerStack.destroy();
await testStack.destroy();
}
}, TEARDOWN_TIMEOUT);
});
});
2 changes: 2 additions & 0 deletions layers/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ import { defineProject } from 'vitest/config';
export default defineProject({
test: {
environment: 'node',
hookTimeout: 1_000 * 60 * 10, // 10 minutes
testTimeout: 1_000 * 60 * 3, // 3 minutes
},
});
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"typedoc-plugin-missing-exports": "^3.1.0",
"typedoc-plugin-zod": "^1.4.0",
"typescript": "^5.8.2",
"vitest": "^3.0.5"
"vitest": "^3.0.9"
},
"lint-staged": {
"*.{js,ts}": "biome check --write",
Expand Down
5 changes: 0 additions & 5 deletions packages/idempotency/tests/e2e/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
export const RESOURCE_NAME_PREFIX = 'Idempotency';

export const ONE_MINUTE = 60 * 1_000;
export const TEARDOWN_TIMEOUT = 5 * ONE_MINUTE;
export const SETUP_TIMEOUT = 7 * ONE_MINUTE;
export const TEST_CASE_TIMEOUT = 5 * ONE_MINUTE;
Loading