Skip to content

feat: end-to-end tests for core modules and idempotency#970

Merged
jeromevdl merged 14 commits into
aws-powertools:masterfrom
jeromevdl:feat/integration-tests
Mar 21, 2023
Merged

feat: end-to-end tests for core modules and idempotency#970
jeromevdl merged 14 commits into
aws-powertools:masterfrom
jeromevdl:feat/integration-tests

Conversation

@jeromevdl

Copy link
Copy Markdown
Contributor

Description of changes:

Adding end-to-end tests (happy path) for core modules (logging, metrics, tracing) and idempotency. Leverage AWS CDK + S3 and CloudFormation SDK to deploy a Lambda function and the appropriate infrastructure (ex: DDB table for idempotency).

Checklist

Breaking change checklist

RFC issue #:

  • Migration process documented
  • Implement warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jeromevdl jeromevdl changed the title Feat: end-to-end tests for core modules and idempotency feat: end-to-end tests for core modules and idempotency Nov 4, 2022
@jeromevdl
jeromevdl force-pushed the feat/integration-tests branch from 14d5059 to 94252a4 Compare November 7, 2022 12:56
@jeromevdl

jeromevdl commented Nov 7, 2022

Copy link
Copy Markdown
Contributor Author

For some reason I don't explain, I cannot set the GitHub Action for e2e tests. I pause on this, already spent too much time.
@msailes if you wanna give a try... Also if you can review the code, and test locally.

This is what I used:

name: Run end-to-end tests

on:
  workflow_dispatch:

  pull_request: # temporary for testing the workflow itself
    branches:
      - master
    paths:
      - 'powertools-e2e-tests/**'
      - '.github/workflows/**'

  push:
    branches: [master]
    paths: # add other modules when there are under e2e tests
      - 'powertools-e2e-tests/**'
      - 'powertools-core/**'
      - 'powertools-serialization/**'
      - 'powertools-logging/**'
      - 'powertools-tracing/**'
      - 'powertools-idempotency/**'
      - 'powertools-metrics/**'
      - 'pom.xml'
      - '.github/workflows/**'

jobs:
  e2e:
    runs-on: ubuntu-latest
    env:
      JAVA_VERSION: ${{ matrix.java }}
      AWS_DEFAULT_REGION: eu-west-1
    permissions:
      id-token: write # needed to interact with GitHub's OIDC Token endpoint.
      contents: read
    strategy:
      max-parallel: 2
      matrix:
        java: [ 8, 11 ]
    name: End-to-end tests ${{ matrix.java }}
    steps:
      - uses: actions/checkout@v3
      - name: Setup java
        uses: actions/setup-java@v3
        with:
          distribution: 'corretto'
          java-version: ${{ matrix.java }}
          cache: maven
      - name: Setup AWS credentials
        uses: aws-actions/configure-aws-credentials@master
        with:
          role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
          role-session-name: AWSSession
          aws-region: ${{ env.AWS_DEFAULT_REGION }}
      - name: Run e2e test with Maven
        run: mvn -Pe2e -B verify --file powertools-e2e-tests/pom.xml

And the error : aws-actions/configure-aws-credentials#460.

@scottgerring
scottgerring self-requested a review February 10, 2023 11:40

@scottgerring scottgerring left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeromevdl some quick initial feedback to get the ball rolling. I need to dive a bit deeper into this still.

Comment thread powertools-e2e-tests/README.md Outdated
Comment thread powertools-e2e-tests/README.md Outdated
Comment thread powertools-e2e-tests/pom.xml
private Stack createStackWithLambda() {
Stack stack = new Stack(app, stackName);
List<String> packagingInstruction = Arrays.asList(
"/bin/sh",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the powertools test suite otherwise run on windows?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question... I don't know!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does - tested quickly on windows - do we want to maintain that?

Comment thread powertools-e2e-tests/pom.xml Outdated
Comment thread .github/workflows/build.yml
Comment thread powertools-e2e-tests/pom.xml
Comment thread powertools-e2e-tests/README.md
Comment thread powertools-e2e-tests/handlers/idempotency/pom.xml Outdated
Comment thread powertools-e2e-tests/handlers/logging/pom.xml Outdated
Comment thread powertools-e2e-tests/handlers/logging/pom.xml Outdated
Comment thread powertools-e2e-tests/handlers/logging/pom.xml Outdated
Comment thread powertools-e2e-tests/handlers/logging/pom.xml Outdated
@scottgerring

Copy link
Copy Markdown
Contributor

Hey @jeromevdl i've gone through the whole PR now and marked up some bits. Let me know if I there's anything else I can do to help.

@jeromevdl

Copy link
Copy Markdown
Contributor Author

We have our answers, obviously it cannot work on java 8... 🤬 Will have to make it compatible 😫

@jeromevdl
jeromevdl requested a review from scottgerring March 17, 2023 14:31
scottgerring
scottgerring previously approved these changes Mar 17, 2023

@scottgerring scottgerring left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@scottgerring

Copy link
Copy Markdown
Contributor

For some reason I don't explain, I cannot set the GitHub Action for e2e tests. I pause on this, already spent too much time. @msailes if you wanna give a try... Also if you can review the code, and test locally.

This is what I used:

name: Run end-to-end tests

on:
  workflow_dispatch:

  pull_request: # temporary for testing the workflow itself
    branches:
      - master
    paths:
      - 'powertools-e2e-tests/**'
      - '.github/workflows/**'

  push:
    branches: [master]
    paths: # add other modules when there are under e2e tests
      - 'powertools-e2e-tests/**'
      - 'powertools-core/**'
      - 'powertools-serialization/**'
      - 'powertools-logging/**'
      - 'powertools-tracing/**'
      - 'powertools-idempotency/**'
      - 'powertools-metrics/**'
      - 'pom.xml'
      - '.github/workflows/**'

jobs:
  e2e:
    runs-on: ubuntu-latest
    env:
      JAVA_VERSION: ${{ matrix.java }}
      AWS_DEFAULT_REGION: eu-west-1
    permissions:
      id-token: write # needed to interact with GitHub's OIDC Token endpoint.
      contents: read
    strategy:
      max-parallel: 2
      matrix:
        java: [ 8, 11 ]
    name: End-to-end tests ${{ matrix.java }}
    steps:
      - uses: actions/checkout@v3
      - name: Setup java
        uses: actions/setup-java@v3
        with:
          distribution: 'corretto'
          java-version: ${{ matrix.java }}
          cache: maven
      - name: Setup AWS credentials
        uses: aws-actions/configure-aws-credentials@master
        with:
          role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
          role-session-name: AWSSession
          aws-region: ${{ env.AWS_DEFAULT_REGION }}
      - name: Run e2e test with Maven
        run: mvn -Pe2e -B verify --file powertools-e2e-tests/pom.xml

And the error : aws-actions/configure-aws-credentials#460.

@jeromevdl the one question I have is - did you get this running in the github builds in the end?

@jeromevdl

Copy link
Copy Markdown
Contributor Author

@jeromevdl the one question I have is - did you get this running in the github builds in the end?

@scottgerring Nope, was not working... I don't know why, if you want to have a look.

@mriccia

mriccia commented Mar 21, 2023

Copy link
Copy Markdown
Contributor

LGTM

@mriccia mriccia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@jeromevdl
jeromevdl merged commit 1561632 into aws-powertools:master Mar 21, 2023
@jeromevdl
jeromevdl deleted the feat/integration-tests branch March 21, 2023 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Shipped

Development

Successfully merging this pull request may close these issues.

3 participants