From 8d84383f3c51ff3eaa52d70394d9d3217b97e927 Mon Sep 17 00:00:00 2001 From: Andy Huang Date: Mon, 20 Mar 2023 20:24:10 -0700 Subject: [PATCH] Dockerize the application --- .env.dist | 9 +++++++++ Dockerfile | 19 +++++++++++++++++++ Readme.md | 10 ++++++++++ m2_settings.xml.dist | 10 ++++++++++ 4 files changed, 48 insertions(+) create mode 100644 .env.dist create mode 100644 Dockerfile create mode 100644 m2_settings.xml.dist diff --git a/.env.dist b/.env.dist new file mode 100644 index 0000000..90597f1 --- /dev/null +++ b/.env.dist @@ -0,0 +1,9 @@ +BUCKET_NAME_1=test-accessible-bucket +REGION_1=us-west-2 +REGION_2=us-east-1 +S3COMPAT_ACCESS_KEY=AKIA... +S3COMPAT_SECRET_KEY=SECRET... +END_POINT=my-s3-endpoint.company.com +NOT_ACCESSIBLE_BUCKET=test-not-accessible-bucket +PREFIX_FOR_PAGE_LISTING=test/prefix/ +PAGE_LISTING_TOTAL_SIZE=1000 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2bd697e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM maven:3.9 + +ENV BUCKET_NAME_1 test-accessible-bucket +ENV REGION_1 us-west-2 +ENV REGION_2 us-east-1 +ENV S3COMPAT_ACCESS_KEY AKIA... +ENV S3COMPAT_SECRET_KEY SECRET... +ENV END_POINT my-s3-endpoint.company.com +ENV NOT_ACCESSIBLE_BUCKET test-not-accessible-bucket +ENV PREFIX_FOR_PAGE_LISTING test/prefix/ +ENV PAGE_LISTING_TOTAL_SIZE 1000 + +COPY . /snowflake-s3compat-api-test-suite/ +WORKDIR /snowflake-s3compat-api-test-suite/ +RUN --mount=type=secret,id=m2settings,dst=/root/.m2/settings.xml \ + mvn clean install -DskipTests + +ENTRYPOINT ["mvn", "test"] +CMD ["-Dtest=S3CompatApiTest"] diff --git a/Readme.md b/Readme.md index 759e511..22282d6 100644 --- a/Readme.md +++ b/Readme.md @@ -129,6 +129,16 @@ If all of your APIs pass the tests in this repo, please refer to our public docu [Using On-Premises Data in Place with Snowflake](https://www.snowflake.com/blog/external-tables-on-prem/) +## Docker +In situations where no Java development environment is available, the test suite has been dockerized for ease of access. The container image can be built and ran using these commands (be sure to +haev the applicable m2 settings (check dist) and environment variables set (again, check dist): + +``` +DOCKER_BUILDKIT=1 docker build -t s3compat-api-test-suite --secret id=m2settings,src=/Users/username/.m2/settings.xml . +docker run --rm -it --env-file ./.env s3compat-api-test-suite +``` + + ## Troubleshooting We expect the storage vendors provide S3-compatible APIs, which should work like S3 APIs. We have observed there are still differences between storage vendors. Below are some troubleshooting tips. When your tests fail, please refer to the source code to see what are the test cases. diff --git a/m2_settings.xml.dist b/m2_settings.xml.dist new file mode 100644 index 0000000..6c50e62 --- /dev/null +++ b/m2_settings.xml.dist @@ -0,0 +1,10 @@ + + + + github + your github username + your github access token + + +