mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(msk): populate currentBrokerSoftwareInfo in cluster describe response (#1238)
* fix(msk): populate currentBrokerSoftwareInfo in cluster describe response * fix(msk): map provisioned.kafkaVersion in CreateClusterV2 Addresses review feedback: V2 create requests carry kafkaVersion under provisioned, not at the top level, so it was always falling back to the default. Adds integration test coverage for the V1 path, V2 with provisioned.kafkaVersion, and V2 default fallback. * fix(msk): update RedpandaManagerTest for MskCluster 3-arg constructor
This commit is contained in:
1 parent
c476aca00b
commit
ce12e0284b
7 files changed
+130
-5
No files matched your search
+74
@@ -0,0 +1,74 @@
|
||||
package io.github.hectorvent.floci.services.msk;
|
||||
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
@QuarkusTest
|
||||
class MskControllerIntegrationTest {
|
||||
|
||||
@Test
|
||||
void createClusterV1EchoesRequestedKafkaVersion() {
|
||||
String clusterArn = given()
|
||||
.contentType("application/json")
|
||||
.body("""
|
||||
{"clusterName": "v1-version-test", "kafkaVersion": "3.5.1"}
|
||||
""")
|
||||
.when()
|
||||
.post("/v1/clusters")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().path("clusterArn");
|
||||
|
||||
given()
|
||||
.when()
|
||||
.get("/v1/clusters/{clusterArn}", clusterArn)
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("clusterInfo.currentBrokerSoftwareInfo.kafkaVersion", equalTo("3.5.1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void createClusterV2EchoesRequestedKafkaVersionFromProvisioned() {
|
||||
String clusterArn = given()
|
||||
.contentType("application/json")
|
||||
.body("""
|
||||
{"clusterName": "v2-version-test", "provisioned": {"kafkaVersion": "3.5.1"}}
|
||||
""")
|
||||
.when()
|
||||
.post("/api/v2/clusters")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().path("clusterArn");
|
||||
|
||||
given()
|
||||
.when()
|
||||
.get("/api/v2/clusters/{clusterArn}", clusterArn)
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("clusterInfo.currentBrokerSoftwareInfo.kafkaVersion", equalTo("3.5.1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void createClusterV2WithoutProvisionedFallsBackToDefaultKafkaVersion() {
|
||||
String clusterArn = given()
|
||||
.contentType("application/json")
|
||||
.body("""
|
||||
{"clusterName": "v2-default-version-test"}
|
||||
""")
|
||||
.when()
|
||||
.post("/api/v2/clusters")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().path("clusterArn");
|
||||
|
||||
given()
|
||||
.when()
|
||||
.get("/api/v2/clusters/{clusterArn}", clusterArn)
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("clusterInfo.currentBrokerSoftwareInfo.kafkaVersion", equalTo("3.6.0"));
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,20 @@ class MskServiceTest {
|
||||
assertTrue(cluster.getClusterArn().contains("test-cluster"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void createClusterPopulatesCurrentBrokerSoftwareInfoWithDefaultKafkaVersion() {
|
||||
MskCluster cluster = mskService.createCluster("test-cluster");
|
||||
assertNotNull(cluster.getCurrentBrokerSoftwareInfo());
|
||||
assertEquals("3.6.0", cluster.getCurrentBrokerSoftwareInfo().getKafkaVersion());
|
||||
}
|
||||
|
||||
@Test
|
||||
void createClusterEchoesRequestedKafkaVersion() {
|
||||
MskCluster cluster = mskService.createCluster("test-cluster", "3.5.1");
|
||||
assertNotNull(cluster.getCurrentBrokerSoftwareInfo());
|
||||
assertEquals("3.5.1", cluster.getCurrentBrokerSoftwareInfo().getKafkaVersion());
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeCluster() {
|
||||
MskCluster created = mskService.createCluster("test-cluster");
|
||||
|
||||
@@ -53,7 +53,7 @@ class RedpandaManagerTest {
|
||||
}
|
||||
|
||||
private static MskCluster newCluster() {
|
||||
return new MskCluster("arn:aws:kafka:us-east-1:000000000000:cluster/test-cluster/abc", "test-cluster");
|
||||
return new MskCluster("arn:aws:kafka:us-east-1:000000000000:cluster/test-cluster/abc", "test-cluster", "3.6.0");
|
||||
}
|
||||
|
||||
private int startFakeAdminServer() throws Exception {
|
||||
|
||||
Reference in new issue
Block a user