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

Set up testcontainers #60

Open
4 of 7 tasks
carlspring opened this issue Aug 26, 2020 · 3 comments
Open
4 of 7 tasks

Set up testcontainers #60

carlspring opened this issue Aug 26, 2020 · 3 comments
Assignees
Labels
ghc2020 Issues suitable for the Grace Hopper 2020 hackfest hacktoberfest Pre-selected issues for Hacktoberfest help wanted Extra attention is needed on hold

Comments

@carlspring
Copy link
Owner

carlspring commented Aug 26, 2020

Task Description

We should consider setting up our tests to use testcontainers.

Tasks

The following tasks will need to be carried out:

  • Investigate what needs to be done to get things working (and document the findings here).
  • Investigate, if we can somehow have parameterized (JUnit 5) integration tests that can work with both testcontainers and Amazon. - We'll be using JUnit Tags for now (see Use tags instead of suites to separate tests #183)
  • Set up testcontainers so it starts the container and tests when -Pit-minio is used.
  • Enable MinIO as part of the GH Actions pipeline.
  • Create a JUnit extension to start the MinIO testcontainer and use it in @MinioIntegrationTest with @ExtendWith in tests that can run against MinIO. An exampe of how to do this can be found here.
  • Make integration tests use the correct URI when creating the filesystem depending on the running.it property (i.e. for S3 s3://s3.amazonaws.com/ and s3://localhost:9000/ for MinIO). Perhaps it would be a good idea to add this into the BaseIntegrationTest as a method which generates the appropriate URI for you.
  • Configure integration tests to use testcontainers via @MinioIntegrationTest where this is possible. Some integration tests can be ran against S3 and MinIO since the APIs are compatible. If that is possible, then the test can be annotated with both @S3IntegrationTest and @MinioIntegrationTest.

Task Relationships

This task:

Help

@carlspring carlspring added help wanted Extra attention is needed hacktoberfest Pre-selected issues for Hacktoberfest ghc2020 Issues suitable for the Grace Hopper 2020 hackfest labels Aug 26, 2020
@carlspring carlspring modified the milestone: 1.0.0 Jan 23, 2021
@mslowiak
Copy link
Contributor

I have some implementation idea to proceed with that task.

  1. We can have system property when running tests such as testEnvironment.
  2. We would call integration tests with mvn clean install -Pintegration-tests -DtestEnvironment={value}.
  3. The value property can be MIN_IO and AMAZON_S3.
  4. When you do not specify the testEnvironment property MIN_IO will be a default one.
  5. Each integration test will extend the IntegrationTestBase class which will have @BeforeAll method annotated to run testcontainers if testEnvironment property is MIN_IO.

@carlspring @steve-todorov
What are your thoughts about this solution?

@carlspring
Copy link
Owner Author

Hi @mslowiak ,

I don't think the idea with the property would be the best one. We should use Maven profiles for this instead. You might want to run just the MinIO tests locally while you're developing something, but then again, when things are executed on the CI server, both profiles would be enabled.

Also, @steve-todorov is working on #184, which would be somewhat related, so feel free to have a look at it.

@steve-todorov
Copy link
Collaborator

steve-todorov commented Jan 25, 2021

@mslowiak I've done something similar as part of #183 (PR-184). I've created two profiles it-s3 for s3 integration tests and it-minio for minio ones. If you use -Pit-s3 it can pick up S3FS_* env variables so you can run this in a container. Same goes for -Pit-minio which picks up S3FS_MINIO_* ones. Tests tagged with @MinioIntegrationTest or @S3IntegrationTest will be executed using the appropriate credentials. :)

I haven't looked into test containers that much, but maybe we could use a singleton instance which starts at the very beginning and we just expose those credentials as env variables?

mslowiak added a commit to mslowiak/s3fs-nio that referenced this issue Jan 26, 2021
mslowiak added a commit to mslowiak/s3fs-nio that referenced this issue Jan 26, 2021
@carlspring carlspring added the in progress Work is in progress label Jan 26, 2021
mslowiak added a commit to mslowiak/s3fs-nio that referenced this issue Jan 27, 2021
mslowiak added a commit to mslowiak/s3fs-nio that referenced this issue Jan 27, 2021
mslowiak added a commit to mslowiak/s3fs-nio that referenced this issue Jan 28, 2021
mslowiak added a commit to mslowiak/s3fs-nio that referenced this issue Jan 28, 2021
@carlspring carlspring removed this from the 1.0.0 milestone May 23, 2023
@steve-todorov steve-todorov added on hold and removed in progress Work is in progress labels Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ghc2020 Issues suitable for the Grace Hopper 2020 hackfest hacktoberfest Pre-selected issues for Hacktoberfest help wanted Extra attention is needed on hold
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants