Search in sources :

Example 1 with Syndesis

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

the class OperatorValidationSteps method updateCustomResource.

@When("update CR with {string} file")
public void updateCustomResource(String file) {
    Syndesis syndesis = ResourceFactory.get(Syndesis.class);
    syndesis.editCr(getCrFromFileAsString(file));
}
Also used : Syndesis(io.syndesis.qe.resource.impl.Syndesis) When(io.cucumber.java.en.When)

Example 2 with Syndesis

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

the class OperatorValidationSteps method checkJaeger.

@Then("^check that jaeger pod \"([^\"]*)\" (is|is not) collecting metrics for integration \"([^\"]*)\"$")
public void checkJaeger(String jaegerPodName, String shouldCollect, String integrationName) {
    TestUtils.sleepIgnoreInterrupt(30000L);
    LocalPortForward lpf = OpenShiftUtils.createLocalPortForward(OpenShiftUtils.getPod(p -> p.getMetadata().getName().startsWith(jaegerPodName)), 16686, 16686);
    final String integrationId = integrations.getIntegrationId(integrationName).get();
    // host for default syndesis-jaeger
    String host = "localhost:16686";
    if (ResourceFactory.get(Syndesis.class).containsAddonProperty(Addon.JAEGER, "collectorUri")) {
        host = ResourceFactory.get(Jaeger.class).getQueryServiceHost();
    }
    JSONArray jsonData = new JSONObject(HTTPUtils.doGetRequest("http://" + host + "/api/traces?service=" + integrationId).getBody()).getJSONArray("data");
    OpenShiftUtils.terminateLocalPortForward(lpf);
    if ("is".equals(shouldCollect)) {
        assertThat(jsonData).size().isNotZero();
    } else {
        assertThat(jsonData).size().isZero();
    }
}
Also used : Quantity(io.fabric8.kubernetes.api.model.Quantity) Arrays(java.util.Arrays) Enumeration(java.util.Enumeration) Date(java.util.Date) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Autowired(org.springframework.beans.factory.annotation.Autowired) TimeoutException(java.util.concurrent.TimeoutException) Random(java.util.Random) StringUtils(org.apache.commons.lang3.StringUtils) JSONObject(org.json.JSONObject) Matcher(java.util.regex.Matcher) IntegrationsEndpoint(io.syndesis.qe.endpoint.IntegrationsEndpoint) Map(java.util.Map) Addon(io.syndesis.qe.addon.Addon) ZipFile(java.util.zip.ZipFile) Syndesis(io.syndesis.qe.resource.impl.Syndesis) Path(java.nio.file.Path) ZipEntry(java.util.zip.ZipEntry) Affinity(io.fabric8.kubernetes.api.model.Affinity) AccountsDirectory(io.syndesis.qe.account.AccountsDirectory) Set(java.util.Set) DeploymentConfig(io.fabric8.openshift.api.model.DeploymentConfig) Jaeger(io.syndesis.qe.resource.impl.Jaeger) DoneablePersistentVolume(io.fabric8.kubernetes.api.model.DoneablePersistentVolume) Collectors(java.util.stream.Collectors) IOUtils(org.apache.commons.io.IOUtils) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) Assertions.fail(org.assertj.core.api.Assertions.fail) S3BucketNameBuilder(io.syndesis.qe.utils.aws.S3BucketNameBuilder) ResourceFactory(io.syndesis.qe.resource.ResourceFactory) Optional(java.util.Optional) Lazy(org.springframework.context.annotation.Lazy) Pattern(java.util.regex.Pattern) Component(io.syndesis.qe.component.Component) OpenShiftWaitUtils(io.syndesis.qe.wait.OpenShiftWaitUtils) SoftAssertions(org.assertj.core.api.SoftAssertions) NodeSelectorTerm(io.fabric8.kubernetes.api.model.NodeSelectorTerm) Then(io.cucumber.java.en.Then) ComponentUtils(io.syndesis.qe.component.ComponentUtils) LocalPortForward(io.fabric8.kubernetes.client.LocalPortForward) HashMap(java.util.HashMap) Yaml(org.yaml.snakeyaml.Yaml) Given(io.cucumber.java.en.Given) DataTable(io.cucumber.datatable.DataTable) Node(io.fabric8.kubernetes.api.model.Node) OutputStream(java.io.OutputStream) PersistentVolumeFluent(io.fabric8.kubernetes.api.model.PersistentVolumeFluent) Endpoints(io.fabric8.kubernetes.api.model.Endpoints) Files(java.nio.file.Files) When(io.cucumber.java.en.When) S3Utils(io.syndesis.qe.utils.aws.S3Utils) FileOutputStream(java.io.FileOutputStream) Pod(io.fabric8.kubernetes.api.model.Pod) FileUtils(org.apache.commons.io.FileUtils) IOException(java.io.IOException) NodeSelector(io.fabric8.kubernetes.api.model.NodeSelector) Toleration(io.fabric8.kubernetes.api.model.Toleration) OpenShiftUtils(io.syndesis.qe.utils.OpenShiftUtils) FileInputStream(java.io.FileInputStream) Account(io.syndesis.qe.account.Account) File(java.io.File) NodeAffinity(io.fabric8.kubernetes.api.model.NodeAffinity) HTTPUtils(io.syndesis.qe.utils.http.HTTPUtils) TestUtils(io.syndesis.qe.utils.TestUtils) Paths(java.nio.file.Paths) SecretBuilder(io.fabric8.kubernetes.api.model.SecretBuilder) ExternalDatabase(io.syndesis.qe.resource.impl.ExternalDatabase) JSONArray(org.json.JSONArray) InputStream(java.io.InputStream) LocalPortForward(io.fabric8.kubernetes.client.LocalPortForward) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) Syndesis(io.syndesis.qe.resource.impl.Syndesis) Then(io.cucumber.java.en.Then)

Example 3 with Syndesis

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

the class OperatorValidationSteps method grantPermissions.

@Given("^grant permissions to user$")
public void grantPermissions() {
    Syndesis syndesis = ResourceFactory.get(Syndesis.class);
    syndesis.pullOperatorImage();
    syndesis.grantPermissions();
}
Also used : Syndesis(io.syndesis.qe.resource.impl.Syndesis) Given(io.cucumber.java.en.Given)

Example 4 with Syndesis

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

the class UpgradeSteps method upgradeUsingOperator.

@When("^perform syndesis upgrade to newer version using operator$")
public void upgradeUsingOperator() {
    Syndesis syndesis = ResourceFactory.get(Syndesis.class);
    syndesis.defaultValues();
    syndesis.pullOperatorImage();
    syndesis.installCluster();
    syndesis.grantPermissions();
    syndesis.deployOperator();
}
Also used : Syndesis(io.syndesis.qe.resource.impl.Syndesis) PreviousSyndesis(io.syndesis.qe.resource.impl.PreviousSyndesis) When(io.cucumber.java.en.When)

Example 5 with Syndesis

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

the class CommonSteps method set3scaleEnvVar.

/**
 * Enable or disable 3scale discovery of an API provided by Syndesis
 *
 * @param url URL of 3scale user interface or NULL for turning discovery off
 */
private void set3scaleEnvVar(String url) {
    Syndesis syndesis = ResourceFactory.get(Syndesis.class);
    JSONObject cr = new JSONObject(syndesis.getCr());
    JSONObject features = cr.getJSONObject("spec").getJSONObject("components").getJSONObject("server").getJSONObject("features");
    if (url != null) {
        features.put("managementUrlFor3scale", url);
    } else {
        features.remove("managementUrlFor3scale");
    }
    syndesis.editCr(cr.toMap());
    try {
        OpenShiftWaitUtils.waitForPodIsReloaded("server");
    } catch (InterruptedException | TimeoutException e) {
        fail("Server was not reloaded after deployment config change", e);
    }
    // even though server is in ready state, inside app is still starting so we have to wait a lot just to be sure
    try {
        OpenShiftWaitUtils.waitFor(() -> OpenShiftUtils.getPodLogs("server").contains("Started Application in"), 1000 * 300L);
    } catch (TimeoutException | InterruptedException e) {
        fail("Syndesis server did not start in 300s with new variable", e);
    }
    PortForwardUtils.createOrCheckPortForward();
    Selenide.refresh();
}
Also used : JSONObject(org.json.JSONObject) Syndesis(io.syndesis.qe.resource.impl.Syndesis) TimeoutException(java.util.concurrent.TimeoutException)

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