Search in sources :

Example 6 with ExecResult

use of io.strimzi.test.executor.ExecResult in project strimzi by strimzi.

the class AbstractUpgradeST method convertCRDs.

protected void convertCRDs(JsonObject conversionTool, String namespace) throws IOException {
    String url = conversionTool.getString("urlToConversionTool");
    File dir = FileUtils.downloadAndUnzip(url);
    String convertorPath = dir.getAbsolutePath() + "/" + conversionTool.getString("toConversionTool") + "/bin/api-conversion.sh";
    Exec.exec("chmod", "+x", convertorPath);
    LOGGER.info("Converting CRs ...");
    // CRS conversion needs old versions of Strimzi CRDs, which are not available after 0.22
    if (cmdKubeClient().exec(true, Level.DEBUG, "get", "crd", "kafkas.kafka.strimzi.io", "-o", "jsonpath={.spec.versions}").out().trim().contains(Constants.V1ALPHA1)) {
        ExecResult execResult = Exec.exec(convertorPath, "cr", "-n=" + namespace);
        LOGGER.debug("CRs conversion STDOUT:");
        LOGGER.debug(execResult.out());
        LOGGER.debug("CRs conversion STDERR:");
        LOGGER.debug(execResult.err());
        LOGGER.info("CRs conversion done!");
        // run crd-upgrade
        LOGGER.info("Converting CRDs");
        execResult = Exec.exec(convertorPath, "crd");
        LOGGER.debug("CRDs conversion STDOUT:");
        LOGGER.debug(execResult.out());
        LOGGER.debug("CRDs conversion STDERR:");
        LOGGER.debug(execResult.err());
        LOGGER.info("CRDs conversion done!");
        waitForKafkaCRDChange();
    } else {
        LOGGER.info("CRs and CRDs already have v1beta2 versions");
    }
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) File(java.io.File) ExecResult(io.strimzi.test.executor.ExecResult)

Example 7 with ExecResult

use of io.strimzi.test.executor.ExecResult in project strimzi-kafka-operator by strimzi.

the class KeycloakUtils method deployKeycloak.

public static void deployKeycloak(String namespace) {
    LOGGER.info("Prepare Keycloak in namespace: {}", namespace);
    // This is needed because from time to time the first try fails on Azure
    TestUtils.waitFor("Keycloak instance readiness", Constants.KEYCLOAK_DEPLOYMENT_POLL, Constants.KEYCLOAK_DEPLOYMENT_TIMEOUT, () -> {
        ExecResult result = Exec.exec(Level.INFO, "/bin/bash", PATH_TO_KEYCLOAK_PREPARE_SCRIPT, namespace, getValidKeycloakVersion());
        if (!result.out().contains("All realms were successfully imported")) {
            LOGGER.info("Errors occurred during Keycloak install: {}", result.err());
            return false;
        }
        return true;
    });
    LOGGER.info("Keycloak in namespace {} is ready", namespace);
}
Also used : ExecResult(io.strimzi.test.executor.ExecResult)

Example 8 with ExecResult

use of io.strimzi.test.executor.ExecResult in project strimzi-kafka-operator by strimzi.

the class AbstractUpgradeST method convertCRDs.

protected void convertCRDs(JsonObject conversionTool, String namespace) throws IOException {
    String url = conversionTool.getString("urlToConversionTool");
    File dir = FileUtils.downloadAndUnzip(url);
    String convertorPath = dir.getAbsolutePath() + "/" + conversionTool.getString("toConversionTool") + "/bin/api-conversion.sh";
    Exec.exec("chmod", "+x", convertorPath);
    LOGGER.info("Converting CRs ...");
    // CRS conversion needs old versions of Strimzi CRDs, which are not available after 0.22
    if (cmdKubeClient().exec(true, Level.DEBUG, "get", "crd", "kafkas.kafka.strimzi.io", "-o", "jsonpath={.spec.versions}").out().trim().contains(Constants.V1ALPHA1)) {
        ExecResult execResult = Exec.exec(convertorPath, "cr", "-n=" + namespace);
        LOGGER.debug("CRs conversion STDOUT:");
        LOGGER.debug(execResult.out());
        LOGGER.debug("CRs conversion STDERR:");
        LOGGER.debug(execResult.err());
        LOGGER.info("CRs conversion done!");
        // run crd-upgrade
        LOGGER.info("Converting CRDs");
        execResult = Exec.exec(convertorPath, "crd");
        LOGGER.debug("CRDs conversion STDOUT:");
        LOGGER.debug(execResult.out());
        LOGGER.debug("CRDs conversion STDERR:");
        LOGGER.debug(execResult.err());
        LOGGER.info("CRDs conversion done!");
        waitForKafkaCRDChange();
    } else {
        LOGGER.info("CRs and CRDs already have v1beta2 versions");
    }
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) File(java.io.File) ExecResult(io.strimzi.test.executor.ExecResult)

Aggregations

ExecResult (io.strimzi.test.executor.ExecResult)8 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)2 Pod (io.fabric8.kubernetes.api.model.Pod)2 StUtils.configMap2Properties (io.strimzi.systemtest.utils.StUtils.configMap2Properties)2 StUtils.stringToProperties (io.strimzi.systemtest.utils.StUtils.stringToProperties)2 TestUtils.fromYamlString (io.strimzi.test.TestUtils.fromYamlString)2 File (java.io.File)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 Properties (java.util.Properties)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 Matchers.emptyOrNullString (org.hamcrest.Matchers.emptyOrNullString)2