kfaraz commented on code in PR #19158: URL: https://github.com/apache/druid/pull/19158#discussion_r2938527195
########## embedded-tests/src/test/java/org/apache/druid/testing/embedded/hdfs/HdfsToAzureParallelIndexTest.java: ########## @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.druid.testing.embedded.hdfs; + +import org.apache.druid.java.util.common.Pair; +import org.apache.druid.java.util.common.logger.Logger; +import org.apache.druid.testing.embedded.EmbeddedDruidCluster; +import org.apache.druid.testing.embedded.azure.AzureStorageResource; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +/** + * Embedded parallel index test that reads input data from HDFS (in-process MiniDFSCluster) + * and stores segments in Azure Blob Storage (Azurite testcontainer). + */ +public class HdfsToAzureParallelIndexTest extends AbstractHdfsInputSourceParallelIndexTest +{ + private static final Logger LOG = new Logger(HdfsToAzureParallelIndexTest.class); + + /** HDFS is the input source only — deep storage is Azure. */ + private final HdfsStorageResource hdfsResource = new HdfsStorageResource(false); + private final AzureStorageResource azureResource = new AzureStorageResource(); + + @Override + protected HdfsStorageResource getHdfsResource() + { + return hdfsResource; + } + + @Override + protected void addResources(EmbeddedDruidCluster cluster) + { + // HDFS resource: starts the MiniDFSCluster and sets hadoop.fs.defaultFS so the indexer + // can read from HDFS. It does NOT configure Azure-overriding deep-storage properties. + cluster.addResource(hdfsResource); + + // Azure resource: configures Azure as deep storage (druid.storage.type=azure, etc.). + // Adding it after the HDFS resource ensures Azure's deep-storage settings are not + // overridden by anything the HDFS resource might set. + // AzureStorageResource.onStarted() registers AzureStorageDruidModule automatically. + cluster.addResource(azureResource); + } + + @AfterAll + public void deleteSegmentsFromAzure() + { + try { + // The AzureStorageResource creates the container; deleting it cleans up all segments + // written during the test run. + azureResource.getStorageClient() + .getContainerReference(azureResource.getAzureContainerName()) + .deleteIfExists(); Review Comment: Ah, I missed that. I thought `deleteStorageContainer()` method was defined on the `AzureStorageResource` itself. But yes, looking at the code again, I think it would make sense to reuse `AzureTestUtil` for this new test. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
