Fix createViewWithCustomMetadataLocation tests for cloudTest task#2405
Fix createViewWithCustomMetadataLocation tests for cloudTest task#2405tmater wants to merge 3 commits intoapache:mainfrom
Conversation
|
|
||
| /** Runs PolarisRestCatalogViewIntegrationTest on AWS. */ | ||
| public class PolarisRestCatalogViewAwsIntegrationTest | ||
| public abstract class PolarisRestCatalogViewAwsIntegrationTestBase |
There was a problem hiding this comment.
Since we're renaming this type anyway, let's better use the protocol name, not the vendor name.
| public abstract class PolarisRestCatalogViewAwsIntegrationTestBase | |
| public abstract class PolarisRestCatalogViewS3IntegrationTestBase |
There was a problem hiding this comment.
Shall I change these 3 (non-view test bases) as well in one go:
- PolarisRestCatalogAwsIntegrationTestBase
- PolarisRestCatalogAzureIntegrationTestBase
- PolarisRestCatalogGcpIntegrationTestBase
Also the 6 implementations:
- RestCatalogAwsIT
- RestCatalogAzureIT
- RestCatalogGcpIT
- RestCatalogViewAwsIT
- RestCatalogViewAzureIT
- RestCatalogViewGcpIT
There was a problem hiding this comment.
Mean, we support MinIO and a bunch of other S3 compatible systems, not only AWS. Sure, we could argue about GCS or ADLS. However, GCS and ADLS are specific, where a vendor name or "product suite" name are not.
There was a problem hiding this comment.
Makes sense, renamed the classes and related parts.
| import java.util.List; | ||
| import java.util.Optional; | ||
| import java.util.stream.Stream; | ||
| import org.apache.hadoop.fs.Path; |
There was a problem hiding this comment.
Hm, sure, this is just a test, but could we avoid Hadoop dependencies?
There was a problem hiding this comment.
The idea behind Hadoop Path came because Iceberg does something "funky" with the metadataFileLocation() that resembles Hadoop Path behavior: It normalizes the scheme file:///... to file:/..., but it keeps s3://... as s3://....
For the assertion later I couldn't use java.nio.Path because that normalizes the scheme and creates an incorrect s3:/... path.
Just dug a bit more, I found a reference to Hadoop Path in Iceberg's LocationProviders:24, maybe this is how they do it as well, I could not find the exact location where it gets normalized.
I’m open to other approaches, but the only solution that came to mind was writing a custom assertion, which I’m also happy with.
There was a problem hiding this comment.
Argh - the damn file URI scheme is so ambiguous (IMHO, because of multiple representations for the same thing, legacy representations, risk of interpreting those wrong).
If it's just about eliminating all host related parts, I'd say let's just use a regex to "fix" the paths?
Something like
protected static final Pattern FILE_LOCATION_PATTERN =
Pattern.compile("file:/*(.*)");
protected String fixFileUri(String location) {
var m = FILE_LOCATION_PATTERN.matcher(location);
return m.matches() ? "file:/" + m.group(1) : location;
}WDYT? Would that work?
There was a problem hiding this comment.
Just FYI In Polaris we have:
org.apache.polaris.core.storage.StorageLocationwhich standardizes file URIs to"file:///- but
InMemoryStorageIntegrationdoes the opposite 😅 :
There was a problem hiding this comment.
Hm - maybe let's ignore the file scheme specialty and just assume that it's "correct" if supplied.
There was a problem hiding this comment.
Good point, I used java.nio.file.Path to remove the scheme.
...in/java/org/apache/polaris/service/it/test/PolarisRestCatalogViewGcpIntegrationTestBase.java
Outdated
Show resolved
Hide resolved
.../java/org/apache/polaris/service/it/test/PolarisRestCatalogViewAzureIntegrationTestBase.java
Outdated
Show resolved
Hide resolved
This patch fixes the createViewWithCustomMetadataLocation tests for cloudTest tasks. The original test was generating temp directories internally, causing cloudTests to fail with BadRequestException instead of the expected ForbiddenException. Changes: - Switched to Hadoop's Path (Java Path removes slashes, e.g. s3://bucket/path -> s3:/bucket/path) - Made base classes abstract to avoid running them - Implemented createViewWithCustomMetadataLocation to allow passing a custom location Testing: - Verified locally
| protected String getCustomMetadataLocationDir() { | ||
| return ""; | ||
| } |
There was a problem hiding this comment.
| protected String getCustomMetadataLocationDir() { | |
| return ""; | |
| } | |
| protected abstract String getCustomMetadataLocationDir(); |
| private static PolarisClient client; | ||
| private static ManagementApi managementApi; | ||
| protected static final String POLARIS_IT_SUBDIR = "polaris_it"; | ||
| protected static final String POLARIS_IT_CUSTOM_SUBDIR = "polaris_it_custom"; |
There was a problem hiding this comment.
This constant seems unused.
| protected boolean shouldSkip() { | ||
| return Stream.of(BASE_LOCATION, TENANT_ID).anyMatch(Strings::isNullOrEmpty); | ||
| protected String getCustomMetadataLocationDir() { | ||
| return StorageUtil.concatFilePrefixes(BASE_LOCATION, POLARIS_IT_SUBDIR, File.separator); |
There was a problem hiding this comment.
Shouldn't this be:
| return StorageUtil.concatFilePrefixes(BASE_LOCATION, POLARIS_IT_SUBDIR, File.separator); | |
| return StorageUtil.concatFilePrefixes(BASE_LOCATION, POLARIS_IT_CUSTOM_SUBDIR, File.separator); |
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
* Update dependency com.fasterxml.jackson:jackson-bom to v2.20.1 (apache#2949) * Update dependency com.github.jk1:gradle-license-report to v3 (apache#2958) * Fix typos and spelling issues identified by codespell (apache#2959) * Fix findings with codespell * Fix findings with codespell * Fix regtest doc (apache#2955) * fix(deps): update dependency software.amazon.awssdk:bom to v2.37.3 (apache#2960) * Refactor Polaris cloudTests and adopt changes from PR apache#2405 (apache#2871) * Last merged commit 4a80c51 --------- Co-authored-by: Mend Renovate <bot@renovateapp.com> Co-authored-by: Yong Zheng <yongzheng0809@gmail.com> Co-authored-by: Tamas Mate <50709850+tmater@users.noreply.github.com>
This patch fixes the
createViewWithCustomMetadataLocationtests forcloudTesttasks. The original test was generating temp directories internally, causingcloudTests to fail withBadRequestExceptioninstead of the expectedForbiddenException.Changes:
abstractto avoid running themcreateViewWithCustomMetadataLocationto allow passing a custom locationTesting: