Skip to content

Commit 652defc

Browse files
ijemmydreamorosi
andauthored
test(common,logger,metrics): run e2e tests for metrics in both Node runtimes (#678)
* chore(metrics): refactor metrics e2e to make stack and resource name unique * chore(metrics): refactor the decorator test in the same way * chore(metrics): refactor file name to be consistent * chore(logger): refactor logger E2E test to use commons/e2eUtil instead of its own * test(metrics): run e2e tests on both Node12 and Node14 runtime * test(commons): move e2eUtils to an appropriate folder and write unit tests for InvocationLogs * Update packages/commons/jest.config.js Co-authored-by: Andrea Amorosi <[email protected]> * test(logger,metrics): move e2eUtils into the same folder as cdk-cli and don't expose it outside of the package * test(logger,metrics); update test:e2e target to not be specific to package * test(commons): fix unit test for InvocationLogs * chore(commons): remove istanbul ignore line * doc(all): update CONTRIBUTING.md to refer to v2 Co-authored-by: Andrea Amorosi <[email protected]>
1 parent e2a9132 commit 652defc

18 files changed

+675
-723
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ You can run each group separately or all together thanks to [jest-runner-groups]
101101

102102
Unit tests, under `tests/unit` folder, are standard [Jest](https://jestjs.io) tests.
103103

104-
End-to-end tests, under `tests/e2e` folder, will test the module features by deploying AWS Lambda functions into your AWS Account. We use [aws-cdk](https://docs.aws.amazon.com/cdk/v1/guide/getting_started.html) v1 library (not v2 due to [this cdk issue](https://github.com/aws/aws-cdk/issues/18211)) for TypeScript for creating infrastructure, and [aws-sdk-js v2](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/) for invoking the functions and asserting on the expected behaviors. All steps are also executed by Jest.
104+
End-to-end tests, under `tests/e2e` folder, will test the module features by deploying AWS Lambda functions into your AWS Account. We use [aws-cdk](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html) v2 library with TypeScript for creating infrastructure, and [aws-sdk-js v2](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/) for invoking the functions and asserting on the expected behaviors. All steps are also executed by Jest.
105105

106106
Running end-to-end tests will deploy AWS resources. You will need an AWS account, and the tests might incur costs. The cost from **some services** are covered by the [AWS Free Tier](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all) but not all of them. If you don't have an AWS Account, follow [these instructions to create one](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/).
107107

@@ -133,7 +133,7 @@ To run unit tests, you can either use:
133133

134134
##### Set up
135135

136-
We create e2e testing infrastructure with CDK. If you have never used it before, please check its [Getting started guide](https://docs.aws.amazon.com/cdk/v1/guide/getting_started.html). You need to run `cdk bootstrap` in the account and region you are going to run e2e tests in.
136+
We create e2e testing infrastructure with CDK. If you have never used it before, please check its [Getting started guide](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html). You need to run `cdk bootstrap` in the account and region you are going to run e2e tests in.
137137

138138
##### Write
139139

@@ -147,7 +147,9 @@ As mentioned in the previous section, tests are split into groups thanks to [jes
147147
*/
148148
```
149149

150-
See `metrics/tests/e2e/decorator.test.ts` as an example.
150+
Follow this convention for the test filename: `<TESTED_FEATURE>.<USAGE_TYPE>.test.ts`. (e.g. `sampleRate.decorator.test.ts`, `childLogger.manual.test.ts`)
151+
152+
See `metrics/tests/e2e/basicFeatures.decorator.test.ts` as an example.
151153

152154
##### Run
153155

0 commit comments

Comments
 (0)