Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: [EAPQE-2410] Add test to verify AJP Listener allowed-request-attributes-pattern #120

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ Following is a table of supported environment properties that can be used when r

| Property name | Default value | Description |
| :--------------- | :---------------------------------------------- | :-------------------------------------------------------------------------------------------- |
| `HAL_IMAGE` | `quay.io/halconsole/hal-development:latest` | [HAL standalone image](https://hal.github.io/documentation/get-started/#container) to be used |
| `WILDFLY_IMAGE` | `quay.io/halconsole/wildfly-development:latest` | WildFly/JBoss EAP image to be used |
| `KEYCLOAK_IMAGE` | `quay.io/keycloak/keycloak:latest` | Keycloak/RH-SSO image to be used for OIDC tests |
| `POSTGRES_IMAGE` | `docker.io/library/postgres:latest` | PostgreSQL image to be used for datasource tests |
| `MYSQL_IMAGE` | `docker.io/library/mysql:latest` | MySQL image to be used for datasource tests |
| `MARIADB_IMAGE` | `docker.io/library/mariadb:latest` | MariaDB image to be used for datasource tests |
| `MSSQL_IMAGE` | `mcr.microsoft.com/mssql/server:2022-latest` | Microsoft SQL Server image to be used for datasource tests |
| `HAL_IMAGE` | `quay.io/halconsole/hal-development:latest` | [HAL standalone image](https://hal.github.io/documentation/get-started/#container) to be used |
| `WILDFLY_IMAGE` | `quay.io/halconsole/wildfly-development:latest` | WildFly/JBoss EAP image to be used |
| `KEYCLOAK_IMAGE` | `quay.io/keycloak/keycloak:latest` | Keycloak/RH-SSO image to be used for OIDC tests |
| `POSTGRES_IMAGE` | `docker.io/library/postgres:latest` | PostgreSQL image to be used for datasource tests |
| `MYSQL_IMAGE` | `docker.io/library/mysql:latest` | MySQL image to be used for datasource tests |
| `MARIADB_IMAGE` | `docker.io/library/mariadb:latest` | MariaDB image to be used for datasource tests |
| `MSSQL_IMAGE` | `mcr.microsoft.com/mssql/server:2022-latest` | Microsoft SQL Server image to be used for datasource tests |
| `WILDFLY_STABILITY_LEVEL` | NO DEFAULT VALUE | Value for `--stability=<VALUE>` in WildFly startup command, if not set, parameter is not used |

## Custom method documentation

Expand Down
15 changes: 7 additions & 8 deletions packages/testsuite/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ 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);
}
const wildfly = new GenericContainer(
process.env.WILDFLY_IMAGE || "quay.io/halconsole/wildfly-development:latest"
)
Expand All @@ -35,16 +39,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 +54,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()
istraka marked this conversation as resolved.
Show resolved Hide resolved
.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();
kstekovi marked this conversation as resolved.
Show resolved Hide resolved
cy.get(serverSelectors.ajpListenerItem).click();
});

it("Test AJP Listener: allowed request attributes pattern", () => {
istraka marked this conversation as resolved.
Show resolved Hide resolved
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
);
});
});