Skip to content
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

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

Merged
merged 14 commits into from
Mar 21, 2023

Conversation

jeromevdl
Copy link
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
Copy link
Contributor Author

jeromevdl commented Nov 7, 2022

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
Copy link
Contributor

@scottgerring scottgerring left a comment

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.

powertools-e2e-tests/README.md Outdated Show resolved Hide resolved
powertools-e2e-tests/README.md Outdated Show resolved Hide resolved
powertools-e2e-tests/pom.xml Show resolved Hide resolved
private Stack createStackWithLambda() {
Stack stack = new Stack(app, stackName);
List<String> packagingInstruction = Arrays.asList(
"/bin/sh",
Copy link
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
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
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?

@scottgerring
Copy link
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
Contributor Author

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

scottgerring
scottgerring previously approved these changes Mar 17, 2023
Copy link
Contributor

@scottgerring scottgerring left a comment

Choose a reason for hiding this comment

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

LGTM!

@scottgerring
Copy link
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
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
Copy link
Contributor

mriccia commented Mar 21, 2023

LGTM

Copy link
Contributor

@mriccia mriccia left a comment

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.

None yet

3 participants