feat(e2e): share orchestrator installation script#60
feat(e2e): share orchestrator installation script#60AndrienkoAleksandr wants to merge 2 commits intoredhat-developer:mainfrom
Conversation
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com> Co-authored-by: Yona First <yfirst@redhat.com> Co-authored-by: Gustavo Lira e Silva <guga.java@gmail.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
There was a problem hiding this comment.
The script is added to the files array so it ships with the npm package, but there's no clean way for consumers to invoke it. They'd have to reference it via a fragile node_modules
path:
await $bash node_modules/@red-hat-developer-hub/e2e-test-utils/scripts/install-orchestrator.sh ${namespace};
This is brittle (breaks with different package manager hoisting strategies like yarn PnP, pnpm) and inconsistent with the rest of the package where everything is exported as
TypeScript.
Suggestion: Add a TypeScript wrapper that uses zx's $ and export it. Following the existing pattern of keycloak/ and rhdh/ under src/deployment/, orchestrator should be its own
deployment module with the script co-located:
src/deployment/orchestrator/
├── index.ts # exports installOrchestrator()
└── install-orchestrator.sh # the script (moved from scripts/)
// src/deployment/orchestrator/index.ts
import { resolve } from "path";
import { $ } from "../../utils/index.js";
const scriptPath = resolve(import.meta.dirname, "install-orchestrator.sh");
export async function installOrchestrator(namespace = "orchestrator") {
await $bash ${scriptPath} ${namespace};
}
The .sh file needs to be copied to dist/ during build, following the existing pattern used by rhdh/config and keycloak/config:
"build": "yarn clean && tsc -p tsconfig.build.json && cp -r src/deployment/rhdh/config dist/deployment/rhdh/ && cp -r src/deployment/keycloak/config dist/deployment/keycloak/ && cp
src/deployment/orchestrator/install-orchestrator.sh dist/deployment/orchestrator/"
With a new export in package.json:
"./orchestrator": {
"types": "./dist/deployment/orchestrator/index.d.ts",
"default": "./dist/deployment/orchestrator/index.js"
}
This way the "scripts" entry in the files array can be dropped — the script ships inside dist/ which is already included.
Consumer usage would then be clean and consistent:
import { installOrchestrator } from "@red-hat-developer-hub/e2e-test-utils/orchestrator";
test.beforeAll(async () => {
await installOrchestrator("my-namespace");
});
also please fix the failing pr checks on this pr. and I hope we are also testing these changes locally for your new PR on overlay because we don't have a any job/pr check that validates this.
| fi | ||
| fi | ||
|
|
||
| local pqsl_secret_name pqsl_svc_name |
There was a problem hiding this comment.
seems like a type Typo: pqsl → psql
|
|
||
| set -e | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| log::success "Orchestrator deployment completed successfully!" | ||
| } | ||
|
|
||
| main "$@" No newline at end of file |
There was a problem hiding this comment.
| main "$@" | |
| main "$@" | |
Fix newline at EOF
| configure_namespace() { | ||
| local project=$1 | ||
| log::warn "Recreating namespace: $project" | ||
| delete_namespace "$project" |
There was a problem hiding this comment.
package have k8s api's to perform deltion and creation, also the fixture creates the namespace, if we delete it might interfere with it. so i would say let the consumer (test) control it.
Our e2e tests should cover Orchestrator feature for two plugins: orchestrator and bulk-import. It would be nice to have a common script place to use this script in the overlay repository. Also this pr is reaction on comment redhat-developer/rhdh-plugin-export-overlays#1972 (comment)