Skip to content

Commit

Permalink
[EAPQE-2410] :Add test to verify AJP Listener allowed-request-attribu…
Browse files Browse the repository at this point in the history
…tes-pattern
  • Loading branch information
istraka committed Oct 9, 2024
1 parent 5e694bd commit f9e24d6
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/testsuite/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export default defineConfig({
"start:wildfly:container": ({ name, configuration, useNetworkHostMode }) => {
return new Promise((resolve, reject) => {
let portOffset = 0;
let wildflyCmdParameters = ["-c", configuration || "standalone-insecure.xml"];
if (process.env.WILDFLY_STABILITY_LEVEL) {
wildflyCmdParameters.push("--stability=" + process.env.WILDFLY_STABILITY_LEVEL);
}
console.log(wildflyCmdParameters as String[]);
const wildfly = new GenericContainer(
process.env.WILDFLY_IMAGE || "quay.io/halconsole/wildfly-development:latest"
)
Expand All @@ -35,16 +40,11 @@ export default defineConfig({
.withStartupTimeout(333000);
if (useNetworkHostMode === true) {
console.log("host mode");
wildflyCmdParameters.push(`-Djboss.socket.binding.port-offset=${portOffset.toString()}`);
findAPortNotInUse(8080, 8180)
.then((freePort) => {
portOffset = freePort - 8080;
wildfly
.withNetworkMode("host")
.withCommand([
"-c",
configuration || "standalone-insecure.xml",
`-Djboss.socket.binding.port-offset=${portOffset.toString()}`,
] as string[]);
wildfly.withNetworkMode("host").withCommand(wildflyCmdParameters as string[]);
})
.catch((error) => {
console.log(error);
Expand All @@ -55,7 +55,7 @@ export default defineConfig({
.withNetworkMode(config.env.NETWORK_NAME as string)
.withNetworkAliases("wildfly")
.withExposedPorts(9990)
.withCommand(["-c", configuration || "standalone-insecure.xml"] as string[]);
.withCommand(wildflyCmdParameters as string[]);
}
wildfly
.start()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
describe("TESTS: Configuration => Subsystem => Undertow => Global settings", () => {
let managementEndpoint: string;

const testValues = {
serverName: "default-server",
ajpListener: "test-ajp",
ajpSocketBindings: "ajp",
allowedReqAttrsPatternExpression: "${NON-EXISTING:value.*}",
allowedReqAttrsPatternResolved: "value.*",
};
const address = ["subsystem", "undertow", "server", testValues.serverName, "ajp-listener", testValues.ajpListener];
const serverSelectors = {
serverListenersItem: "#undertow-server-listener-item",
ajpListenerItem: "#undertow-server-ajp-listener-item",
};
const ajpListenerPageSelectors = {
ajpListenersTableId: "undertow-server-ajp-listener-table",
};
const ajpListenerForm = {
id: "undertow-server-ajp-listener-form",
allowedReqAttrsPattern: "allowed-request-attributes-pattern",
};

before(() => {
cy.startWildflyContainer()
.then((result) => {
managementEndpoint = result as string;
})
.then(() => {
// create fixtures
cy.task("execute:cli", {
managementApi: managementEndpoint + "/management",
address: address,
operation: "add",
"socket-binding": testValues.ajpSocketBindings,
});
});
});

after(() => {
cy.task("stop:containers");
});

beforeEach(() => {
cy.navigateTo(managementEndpoint, "undertow-server;name=default-server");
// the form takes a brief moment to initialize
cy.wait(200);
cy.get(serverSelectors.serverListenersItem).click();
cy.get(serverSelectors.ajpListenerItem).click();
});

it("Test AJP Listener: allowed request attributes pattern", () => {
cy.selectInTable(ajpListenerPageSelectors.ajpListenersTableId, testValues.ajpListener);

cy.editForm(ajpListenerForm.id);
cy.text(ajpListenerForm.id, ajpListenerForm.allowedReqAttrsPattern, testValues.allowedReqAttrsPatternExpression, {
parseSpecialCharSequences: false,
});
cy.saveForm(ajpListenerForm.id);
cy.verifySuccess();
cy.verifyAttributeAsExpression(
managementEndpoint,
["subsystem", "undertow", "server", testValues.serverName, "ajp-listener", testValues.ajpListener],
ajpListenerForm.allowedReqAttrsPattern,
testValues.allowedReqAttrsPatternExpression
);
});
});

0 comments on commit f9e24d6

Please sign in to comment.