-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add Delta Lake product tests #11565
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
Merged
findepi
merged 7 commits into
trinodb:master
from
findinpath:oss-delta-lake-product-tests
May 24, 2022
Merged
Add Delta Lake product tests #11565
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
16ed6d4
Extract MinIO client functionality to trino-testing-containers module
findinpath aec4492
Add MinIO environment extender
findinpath 483fc43
Remove unused files
findinpath 9810123
Move testing resources to trino-testing-resources
findinpath 4a81969
Add Delta Lake product tests
findinpath 375d690
empty
findinpath d1e2a88
empty
findinpath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...roduct-tests-launcher/src/main/java/io/trino/tests/product/launcher/env/common/Minio.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.trino.tests.product.launcher.env.common; | ||
|
|
||
| import com.google.common.collect.ImmutableMap; | ||
| import io.trino.tests.product.launcher.docker.DockerFiles; | ||
| import io.trino.tests.product.launcher.env.DockerContainer; | ||
| import io.trino.tests.product.launcher.env.Environment; | ||
| import io.trino.tests.product.launcher.testcontainers.PortBinder; | ||
| import org.testcontainers.containers.startupcheck.IsRunningStartupCheckStrategy; | ||
|
|
||
| import javax.inject.Inject; | ||
|
|
||
| import java.time.Duration; | ||
|
|
||
| import static io.trino.tests.product.launcher.docker.ContainerUtil.forSelectedPorts; | ||
| import static io.trino.tests.product.launcher.env.EnvironmentContainers.HADOOP; | ||
| import static io.trino.tests.product.launcher.env.common.Hadoop.CONTAINER_HADOOP_INIT_D; | ||
| import static java.lang.String.format; | ||
| import static java.util.Objects.requireNonNull; | ||
| import static org.testcontainers.utility.MountableFile.forHostPath; | ||
|
|
||
| public class Minio | ||
| implements EnvironmentExtender | ||
| { | ||
| private final DockerFiles dockerFiles; | ||
|
|
||
| public static final String MINIO_CONTAINER_NAME = "minio"; | ||
|
|
||
| private static final String MINIO_ACCESS_KEY = "minio-access-key"; | ||
| private static final String MINIO_SECRET_KEY = "minio-secret-key"; | ||
| private static final String MINIO_RELEASE = "RELEASE.2021-07-15T22-27-34Z"; | ||
|
|
||
| private static final int MINIO_PORT = 9080; // minio uses 9000 by default, which conflicts with hadoop | ||
|
|
||
| private final PortBinder portBinder; | ||
|
|
||
| @Inject | ||
| public Minio(DockerFiles dockerFiles, PortBinder portBinder) | ||
| { | ||
| this.dockerFiles = requireNonNull(dockerFiles, "dockerFiles is null"); | ||
| this.portBinder = requireNonNull(portBinder, "portBinder is null"); | ||
| } | ||
|
|
||
| @Override | ||
| public void extendEnvironment(Environment.Builder builder) | ||
| { | ||
| builder.addContainer(createMinioContainer()); | ||
|
|
||
| builder.configureContainers(container -> { | ||
| if (container.getLogicalName().equals(HADOOP)) { | ||
| container.withCopyFileToContainer( | ||
| forHostPath(dockerFiles.getDockerFilesHostPath("common/minio/apply-minio-config.sh")), | ||
| CONTAINER_HADOOP_INIT_D + "apply-minio-config.sh"); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| private DockerContainer createMinioContainer() | ||
| { | ||
| DockerContainer container = new DockerContainer("minio/minio:" + MINIO_RELEASE, MINIO_CONTAINER_NAME) | ||
| .withEnv(ImmutableMap.<String, String>builder() | ||
| .put("MINIO_ACCESS_KEY", MINIO_ACCESS_KEY) | ||
| .put("MINIO_SECRET_KEY", MINIO_SECRET_KEY) | ||
| .buildOrThrow()) | ||
| .withCommand("server", "--address", format("0.0.0.0:%d", MINIO_PORT), "/data") | ||
| .withStartupCheckStrategy(new IsRunningStartupCheckStrategy()) | ||
| .waitingFor(forSelectedPorts(MINIO_PORT)) | ||
| .withStartupTimeout(Duration.ofMinutes(1)); | ||
|
|
||
| portBinder.exposePort(container, MINIO_PORT); | ||
|
|
||
| return container; | ||
| } | ||
| } | ||
94 changes: 94 additions & 0 deletions
94
...o/trino/tests/product/launcher/env/environment/AbstractSinglenodeDeltaLakeDatabricks.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| /* | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.trino.tests.product.launcher.env.environment; | ||
|
|
||
| import io.trino.tests.product.launcher.docker.DockerFiles; | ||
| import io.trino.tests.product.launcher.env.DockerContainer; | ||
| import io.trino.tests.product.launcher.env.Environment; | ||
| import io.trino.tests.product.launcher.env.EnvironmentProvider; | ||
| import io.trino.tests.product.launcher.env.common.Standard; | ||
|
|
||
| import static io.trino.tests.product.launcher.env.EnvironmentContainers.COORDINATOR; | ||
| import static io.trino.tests.product.launcher.env.EnvironmentContainers.TESTS; | ||
| import static io.trino.tests.product.launcher.env.EnvironmentContainers.configureTempto; | ||
| import static io.trino.tests.product.launcher.env.common.Standard.CONTAINER_PRESTO_ETC; | ||
| import static java.lang.String.format; | ||
| import static java.util.Objects.requireNonNull; | ||
| import static org.testcontainers.utility.MountableFile.forHostPath; | ||
|
|
||
| /** | ||
| * Trino with Delta Lake connector and real S3 storage | ||
| */ | ||
| public abstract class AbstractSinglenodeDeltaLakeDatabricks | ||
findinpath marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| extends EnvironmentProvider | ||
| { | ||
| private final DockerFiles dockerFiles; | ||
|
|
||
| abstract String databricksTestJdbcUrl(); | ||
|
|
||
| public AbstractSinglenodeDeltaLakeDatabricks(Standard standard, DockerFiles dockerFiles) | ||
| { | ||
| super(standard); | ||
| this.dockerFiles = requireNonNull(dockerFiles, "dockerFiles is null"); | ||
| } | ||
|
|
||
| @Override | ||
| public void extendEnvironment(Environment.Builder builder) | ||
| { | ||
| String databricksTestJdbcUrl = databricksTestJdbcUrl(); | ||
| String databricksTestJdbcDriverClass = requireNonNull(System.getenv("DATABRICKS_TEST_JDBC_DRIVER_CLASS"), "Environment DATABRICKS_TEST_JDBC_DRIVER_CLASS was not set"); | ||
| String databricksTestLogin = requireNonNull(System.getenv("DATABRICKS_TEST_LOGIN"), "Environment DATABRICKS_TEST_LOGIN was not set"); | ||
| String databricksTestToken = requireNonNull(System.getenv("DATABRICKS_TEST_TOKEN"), "Environment DATABRICKS_TEST_TOKEN was not set"); | ||
| String hiveMetastoreUri = requireNonNull(System.getenv("HIVE_METASTORE_URI"), "Environment HIVE_METASTORE_URI was not set"); | ||
| String s3Bucket = requireNonNull(System.getenv("S3_BUCKET"), "Environment S3_BUCKET was not set"); | ||
| DockerFiles.ResourceProvider configDir = dockerFiles.getDockerFilesHostDirectory("conf/environment/singlenode-delta-lake-databricks"); | ||
|
|
||
| builder.configureContainer(COORDINATOR, dockerContainer -> exportAWSCredentials(dockerContainer) | ||
| .withEnv("HIVE_METASTORE_URI", hiveMetastoreUri) | ||
| .withEnv("DATABRICKS_TEST_JDBC_URL", databricksTestJdbcUrl) | ||
| .withEnv("DATABRICKS_TEST_LOGIN", databricksTestLogin) | ||
| .withEnv("DATABRICKS_TEST_TOKEN", databricksTestToken) | ||
| .withCopyFileToContainer(forHostPath(configDir.getPath("hive.properties")), CONTAINER_PRESTO_ETC + "/catalog/hive.properties") | ||
| .withCopyFileToContainer(forHostPath(configDir.getPath("delta.properties")), CONTAINER_PRESTO_ETC + "/catalog/delta.properties")); | ||
|
|
||
| builder.configureContainer(TESTS, container -> exportAWSCredentials(container) | ||
| .withEnv("S3_BUCKET", s3Bucket) | ||
| .withEnv("DATABRICKS_TEST_JDBC_DRIVER_CLASS", databricksTestJdbcDriverClass) | ||
| .withEnv("DATABRICKS_TEST_JDBC_URL", databricksTestJdbcUrl) | ||
| .withEnv("DATABRICKS_TEST_LOGIN", databricksTestLogin) | ||
| .withEnv("DATABRICKS_TEST_TOKEN", databricksTestToken) | ||
| .withEnv("HIVE_METASTORE_URI", hiveMetastoreUri)); | ||
|
|
||
| configureTempto(builder, configDir); | ||
| } | ||
|
|
||
| private DockerContainer exportAWSCredentials(DockerContainer container) | ||
| { | ||
| container = exportAWSCredential(container, "AWS_ACCESS_KEY_ID", true); | ||
| container = exportAWSCredential(container, "AWS_SECRET_ACCESS_KEY", true); | ||
| return exportAWSCredential(container, "AWS_SESSION_TOKEN", false); | ||
| } | ||
|
|
||
| private DockerContainer exportAWSCredential(DockerContainer container, String credentialEnvVariable, boolean required) | ||
| { | ||
| String credentialValue = System.getenv(credentialEnvVariable); | ||
| if (credentialValue == null) { | ||
| if (required) { | ||
| throw new IllegalStateException(format("Environment variable %s not set", credentialEnvVariable)); | ||
| } | ||
| return container; | ||
| } | ||
| return container.withEnv(credentialEnvVariable, credentialValue); | ||
| } | ||
| } | ||
73 changes: 73 additions & 0 deletions
73
.../main/java/io/trino/tests/product/launcher/env/environment/EnvMultinodeMinioDataLake.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /* | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.trino.tests.product.launcher.env.environment; | ||
|
|
||
| import io.trino.tests.product.launcher.docker.DockerFiles; | ||
| import io.trino.tests.product.launcher.env.DockerContainer; | ||
| import io.trino.tests.product.launcher.env.Environment; | ||
| import io.trino.tests.product.launcher.env.EnvironmentProvider; | ||
| import io.trino.tests.product.launcher.env.common.Hadoop; | ||
| import io.trino.tests.product.launcher.env.common.Minio; | ||
| import io.trino.tests.product.launcher.env.common.StandardMultinode; | ||
| import io.trino.tests.product.launcher.env.common.TestsEnvironment; | ||
|
|
||
| import javax.inject.Inject; | ||
|
|
||
| import static io.trino.tests.product.launcher.env.EnvironmentContainers.COORDINATOR; | ||
| import static io.trino.tests.product.launcher.env.EnvironmentContainers.WORKER; | ||
| import static io.trino.tests.product.launcher.env.common.Hadoop.CONTAINER_PRESTO_HIVE_PROPERTIES; | ||
| import static io.trino.tests.product.launcher.env.common.Hadoop.CONTAINER_PRESTO_ICEBERG_PROPERTIES; | ||
| import static io.trino.tests.product.launcher.env.common.Standard.CONTAINER_PRESTO_ETC; | ||
| import static java.util.Objects.requireNonNull; | ||
| import static org.testcontainers.utility.MountableFile.forHostPath; | ||
|
|
||
| /** | ||
| * Trino with S3-compatible Data Lake setup based on MinIO | ||
| */ | ||
| @TestsEnvironment | ||
| public class EnvMultinodeMinioDataLake | ||
| extends EnvironmentProvider | ||
| { | ||
| private final DockerFiles dockerFiles; | ||
|
|
||
| @Inject | ||
| public EnvMultinodeMinioDataLake(StandardMultinode standardMultinode, Hadoop hadoop, Minio minio, DockerFiles dockerFiles) | ||
| { | ||
| super(standardMultinode, hadoop, minio); | ||
| this.dockerFiles = requireNonNull(dockerFiles, "dockerFiles is null"); | ||
| } | ||
|
|
||
| @Override | ||
| public void extendEnvironment(Environment.Builder builder) | ||
| { | ||
| builder.configureContainer(COORDINATOR, this::configureTrinoContainer); | ||
| builder.configureContainer(WORKER, this::configureTrinoContainer); | ||
| } | ||
|
|
||
| private void configureTrinoContainer(DockerContainer container) | ||
| { | ||
| container.withCopyFileToContainer( | ||
| forHostPath(dockerFiles.getDockerFilesHostPath("conf/environment/singlenode-minio-data-lake/hive.properties")), | ||
| CONTAINER_PRESTO_HIVE_PROPERTIES); | ||
| container.withCopyFileToContainer( | ||
| forHostPath(dockerFiles.getDockerFilesHostPath("conf/environment/singlenode-minio-data-lake/delta.properties")), | ||
| CONTAINER_PRESTO_ETC + "/catalog/delta.properties"); | ||
| container.withCopyFileToContainer( | ||
| forHostPath(dockerFiles.getDockerFilesHostPath("conf/environment/singlenode-minio-data-lake/iceberg.properties")), | ||
| CONTAINER_PRESTO_ICEBERG_PROPERTIES); | ||
| container.withCopyFileToContainer( | ||
| forHostPath(dockerFiles.getDockerFilesHostPath("conf/environment/singlenode-minio-data-lake/memory.properties")), | ||
| CONTAINER_PRESTO_ETC + "/catalog/memory.properties"); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.