carlspring / s3fs-nio

A Java (NIO2) FileSystem Provider for Amazon AWS S3.
https://s3fs-nio.carlspring.org/
66 stars 24 forks source link

Set up testcontainers #60

Open carlspring opened 4 years ago

carlspring commented 4 years ago

Task Description

We should consider setting up our tests to use testcontainers.

Tasks

The following tasks will need to be carried out:

Task Relationships

This task:

Help

mslowiak commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

@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?