Skip to content

Commit

Permalink
fix(DBInstance): handle cases where both previous and desired allocat…
Browse files Browse the repository at this point in the history
…ed storage are null
  • Loading branch information
kylenie-aws committed Jul 12, 2024
1 parent 980c8df commit 440766b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,6 @@ public static MasterUserSecret translateMasterUserSecret(final software.amazon.a
}

private static Integer max(Integer a, Integer b) {
return a == null ? b : b == null ? a : Math.max(a, b);
return a == null ? b : b == null ? a : Integer.valueOf(Math.max(a, b));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ public void test_modifyDbInstanceRequest_isRollback_IncreaseAllocatedStorage() {
assertThat(request.allocatedStorage()).isNull();
}

@Test
public void test_modifyDbInstanceRequest_isRollback_NoAllocatedStorage() {
final ResourceModel previousModel = RESOURCE_MODEL_BLDR()
.allocatedStorage(null)
.build();
final ResourceModel desiredModel = RESOURCE_MODEL_BLDR()
.allocatedStorage(null)
.storageType(STORAGE_TYPE_IO1)
.build();
final Boolean isRollback = true;
final ModifyDbInstanceRequest request = Translator.modifyDbInstanceRequest(previousModel, desiredModel, isRollback);
assertThat(request.allocatedStorage()).isNull();
}

@Test
public void test_modifyDbInstanceRequestV12_isRollback_IncreaseAllocatedStorage() {
final ResourceModel previousModel = RESOURCE_MODEL_BLDR()
Expand Down

0 comments on commit 440766b

Please sign in to comment.