|
| 1 | +describe("TESTS: Configuration => Subsystem => Micrometer => Registry => OTLP", () => { |
| 2 | + const subsystemAddress = ["subsystem", "micrometer"]; |
| 3 | + const address = ["subsystem", "micrometer", "registry", "otlp"]; |
| 4 | + // HAL generates form IDs with triple-dash separators for child resources, |
| 5 | + // but collapses them to single dashes in some sub-elements (editing div, save button). |
| 6 | + const configurationFormId = "model-browser-model-browser-root---registry---otlp-form"; |
| 7 | + const configurationFormIdNoDash = "model-browser-model-browser-root-registry-otlp-form"; |
| 8 | + const addWizardFormId = "model-browser-root-registry-singleton-add"; |
| 9 | + |
| 10 | + const endpoint = "endpoint"; |
| 11 | + const endpointCustomValue = "http://otel-collector:4318/v1/metrics"; |
| 12 | + const endpointExpressionProperty = "micrometer.otlp.endpoint"; |
| 13 | + const endpointExpressionPropertyValue = "http://expression-endpoint:4318/v1/metrics"; |
| 14 | + const endpointExpressionValue = "${micrometer.otlp.endpoint}"; |
| 15 | + |
| 16 | + const step = "step"; |
| 17 | + const stepCustomValue = 30; |
| 18 | + const stepExpressionProperty = "micrometer.otlp.step"; |
| 19 | + const stepExpressionPropertyValue = "45"; |
| 20 | + const stepExpressionValue = "${micrometer.otlp.step}"; |
| 21 | + |
| 22 | + // Context value for prometheus registry (required field, avoids conflict with metrics subsystem) |
| 23 | + const prometheusContext = "/prometheus"; |
| 24 | + |
| 25 | + let managementEndpoint: string; |
| 26 | + |
| 27 | + // Workaround for JBEAP-28819 - child resource form IDs use triple-dash separators |
| 28 | + // for the container but single-dash for the editing div. |
| 29 | + function editForm() { |
| 30 | + const editButton = "#" + configurationFormId + ' a.clickable[data-operation="edit"]'; |
| 31 | + cy.get(`#${configurationFormIdNoDash}-editing`).should("not.be.visible"); |
| 32 | + cy.get(editButton).click(); |
| 33 | + for (let reClickTry = 0; reClickTry < 5; reClickTry++) { |
| 34 | + cy.get(editButton).then(($button) => { |
| 35 | + if ($button.is(":visible")) { |
| 36 | + cy.get(editButton).click(); |
| 37 | + } |
| 38 | + }); |
| 39 | + } |
| 40 | + cy.get(`#${configurationFormIdNoDash}-editing`).should("be.visible"); |
| 41 | + } |
| 42 | + |
| 43 | + before(() => { |
| 44 | + cy.startWildflyContainer().then((result) => { |
| 45 | + managementEndpoint = result as string; |
| 46 | + // The micrometer extension is not part of the base configuration, so it must be added explicitly |
| 47 | + cy.addAddress(managementEndpoint, ["extension", "org.wildfly.extension.micrometer"], {}); |
| 48 | + // Register the micrometer subsystem as a parent for the registries |
| 49 | + cy.addAddress(managementEndpoint, subsystemAddress, {}); |
| 50 | + // System properties used as expression resolution targets in the expression tests |
| 51 | + cy.addAddress(managementEndpoint, ["system-property", endpointExpressionProperty], { |
| 52 | + value: endpointExpressionPropertyValue, |
| 53 | + }); |
| 54 | + cy.addAddress(managementEndpoint, ["system-property", stepExpressionProperty], { |
| 55 | + value: stepExpressionPropertyValue, |
| 56 | + }); |
| 57 | + }); |
| 58 | + }); |
| 59 | + |
| 60 | + after(() => { |
| 61 | + cy.task("stop:containers"); |
| 62 | + }); |
| 63 | + |
| 64 | + it("Add otlp registry", () => { |
| 65 | + cy.navigateToGenericSubsystemPage(managementEndpoint, subsystemAddress); |
| 66 | + cy.get("#model-browser-root___registry").should("be.visible").click(); |
| 67 | + cy.addInTable("model-browser-children-table"); |
| 68 | + // First registry added: wizard shows radio button step, otlp has no required fields |
| 69 | + cy.get("input[type='radio'][value='otlp']").check(); |
| 70 | + cy.confirmNextInWizard(); |
| 71 | + cy.confirmFinishInWizard(); |
| 72 | + cy.verifySuccess(); |
| 73 | + }); |
| 74 | + |
| 75 | + it("Add prometheus registry", function () { |
| 76 | + cy.skipIf(cy.isEAP(managementEndpoint), this); |
| 77 | + cy.navigateToGenericSubsystemPage(managementEndpoint, subsystemAddress); |
| 78 | + cy.get("#model-browser-root___registry").should("be.visible").click(); |
| 79 | + cy.addInTable("model-browser-children-table"); |
| 80 | + // Second registry added: wizard skips radio button step, prometheus requires context |
| 81 | + cy.text(addWizardFormId, "context", prometheusContext); |
| 82 | + cy.confirmAddResourceWizard(); |
| 83 | + cy.verifySuccess(); |
| 84 | + }); |
| 85 | + |
| 86 | + it("Edit endpoint", () => { |
| 87 | + cy.navigateToGenericSubsystemPage(managementEndpoint, subsystemAddress); |
| 88 | + cy.get("#model-browser-root___registry > .jstree-ocl").click(); |
| 89 | + cy.get("#model-browser-root___registry___otlp").should("be.visible").click(); |
| 90 | + cy.get('#model-browser-resource-tab-container a[href="#model-browser-resource-data-tab"]').click(); |
| 91 | + editForm(); |
| 92 | + cy.text(configurationFormIdNoDash, endpoint, endpointCustomValue); |
| 93 | + cy.saveForm(configurationFormIdNoDash); |
| 94 | + cy.verifySuccess(); |
| 95 | + cy.verifyAttribute(managementEndpoint, address, endpoint, endpointCustomValue); |
| 96 | + }); |
| 97 | + |
| 98 | + it("Edit step", () => { |
| 99 | + cy.navigateToGenericSubsystemPage(managementEndpoint, subsystemAddress); |
| 100 | + cy.get("#model-browser-root___registry > .jstree-ocl").click(); |
| 101 | + cy.get("#model-browser-root___registry___otlp").should("be.visible").click(); |
| 102 | + cy.get('#model-browser-resource-tab-container a[href="#model-browser-resource-data-tab"]').click(); |
| 103 | + editForm(); |
| 104 | + cy.text(configurationFormIdNoDash, step, stepCustomValue.toString()); |
| 105 | + cy.saveForm(configurationFormIdNoDash); |
| 106 | + cy.verifySuccess(); |
| 107 | + cy.verifyAttribute(managementEndpoint, address, step, stepCustomValue); |
| 108 | + }); |
| 109 | + |
| 110 | + it("Edit endpoint with expression", () => { |
| 111 | + const endpointExpressionSelector = `input#${configurationFormIdNoDash}-${endpoint}-editing.form-control`; |
| 112 | + cy.navigateToGenericSubsystemPage(managementEndpoint, subsystemAddress); |
| 113 | + cy.get("#model-browser-root___registry > .jstree-ocl").click(); |
| 114 | + cy.get("#model-browser-root___registry___otlp").should("be.visible").click(); |
| 115 | + cy.get('#model-browser-resource-tab-container a[href="#model-browser-resource-data-tab"]').click(); |
| 116 | + editForm(); |
| 117 | + cy.textExpression(configurationFormIdNoDash, endpoint, endpointExpressionValue, { |
| 118 | + selector: endpointExpressionSelector, |
| 119 | + }); |
| 120 | + cy.saveForm(configurationFormIdNoDash); |
| 121 | + cy.get(".toast-notifications-list-pf .alert").should("be.visible"); |
| 122 | + cy.verifyAttributeAsExpression(managementEndpoint, address, endpoint, endpointExpressionValue); |
| 123 | + }); |
| 124 | + |
| 125 | + it("Edit step with expression", () => { |
| 126 | + const stepExpressionSelector = `input#${configurationFormIdNoDash}-${step}-editing.form-control`; |
| 127 | + cy.navigateToGenericSubsystemPage(managementEndpoint, subsystemAddress); |
| 128 | + cy.get("#model-browser-root___registry > .jstree-ocl").click(); |
| 129 | + cy.get("#model-browser-root___registry___otlp").should("be.visible").click(); |
| 130 | + cy.get('#model-browser-resource-tab-container a[href="#model-browser-resource-data-tab"]').click(); |
| 131 | + editForm(); |
| 132 | + cy.textExpression(configurationFormIdNoDash, step, stepExpressionValue, { |
| 133 | + selector: stepExpressionSelector, |
| 134 | + }); |
| 135 | + cy.saveForm(configurationFormIdNoDash); |
| 136 | + cy.get(".toast-notifications-list-pf .alert").should("be.visible"); |
| 137 | + cy.verifyAttributeAsExpression(managementEndpoint, address, step, stepExpressionValue); |
| 138 | + }); |
| 139 | + |
| 140 | + it("Reset configuration", () => { |
| 141 | + cy.navigateToGenericSubsystemPage(managementEndpoint, subsystemAddress); |
| 142 | + cy.get("#model-browser-root___registry > .jstree-ocl").click(); |
| 143 | + cy.get("#model-browser-root___registry___otlp").should("be.visible").click(); |
| 144 | + cy.get('#model-browser-resource-tab-container a[href="#model-browser-resource-data-tab"]').click(); |
| 145 | + cy.resetForm(configurationFormId, managementEndpoint, address); |
| 146 | + }); |
| 147 | +}); |
0 commit comments