spring-cloud-aws icon indicating copy to clipboard operation
spring-cloud-aws copied to clipboard

Introduce Testcontainers & LocalStack to run integration

Open rieckpil opened this issue 3 years ago • 6 comments

Is your feature request related to a problem?

  • Running the current integration tests requires spawning resources in AWS
  • The setup for this requires some manual effort (see README)
  • Spring Cloud AWS does not execute the integration tests by default

Describe the solution you'd like

With the help of Testcontainers and LocalStack we can mirror AWS resources locally using Docker containers and save $

Describe alternatives you've considered

Simplify the AWS resource setup or ask AWS for some free budget for running the integration test.

Things to consider

  • Not sure if there are some corner cases for AWS resources that LocalStack does not support

rieckpil avatar Jun 07 '20 16:06 rieckpil

I could start working on a first POC and maybe convert a first old integration test to this new setup.

Some questions I would have for this:

  • Should we still put them in a own Maven module spring-cloud-aws-integration-test package or make them part of each specific module (e.g. SQS integration tests inside the messaging module)
  • In regards to https://github.com/spring-cloud/spring-cloud-aws/issues/566 I guess new tests should use JUnit 5

rieckpil avatar Jun 07 '20 16:06 rieckpil

Thanks @rieckpil for taking care of it! I believe there will be a still small number of tests that will have to touch real AWS environment - I would keep them in in spring-cloud-aws-integration-test module. The rest as you suggested - SQS integration tests go to messaging module.

Let's write new tests in JUnit 5 only double check please that both are executed by surefire plugin.

maciejwalkowiak avatar Jun 07 '20 19:06 maciejwalkowiak

@rieckpil you can use branch 2.3.x

eddumelendez avatar Jun 07 '20 22:06 eddumelendez

Regarding JUnit5, I could take a swing at moving the project over to the JUnit5 Jupiter APIs. There doesn't appear to be anything stopping it from an initial attempt. Some ExpectedException rules which could easily be replaced by Assertations#assertThatCode

DarrenForsythe avatar Jun 08 '20 21:06 DarrenForsythe

For me it's okay. I am not touching any existing tests and rather create a new one, so this shouldn't clash

rieckpil avatar Jun 09 '20 06:06 rieckpil

It would be nice if you can write some doc about it share. Great take away from this effort can be applied to elsewhere in other projects in the industry IMO. Just a suggestion given your time constraints.

tmnuwan12 avatar Jun 09 '20 14:06 tmnuwan12