Search in sources :

Example 6 with Syndesis

use of io.syndesis.qe.resource.impl.Syndesis in project syndesis-qe by syndesisio.

the class OperatorValidationSteps method deployCrFromFile.

@When("^deploy Syndesis CR( from file \"([^\"]*)\")?")
public void deployCrFromFile(String file) {
    Syndesis syndesis = ResourceFactory.get(Syndesis.class);
    try {
        if (file == null) {
            syndesis.deploySyndesisViaOperator();
            // don't do workarounds for external Jaeger
            if (syndesis.isAddonEnabled(Addon.JAEGER) && !syndesis.containsAddonProperty(Addon.JAEGER, "collectorUri")) {
                syndesis.jaegerWorkarounds();
            }
        } else {
            String content = getCrFromFileAsString(file);
            syndesis.getSyndesisCrClient().create(TestConfiguration.openShiftNamespace(), content);
            // don't do workarounds for external Jaeger
            if (syndesis.isAddonEnabled(Addon.JAEGER) && !syndesis.containsAddonProperty(Addon.JAEGER, "collectorUri")) {
                syndesis.jaegerWorkarounds();
            }
        }
    } catch (IOException e) {
        fail("Couldn't create CR from provided file", e);
    }
}
Also used : IOException(java.io.IOException) Syndesis(io.syndesis.qe.resource.impl.Syndesis) When(io.cucumber.java.en.When)

Example 7 with Syndesis

use of io.syndesis.qe.resource.impl.Syndesis in project syndesis-qe by syndesisio.

the class CommonSteps method deployOperatorHub.

public static void deployOperatorHub() {
    Syndesis syndesis = ResourceFactory.get(Syndesis.class);
    QuayUser quayUser = TestConfiguration.getQuayUser();
    QuayService quayService = new QuayService(quayUser, TestConfiguration.syndesisOperatorImage(), syndesis.generateImageEnvVars());
    String quayProject;
    try {
        quayProject = quayService.createQuayProject();
    } catch (Exception e) {
        InfraFail.fail("Creating project on quay failed", e);
        return;
    }
    OpenShiftService openShiftService = TestConfiguration.getOpenShiftService(quayProject);
    try {
        openShiftService.deployOperator();
    } catch (IOException e) {
        InfraFail.fail("Deploying operator with marketplace failed", e);
    }
    // at this point we don't really need operator source anymore
    // and we doon't need project on quay either, because all the necessary stuff
    // has already been deployed, we can delete those
    log.info("Cleaning all unnecessary resorces");
    openShiftService.deleteOpsrcToken();
    try {
        openShiftService.deleteOperatorSource();
        quayService.deleteQuayProject();
    } catch (IOException e) {
        InfraFail.fail("Fail during cleanup of quay project", e);
    }
    syndesis.deployCrAndRoutes();
    CommonSteps.waitForSyndesis();
}
Also used : OpenShiftService(io.syndesis.qe.marketplace.openshift.OpenShiftService) QuayUser(io.syndesis.qe.marketplace.quay.QuayUser) IOException(java.io.IOException) QuayService(io.syndesis.qe.marketplace.quay.QuayService) Syndesis(io.syndesis.qe.resource.impl.Syndesis) TimeoutException(java.util.concurrent.TimeoutException) WaiterException(cz.xtf.core.waiting.WaiterException) KubernetesClientException(io.fabric8.kubernetes.client.KubernetesClientException) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 8 with Syndesis

use of io.syndesis.qe.resource.impl.Syndesis in project syndesis-qe by syndesisio.

the class ComponentUtils method getAllComponents.

/**
 * Gets all the components that are currently enabled.
 *
 * @return enumset of all currently used components
 */
public static EnumSet<Component> getAllComponents() {
    Syndesis syndesis = ResourceFactory.get(Syndesis.class);
    EnumSet<Component> components = EnumSet.of(OAUTH, PROMETHEUS, SERVER, UI, META, OPERATOR);
    if (syndesis.isAddonEnabled(Addon.TODO)) {
        components.add(TODO);
    }
    // don't count jaeger addon when operatorOnly is set to true (Jaeger cr has to be created manually)
    if (syndesis.isAddonEnabled(Addon.JAEGER) && !syndesis.containsAddonPropertyAndBooleanValue(Addon.JAEGER, "operatorOnly", true)) {
        components.add(JAEGER);
    }
    if (!syndesis.isAddonEnabled(Addon.EXTERNAL_DB)) {
        components.add(DB);
    }
    return components;
}
Also used : Syndesis(io.syndesis.qe.resource.impl.Syndesis)

Example 9 with Syndesis

use of io.syndesis.qe.resource.impl.Syndesis in project syndesis-qe by syndesisio.

the class UpgradeSteps method getUpgradeVersions.

@When("^prepare upgrade$")
public void getUpgradeVersions() {
    Syndesis syndesis = ResourceFactory.get(PreviousSyndesis.class);
    // If it is a prod build, we can use released images from registry.redhat.io
    if (TestUtils.isProdBuild()) {
        // If it is a prod build and the version is null, it means it was started by test-runner, so skip it as for prod upgrade there is a
        // separate job
        assumeThat(TestConfiguration.upgradePreviousVersion()).isNotNull();
        String majorMinorMavenVersion = getMajorMinor(TestConfiguration.upgradePreviousVersion());
        String major = StringUtils.substringBefore(majorMinorMavenVersion, ".");
        // From 1.10 we need to make 1.7, so parse the decimal part to integer and subtract 3
        int minor = Integer.parseInt(StringUtils.substringAfter(majorMinorMavenVersion, ".")) - 3;
        // Parse the previous tag from maven artifacts
        syndesis.setOperatorImage(RELEASED_OPERATOR_IMAGE + ":" + major + "." + minor);
        TestConfiguration.get().overrideProperty(TestConfiguration.SYNDESIS_UPGRADE_CURRENT_VERSION, TestConfiguration.syndesisVersion());
    // Previous version needs to be specified manually via system properties
    } else {
        assumeThat(TestConfiguration.syndesisInstallVersion()).as("Upgrade tests need to have " + TestConfiguration.SYNDESIS_INSTALL_VERSION + " property set!").isNotNull();
        // List all the tags from docker hub
        List<String> tags = new ArrayList<>();
        int page = 0;
        boolean nextPage = false;
        do {
            String tagUrl = String.format(DOCKER_HUB_SYNDESIS_TAGS_URL, ++page);
            JSONObject response = new JSONObject(HTTPUtils.doGetRequest(tagUrl).getBody());
            response.getJSONArray("tags").forEach(tag -> tags.add(((JSONObject) tag).getString("name")));
            nextPage = response.getBoolean("has_additional");
        } while (nextPage);
        Collections.sort(tags);
        String previousTag = getPreviousVersion(getMajorMinor(TestConfiguration.syndesisInstallVersion()), tags);
        if (!previousTag.isEmpty()) {
            TestConfiguration.get().overrideProperty(TestConfiguration.SYNDESIS_UPGRADE_PREVIOUS_VERSION, previousTag);
            syndesis.setOperatorImage(UPSTREAM_OPERATOR_IMAGE + ":" + previousTag);
        } else {
            fail("Unable to find previous version for " + TestConfiguration.syndesisInstallVersion());
        }
        TestConfiguration.get().overrideProperty(TestConfiguration.SYNDESIS_UPGRADE_CURRENT_VERSION, TestConfiguration.syndesisInstallVersion());
    }
    // We want to deploy "previous" version first
    syndesis.setCrdUrl(getClass().getClassLoader().getResource("upgrade/syndesis-crd-previous.yaml").toString());
    log.info("Upgrade properties:");
    log.info("  Previous version: " + TestConfiguration.upgradePreviousVersion());
    log.info("  Current version:  " + TestConfiguration.upgradeCurrentVersion());
}
Also used : JSONObject(org.json.JSONObject) ArrayList(java.util.ArrayList) Syndesis(io.syndesis.qe.resource.impl.Syndesis) PreviousSyndesis(io.syndesis.qe.resource.impl.PreviousSyndesis) IntegrationsEndpoint(io.syndesis.qe.endpoint.IntegrationsEndpoint) When(io.cucumber.java.en.When)

Example 10 with Syndesis

use of io.syndesis.qe.resource.impl.Syndesis in project syndesis-qe by syndesisio.

the class UpgradeSteps method deploySyndesis.

@When("deploy previous Syndesis CR {string}")
public void deploySyndesis(String crFile) {
    Syndesis syndesis = ResourceFactory.get(PreviousSyndesis.class);
    syndesis.setCrUrl(getClass().getClassLoader().getResource("upgrade/" + crFile).toString());
    ResourceFactory.create(PreviousSyndesis.class);
}
Also used : Syndesis(io.syndesis.qe.resource.impl.Syndesis) PreviousSyndesis(io.syndesis.qe.resource.impl.PreviousSyndesis) When(io.cucumber.java.en.When)

Aggregations

Syndesis (io.syndesis.qe.resource.impl.Syndesis)10 When (io.cucumber.java.en.When)6 PreviousSyndesis (io.syndesis.qe.resource.impl.PreviousSyndesis)3 IOException (java.io.IOException)3 Given (io.cucumber.java.en.Given)2 IntegrationsEndpoint (io.syndesis.qe.endpoint.IntegrationsEndpoint)2 TimeoutException (java.util.concurrent.TimeoutException)2 JSONObject (org.json.JSONObject)2 WaiterException (cz.xtf.core.waiting.WaiterException)1 DataTable (io.cucumber.datatable.DataTable)1 Then (io.cucumber.java.en.Then)1 Affinity (io.fabric8.kubernetes.api.model.Affinity)1 DoneablePersistentVolume (io.fabric8.kubernetes.api.model.DoneablePersistentVolume)1 Endpoints (io.fabric8.kubernetes.api.model.Endpoints)1 Node (io.fabric8.kubernetes.api.model.Node)1 NodeAffinity (io.fabric8.kubernetes.api.model.NodeAffinity)1 NodeSelector (io.fabric8.kubernetes.api.model.NodeSelector)1 NodeSelectorTerm (io.fabric8.kubernetes.api.model.NodeSelectorTerm)1 PersistentVolumeFluent (io.fabric8.kubernetes.api.model.PersistentVolumeFluent)1 Pod (io.fabric8.kubernetes.api.model.Pod)1