feat(e2e): share orchestrator installation script#60
Conversation
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.
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>
Co-authored-by: Subhash Khileri <subhashkhileri2@gmail.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
20eb736 to
072b9ff
Compare
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
072b9ff to
9923780
Compare
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
ffac7a3 to
b5f6a80
Compare
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
src/deployment/orchestrator/ @subhashkhileri, thank you very much! Done. |
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
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)