Search in sources :

Example 6 with TestKafkaVersion

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

the class AbstractUpgradeST method buildMidStepUpgradeData.

protected static Map<String, JsonObject> buildMidStepUpgradeData(JsonObject jsonData) {
    List<TestKafkaVersion> testKafkaVersions = TestKafkaVersion.getSupportedKafkaVersions();
    TestKafkaVersion testKafkaVersion = testKafkaVersions.get(testKafkaVersions.size() - 1);
    Map<String, JsonObject> steps = new HashMap<>();
    String midStepUrl = jsonData.getString("urlFrom");
    String midStepVersion = jsonData.getString("fromVersion");
    String midStepExamples = jsonData.getString("fromExamples");
    JsonObject conversionTool = jsonData.getJsonObject("conversionTool");
    // X -> 0.22.0 data
    JsonObject midStep = JsonObject.mapFrom(jsonData);
    JsonObject afterMidStep = JsonObject.mapFrom(jsonData);
    if (jsonData.getString("prevVersion").isEmpty()) {
        midStep.put("urlFrom", jsonData.getString("urlFrom"));
        midStep.put("fromVersion", jsonData.getString("fromVersion"));
        midStep.put("fromExamples", jsonData.getString("fromExamples"));
        afterMidStep.put("urlFrom", "HEAD");
        afterMidStep.put("fromVersion", "HEAD");
        afterMidStep.put("fromExamples", "HEAD");
    } else {
        midStep.put("urlFrom", jsonData.getString("urlPrevVersion"));
        midStep.put("fromVersion", jsonData.getString("prevVersion"));
        midStep.put("fromExamples", jsonData.getString("prevVersionExamples"));
        afterMidStep.put("urlFrom", midStepUrl);
        afterMidStep.put("fromVersion", midStepVersion);
        afterMidStep.put("fromExamples", midStepExamples);
    }
    midStep.put("urlTo", midStepUrl);
    midStep.put("toVersion", midStepVersion);
    midStep.put("toExamples", midStepExamples);
    midStep.put("urlToConversionTool", conversionTool.getString("urlToConversionTool"));
    midStep.put("toConversionTool", conversionTool.getString("toConversionTool"));
    JsonObject midStepProcedures = new JsonObject();
    midStepProcedures.put("kafkaVersion", testKafkaVersion.version());
    midStepProcedures.put("logMessageVersion", testKafkaVersion.messageVersion());
    midStepProcedures.put("interBrokerProtocolVersion", testKafkaVersion.protocolVersion());
    midStep.put("proceduresAfterOperatorUpgrade", midStepProcedures);
    steps.put("midStep", midStep);
    steps.put("toHEAD", afterMidStep);
    return steps;
}
Also used : HashMap(java.util.HashMap) JsonObject(io.vertx.core.json.JsonObject) TestKafkaVersion(io.strimzi.systemtest.utils.TestKafkaVersion) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString)

Example 7 with TestKafkaVersion

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

the class OlmUpgradeIsolatedST method testStrimziUpgrade.

@Test
void testStrimziUpgrade(ExtensionContext extensionContext) throws IOException {
    JsonArray upgradeData = readUpgradeJson(UPGRADE_JSON_FILE);
    JsonObject latestUpgradeData = upgradeData.getJsonObject(upgradeData.size() - 1);
    List<TestKafkaVersion> testKafkaVersions = TestKafkaVersion.getSupportedKafkaVersions();
    TestKafkaVersion testKafkaVersion = testKafkaVersions.get(testKafkaVersions.size() - 1);
    // Generate procedures and data for OLM upgrade
    // This is needed, because for upgrade it's generated by method which generated data for parametrized test
    JsonObject procedures = new JsonObject();
    procedures.put("kafkaVersion", testKafkaVersion.version());
    procedures.put("logMessageVersion", testKafkaVersion.messageVersion());
    procedures.put("interBrokerProtocolVersion", testKafkaVersion.protocolVersion());
    latestUpgradeData.put("proceduresAfterOperatorUpgrade", procedures);
    latestUpgradeData.put("toVersion", "HEAD");
    latestUpgradeData.put("toExamples", "HEAD");
    latestUpgradeData.put("urlTo", "HEAD");
    // perform verification of to version
    performUpgradeVerification(latestUpgradeData, extensionContext);
}
Also used : JsonArray(io.vertx.core.json.JsonArray) JsonObject(io.vertx.core.json.JsonObject) TestKafkaVersion(io.strimzi.systemtest.utils.TestKafkaVersion) Test(org.junit.jupiter.api.Test)

Example 8 with TestKafkaVersion

use of io.strimzi.systemtest.utils.TestKafkaVersion in project strimzi by strimzi.

the class StrimziUpgradeIsolatedST method getDataForStartUpgrade.

private JsonObject getDataForStartUpgrade(JsonArray upgradeJson) throws IOException {
    List<TestKafkaVersion> sortedVersions = TestKafkaVersion.getSupportedKafkaVersions();
    Collections.reverse(upgradeJson.getList());
    JsonObject startingVersion = null;
    for (Object item : upgradeJson) {
        TestKafkaVersion defaultVersion = getDefaultKafkaVersionPerStrimzi(((JsonObject) item).getValue("fromVersion").toString());
        ((JsonObject) item).put("defaultKafka", defaultVersion.version());
        startingVersion = (JsonObject) item;
        break;
    }
    return startingVersion;
}
Also used : JsonObject(io.vertx.core.json.JsonObject) TestKafkaVersion(io.strimzi.systemtest.utils.TestKafkaVersion) JsonObject(io.vertx.core.json.JsonObject)

Example 9 with TestKafkaVersion

use of io.strimzi.systemtest.utils.TestKafkaVersion in project strimzi 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 10 with TestKafkaVersion

use of io.strimzi.systemtest.utils.TestKafkaVersion in project strimzi by strimzi.

the class KafkaUpgradeDowngradeIsolatedST method testUpgradeWithNoMessageAndProtocolVersionsSet.

@IsolatedTest
void testUpgradeWithNoMessageAndProtocolVersionsSet(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);
        runVersionChange(initialVersion, newVersion, producerName, consumerName, null, null, 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