fix(rds): DescribeDBParameterGroups returns DBParameterGroupNotFound for an unknown name (#7066)

* fix(rds): DescribeDBParameterGroups returns DBParameterGroupNotFound for an unknown name

* refactor(rds): reuse getDbParameterGroup for the named DescribeDBParameterGroups lookup

The named branch built its own copy of the DBParameterGroupNotFound
exception. getDbParameterGroup does the same region-scoped lookup and
throws the same error, so call it instead. The test now also pins the
error message.
This commit is contained in:
Allen Sanborn authored and GitHub committed 2026-10-31 14:53:13 -04:00
1 parent b4cd98fb61
commit 9512de107f
2 files changed
+23 -3

No files matched your search

@@ -7524,11 +7524,10 @@ public class RdsService implements Resettable, ResourceProvider {
public Collection<DbParameterGroup> listDbParameterGroups(
String filterName, String region) {
String effectiveRegion = effectiveRegion(region);
if (filterName != null && !filterName.isBlank()) {
DbParameterGroup group = findParameterGroupForRegion(filterName, effectiveRegion);
return group != null ? List.of(group) : List.of();
return List.of(getDbParameterGroup(filterName, region));
}
String effectiveRegion = effectiveRegion(region);
Map<String, DbParameterGroup> unique = new LinkedHashMap<>();
List<DbParameterGroup> storedGroups;
if (parameterGroups instanceof AccountAwareStorageBackend<DbParameterGroup> aware) {
@@ -10,6 +10,7 @@ import org.junit.jupiter.api.TestMethodOrder;
import static io.restassured.RestAssured.given;
import static io.restassured.http.ContentType.URLENC;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.not;
/**
@@ -64,6 +65,26 @@ class RdsParameterGroupTagIntegrationTest {
.body(containsString("<Value>data</Value>"));
}
@Test
@Order(2)
void describingAnUnknownParameterGroupIsNotFoundButAKnownOneIsReturned() {
query("DescribeDBParameterGroups")
.formParam("DBParameterGroupName", "no-such-pg")
.when().post("/")
.then()
.statusCode(404)
.body(containsString("<Code>DBParameterGroupNotFound</Code>"))
.body("ErrorResponse.Error.Message",
equalTo("DBParameterGroupName doesn't refer to an existing DB parameter group."));
query("DescribeDBParameterGroups")
.formParam("DBParameterGroupName", PG)
.when().post("/")
.then()
.statusCode(200)
.body(containsString("<DBParameterGroupName>" + PG + "</DBParameterGroupName>"));
}
@Test
@Order(1)
void aClusterParameterGroupIsTaggableTheSameWay() {