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);
}
}
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();
}
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;
}
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());
}
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);
}
Aggregations