Search in sources :

Example 16 with TestKafkaVersion

use of io.strimzi.systemtest.utils.TestKafkaVersion in project strimzi-kafka-operator by strimzi.

the class StrimziUpgradeIsolatedST method buildDataForUpgradeAcrossVersions.

private JsonObject buildDataForUpgradeAcrossVersions() throws IOException {
    List<TestKafkaVersion> sortedVersions = TestKafkaVersion.getSupportedKafkaVersions();
    TestKafkaVersion latestKafkaSupported = sortedVersions.get(sortedVersions.size() - 1);
    JsonArray upgradeJson = readUpgradeJson(UPGRADE_JSON_FILE);
    JsonObject acrossUpgradeData = upgradeJson.getJsonObject(upgradeJson.size() - 1);
    JsonObject startingVersion = getDataForStartUpgrade(upgradeJson);
    acrossUpgradeData.put("fromVersion", startingVersion.getValue("fromVersion"));
    acrossUpgradeData.put("fromExamples", startingVersion.getValue("fromExamples"));
    acrossUpgradeData.put("urlFrom", startingVersion.getValue("urlFrom"));
    acrossUpgradeData.put("urlTo", "HEAD");
    acrossUpgradeData.put("toVersion", "HEAD");
    acrossUpgradeData.put("toExamples", "HEAD");
    acrossUpgradeData.put("startingKafkaVersion", startingVersion.getString("oldestKafka"));
    acrossUpgradeData.put("defaultKafka", startingVersion.getString("defaultKafka"));
    acrossUpgradeData.put("oldestKafka", startingVersion.getString("oldestKafka"));
    // Generate procedures for upgrade
    JsonObject procedures = new JsonObject();
    procedures.put("kafkaVersion", latestKafkaSupported.version());
    procedures.put("logMessageVersion", latestKafkaSupported.messageVersion());
    procedures.put("interBrokerProtocolVersion", latestKafkaSupported.protocolVersion());
    acrossUpgradeData.put("proceduresAfterOperatorUpgrade", procedures);
    LOGGER.info("Upgrade Json for the test: {}", acrossUpgradeData.encodePrettily());
    return acrossUpgradeData;
}
Also used : JsonArray(io.vertx.core.json.JsonArray) JsonObject(io.vertx.core.json.JsonObject) TestKafkaVersion(io.strimzi.systemtest.utils.TestKafkaVersion)

Example 17 with TestKafkaVersion

use of io.strimzi.systemtest.utils.TestKafkaVersion in project strimzi-kafka-operator by strimzi.

the class KafkaUpgradeDowngradeIsolatedST method testKafkaClusterDowngrade.

@IsolatedTest
void testKafkaClusterDowngrade(ExtensionContext testContext) {
    List<TestKafkaVersion> sortedVersions = TestKafkaVersion.getSupportedKafkaVersions();
    String clusterName = mapWithClusterNames.get(testContext.getDisplayName());
    String producerName = clusterName + "-producer";
    String consumerName = clusterName + "-consumer";
    for (int x = sortedVersions.size() - 1; x > 0; x--) {
        TestKafkaVersion initialVersion = sortedVersions.get(x);
        TestKafkaVersion newVersion = sortedVersions.get(x - 1);
        // If it is a downgrade then we make sure to use the lower version number for the message format
        String logMsgFormat = newVersion.messageVersion();
        String interBrokerProtocol = newVersion.protocolVersion();
        runVersionChange(initialVersion, newVersion, producerName, consumerName, logMsgFormat, interBrokerProtocol, 3, 3, testContext);
    }
    // ##############################
    // Validate that continuous clients finished successfully
    // ##############################
    ClientUtils.waitTillContinuousClientsFinish(producerName, consumerName, INFRA_NAMESPACE, continuousClientsMessageCount);
// ##############################
}
Also used : TestKafkaVersion(io.strimzi.systemtest.utils.TestKafkaVersion) IsolatedTest(io.strimzi.systemtest.annotations.IsolatedTest)

Example 18 with TestKafkaVersion

use of io.strimzi.systemtest.utils.TestKafkaVersion in project strimzi-kafka-operator by strimzi.

the class KafkaUpgradeDowngradeIsolatedST method testKafkaClusterUpgrade.

@IsolatedTest
void testKafkaClusterUpgrade(ExtensionContext testContext) {
    List<TestKafkaVersion> sortedVersions = TestKafkaVersion.getSupportedKafkaVersions();
    String producerName = clusterName + "-producer";
    String consumerName = clusterName + "-consumer";
    for (int x = 0; x < sortedVersions.size() - 1; x++) {
        TestKafkaVersion initialVersion = sortedVersions.get(x);
        TestKafkaVersion newVersion = sortedVersions.get(x + 1);
        // If it is an upgrade test we keep the message format as the lower version number
        String logMsgFormat = initialVersion.messageVersion();
        String interBrokerProtocol = initialVersion.protocolVersion();
        runVersionChange(initialVersion, newVersion, producerName, consumerName, logMsgFormat, interBrokerProtocol, 3, 3, testContext);
    }
    // ##############################
    // Validate that continuous clients finished successfully
    // ##############################
    ClientUtils.waitTillContinuousClientsFinish(producerName, consumerName, INFRA_NAMESPACE, continuousClientsMessageCount);
// ##############################
}
Also used : TestKafkaVersion(io.strimzi.systemtest.utils.TestKafkaVersion) IsolatedTest(io.strimzi.systemtest.annotations.IsolatedTest)

Aggregations

TestKafkaVersion (io.strimzi.systemtest.utils.TestKafkaVersion)18 JsonObject (io.vertx.core.json.JsonObject)10 IsolatedTest (io.strimzi.systemtest.annotations.IsolatedTest)8 JsonArray (io.vertx.core.json.JsonArray)6 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Test (org.junit.jupiter.api.Test)2 Arguments (org.junit.jupiter.params.provider.Arguments)2