fix(redshift): emit ClusterAvailabilityStatus and AvailabilityZoneRelocationStatus (#3109)

DescribeClusters (and every other cluster response, since they share
buildClusterXml) omitted two fields the Terraform AWS provider requires:
ClusterAvailabilityStatus and AvailabilityZoneRelocationStatus. The
create waiter polled an empty ClusterAvailabilityStatus ("unexpected
state '', wanted target 'Available'") and import/read rejected the empty
AvailabilityZoneRelocationStatus.

ClusterAvailabilityStatus is derived from clusterStatus: available maps
to Available, unavailable to Unavailable, failed to Failed, and every
transient state to Modifying. Floci has no availability-zone relocation
feature, so AvailabilityZoneRelocationStatus is the constant "disabled".

Closes #3098
This commit is contained in:
Vũ Thế Huy authored and GitHub committed 2026-09-05 22:27:00 -04:00
1 parent 67bbd2cf13
commit 025ac714f6
4 files changed
+70 -2

No files matched your search

@@ -133,7 +133,9 @@ public class RedshiftOperationsTest {
.statusCode(200)
.contentType("application/xml")
.body(containsString("<ClusterIdentifier>cluster-src</ClusterIdentifier>"))
.body(containsString("<ClusterStatus>available</ClusterStatus>"));
.body(containsString("<ClusterStatus>available</ClusterStatus>"))
.body(containsString("<ClusterAvailabilityStatus>Available</ClusterAvailabilityStatus>"))
.body(containsString("<AvailabilityZoneRelocationStatus>disabled</AvailabilityZoneRelocationStatus>"));
// 1b. RebootCluster — must preserve data (no Docker volume backs this container)
when(containerManager.getContainer(any(), eq("cluster-src")))
@@ -69,7 +69,53 @@ class RedshiftQueryHandlerTest {
String xml = (String) response.getEntity();
assertTrue(xml.contains("<ClusterIdentifier>test-cluster</ClusterIdentifier>"));
}
@Test
void testDescribeClustersIncludesAvailabilityStatuses() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("test-cluster");
cluster.setClusterStatus("available");
when(service.describeClusters(any())).thenReturn(List.of(cluster));
Response response = handler.handle("DescribeClusters", params);
String xml = (String) response.getEntity();
assertTrue(xml.contains("<ClusterAvailabilityStatus>Available</ClusterAvailabilityStatus>"));
assertTrue(xml.contains("<AvailabilityZoneRelocationStatus>disabled</AvailabilityZoneRelocationStatus>"));
}
@Test
void testClusterAvailabilityStatusMapsTransientStatesToModifying() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("test-cluster");
cluster.setClusterStatus("creating");
when(service.createCluster(any(), any(), any(), any(), any(), any())).thenReturn(cluster);
Response response = handler.handle("CreateCluster", params);
String xml = (String) response.getEntity();
assertTrue(xml.contains("<ClusterAvailabilityStatus>Modifying</ClusterAvailabilityStatus>"));
}
@Test
void testClusterAvailabilityStatusMapsFailed() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("test-cluster");
cluster.setClusterStatus("failed");
when(service.describeClusters(any())).thenReturn(List.of(cluster));
Response response = handler.handle("DescribeClusters", params);
String xml = (String) response.getEntity();
assertTrue(xml.contains("<ClusterAvailabilityStatus>Failed</ClusterAvailabilityStatus>"));
}
@Test
void testDeleteCluster() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();