@red-hat-developer-hub/e2e-test-utils 1.1.10 → 1.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import KeycloakAdminClient from "@keycloak/keycloak-admin-client";
2
2
  import { KubernetesClientHelper } from "../../utils/kubernetes-client.js";
3
- import { $ } from "../../utils/bash.js";
3
+ import { $, runQuietUnlessFailure } from "../../utils/bash.js";
4
4
  import { DEFAULT_KEYCLOAK_CONFIG, BITNAMI_CHART_REPO, BITNAMI_CHART_NAME, DEFAULT_CONFIG_PATHS, DEFAULT_RHDH_CLIENT, SERVICE_ACCOUNT_ROLES, DEFAULT_USERS, DEFAULT_GROUPS, } from "./constants.js";
5
5
  export class KeycloakHelper {
6
6
  k8sClient = new KubernetesClientHelper();
@@ -310,10 +310,10 @@ export class KeycloakHelper {
310
310
  }
311
311
  async _deployWithHelm() {
312
312
  await $ `helm repo add bitnami ${BITNAMI_CHART_REPO} || true`;
313
- await $ `helm repo update > /dev/null 2>&1`;
314
- await $ `helm upgrade --install ${this.deploymentConfig.releaseName} ${BITNAMI_CHART_NAME} \
313
+ await runQuietUnlessFailure `helm repo update`;
314
+ await runQuietUnlessFailure `helm upgrade --install ${this.deploymentConfig.releaseName} ${BITNAMI_CHART_NAME} \
315
315
  --namespace ${this.deploymentConfig.namespace} \
316
- --values ${this.deploymentConfig.valuesFile} > /dev/null 2>&1`;
316
+ --values ${this.deploymentConfig.valuesFile}`;
317
317
  await this.waitUntilReady();
318
318
  }
319
319
  async _createRoute() {
@@ -5,7 +5,9 @@ export declare class RHDHDeployment {
5
5
  rhdhUrl: string;
6
6
  deploymentConfig: DeploymentConfig;
7
7
  constructor(namespace: string);
8
- deploy(): Promise<void>;
8
+ deploy(options?: {
9
+ timeout?: number | null;
10
+ }): Promise<void>;
9
11
  private _applyAppConfig;
10
12
  private _applySecrets;
11
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../../src/deployment/rhdh/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAiB1E,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAGjB,MAAM,YAAY,CAAC;AAEpB,qBAAa,cAAc;IAClB,SAAS,yBAAgC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,gBAAgB,CAAC;gBAE9B,SAAS,EAAE,MAAM;IAUvB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;YAqBf,eAAe;YAgBf,aAAa;IAqB3B;;;OAGG;YACW,0BAA0B;YAuC1B,oBAAoB;YAWpB,eAAe;YAmCf,mBAAmB;IAiD3B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAWrC;;;;OAIG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAOpC,cAAc,CAAC,OAAO,GAAE,MAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBpD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YAIjB,oBAAoB;IAsClC;;;OAGG;YACW,0BAA0B;IAwCxC,OAAO,CAAC,sBAAsB;IAoCxB,SAAS,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAcrE,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,SAAS;CAMlB"}
1
+ {"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../../src/deployment/rhdh/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAiB1E,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAGjB,MAAM,YAAY,CAAC;AAEpB,qBAAa,cAAc;IAClB,SAAS,yBAAgC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,gBAAgB,CAAC;gBAE9B,SAAS,EAAE,MAAM;IAUvB,MAAM,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YAyBpD,eAAe;YAgBf,aAAa;IAqB3B;;;OAGG;YACW,0BAA0B;YAuC1B,oBAAoB;YAWpB,eAAe;YAmCf,mBAAmB;IAiD3B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAWrC;;;;OAIG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAOpC,cAAc,CAAC,OAAO,GAAE,MAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBpD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YAIjB,oBAAoB;IAsClC;;;OAGG;YACW,0BAA0B;IAwCxC,OAAO,CAAC,sBAAsB;IAoCxB,SAAS,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAcrE,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,SAAS;CAMlB"}
@@ -19,9 +19,13 @@ export class RHDHDeployment {
19
19
  this._log("RHDH Base URL: " + this.rhdhUrl);
20
20
  console.table(this.deploymentConfig);
21
21
  }
22
- async deploy() {
22
+ async deploy(options) {
23
23
  this._log("Starting RHDH deployment...");
24
- test.setTimeout(600_000);
24
+ // Default 600s, custom number to override, null to skip and let consumer control the timeout
25
+ const timeout = options?.timeout === undefined ? 600_000 : options.timeout;
26
+ if (timeout !== null) {
27
+ test.setTimeout(timeout);
28
+ }
25
29
  await this.k8sClient.createNamespaceIfNotExists(this.deploymentConfig.namespace);
26
30
  await this._applyAppConfig();
27
31
  await this._applySecrets();
@@ -1,3 +1,9 @@
1
1
  import { $ } from "zx";
2
+ /**
3
+ * Runs a shell command with stdout/stderr captured. On success, output is not printed.
4
+ * On non-zero exit, stdout and stderr are written to console.error and an error is thrown.
5
+ * Use for noisy commands that should stay quiet on success but show output when they fail.
6
+ */
7
+ export declare function runQuietUnlessFailure(strings: TemplateStringsArray, ...values: unknown[]): Promise<void>;
2
8
  export { $ };
3
9
  //# sourceMappingURL=bash.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/utils/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC;AAKvB,OAAO,EAAE,CAAC,EAAE,CAAC"}
1
+ {"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/utils/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC;AAYvB;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,oBAAoB,EAC7B,GAAG,MAAM,EAAE,OAAO,EAAE,GACnB,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED,OAAO,EAAE,CAAC,EAAE,CAAC"}
@@ -1,4 +1,25 @@
1
1
  import { $ } from "zx";
2
2
  $.quiet = true;
3
3
  $.stdio = ["inherit", "inherit", "inherit"];
4
+ /**
5
+ * Runs a shell command with stdout/stderr captured. On success, output is not printed.
6
+ * On non-zero exit, stdout and stderr are written to console.error and an error is thrown.
7
+ * Use for noisy commands that should stay quiet on success but show output when they fail.
8
+ */
9
+ export async function runQuietUnlessFailure(strings, ...values) {
10
+ const runWithPipe = $({
11
+ stdio: ["pipe", "pipe", "pipe"],
12
+ nothrow: true,
13
+ });
14
+ const result = (await runWithPipe(strings, ...values));
15
+ if (result.exitCode !== 0) {
16
+ if (result.stdout?.trim()) {
17
+ console.error("[command stdout]:", result.stdout.trim());
18
+ }
19
+ if (result.stderr?.trim()) {
20
+ console.error("[command stderr]:", result.stderr.trim());
21
+ }
22
+ throw new Error(`Command failed with exit code ${result.exitCode}. Output above.`);
23
+ }
24
+ }
4
25
  export { $ };
@@ -1,5 +1,5 @@
1
1
  export { envsubst } from "./common.js";
2
- export { $ } from "./bash.js";
2
+ export { $, runQuietUnlessFailure } from "./bash.js";
3
3
  export { mergeYamlFiles, mergeYamlFilesIfExists, mergeYamlFilesToFile, } from "./merge-yamls.js";
4
4
  export { KubernetesClientHelper } from "./kubernetes-client.js";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAC9B,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { envsubst } from "./common.js";
2
- export { $ } from "./bash.js";
2
+ export { $, runQuietUnlessFailure } from "./bash.js";
3
3
  export { mergeYamlFiles, mergeYamlFilesIfExists, mergeYamlFilesToFile, } from "./merge-yamls.js";
4
4
  export { KubernetesClientHelper } from "./kubernetes-client.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@red-hat-developer-hub/e2e-test-utils",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "Test utilities for RHDH E2E tests",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {