Merge pull request #18845 from Intuinewin/rds-fix-empty-cluster

discovery/aws: handle rds clusters without instances
This commit is contained in:
Joe Adams 2026-06-04 08:34:15 -04:00 committed by GitHub
commit de17e1705e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View file

@ -486,9 +486,6 @@ func (d *RDSDiscovery) describeDBInstances(ctx context.Context, dbClusterARN str
if err != nil {
return nil, fmt.Errorf("failed to describe DB instances for cluster ARN %s: %w", dbClusterARN, err)
}
if len(output.DBInstances) == 0 {
return nil, fmt.Errorf("no DB instances found for cluster ARN %s", dbClusterARN)
}
for _, dbInstance := range output.DBInstances {
mu.Lock()

View file

@ -250,6 +250,21 @@ func TestRDSDiscoveryRefresh(t *testing.T) {
},
},
},
{
name: "NoInstancesInCluster",
clusters: map[string]types.DBCluster{
"arn:aws:rds:us-west-2:123456789012:cluster:prod-cluster": {
DBClusterArn: aws.String("arn:aws:rds:us-west-2:123456789012:cluster:prod-cluster"),
DBClusterIdentifier: aws.String("prod-cluster"),
Engine: aws.String("aurora-mysql"),
EngineVersion: aws.String("8.0.mysql_aurora.3.04.0"),
Status: aws.String("available"),
DBClusterMembers: []types.DBClusterMember{},
},
},
instances: map[string][]types.DBInstance{},
expectedLabels: []model.LabelSet{},
},
}
for _, tt := range tests {