Skip to content

Commit

Permalink
Fix 582
Browse files Browse the repository at this point in the history
  • Loading branch information
MonkeyCanCode committed Dec 21, 2024
1 parent 5c3eeea commit 145ecc7
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -918,14 +918,14 @@ public void testCreateListUpdateAndDeleteCatalog() {
}

// Reject update of fields that can't be currently updated
StorageConfigInfo modifiedStorageConfig =
StorageConfigInfo invalidModifiedStorageConfig =
new AwsStorageConfigInfo(
"arn:aws:iam::123456789011:role/newrole", StorageConfigInfo.StorageTypeEnum.S3);
"arn:aws:iam::123456789012:role/newrole", StorageConfigInfo.StorageTypeEnum.S3);
UpdateCatalogRequest badUpdateRequest =
new UpdateCatalogRequest(
fetchedCatalog.getEntityVersion(),
Map.of("default-base-location", "s3://newbucket/"),
modifiedStorageConfig);
invalidModifiedStorageConfig);
try (Response response =
newRequest("http://localhost:%d/api/management/v1/catalogs/mycatalog")
.put(Entity.json(badUpdateRequest))) {
Expand All @@ -939,11 +939,16 @@ public void testCreateListUpdateAndDeleteCatalog() {
.startsWith("Cannot modify");
}

// Allow update of fields that are support (e.g. new default-base-location and role ARN when AWS
// account IDs are same)
StorageConfigInfo validModifiedStorageConfig =
new AwsStorageConfigInfo(
"arn:aws:iam::123456789011:role/newrole", StorageConfigInfo.StorageTypeEnum.S3);
UpdateCatalogRequest updateRequest =
new UpdateCatalogRequest(
fetchedCatalog.getEntityVersion(),
Map.of("default-base-location", "s3://newbucket/"),
storageConfig);
validModifiedStorageConfig);

// 200 successful update
try (Response response =
Expand All @@ -954,6 +959,9 @@ public void testCreateListUpdateAndDeleteCatalog() {

assertThat(fetchedCatalog.getProperties().toMap())
.isEqualTo(Map.of("default-base-location", "s3://newbucket/"));
assertThat(fetchedCatalog.getStorageConfigInfo())
.isInstanceOf(AwsStorageConfigInfo.class)
.hasFieldOrPropertyWithValue("roleArn", "arn:aws:iam::123456789011:role/newrole");
}

// 200 GET after update should show new properties
Expand Down

0 comments on commit 145ecc7

Please sign in to comment.