From ed57855675e8ca306d5869bb24e9b3b0b6ebf75a Mon Sep 17 00:00:00 2001 From: mdolhalo Date: Tue, 22 Aug 2023 12:27:52 +0200 Subject: [PATCH] feat: updated PodOverridesAPI.spec.ts to work with aigap cluster Signed-off-by: mdolhalo --- tests/e2e/constants/BaseTestConstants.ts | 2 + tests/e2e/resources/pod-overrides-airgap.yaml | 37 +++++++++++++++++++ tests/e2e/specs/api/PodOverridesAPI.spec.ts | 3 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 tests/e2e/resources/pod-overrides-airgap.yaml diff --git a/tests/e2e/constants/BaseTestConstants.ts b/tests/e2e/constants/BaseTestConstants.ts index 96d0d21f073..0ff0fb2fb00 100644 --- a/tests/e2e/constants/BaseTestConstants.ts +++ b/tests/e2e/constants/BaseTestConstants.ts @@ -18,6 +18,8 @@ export const BaseTestConstants: any = { */ TS_SELENIUM_BASE_URL: !process.env.TS_SELENIUM_BASE_URL ? 'http://sample-url' : process.env.TS_SELENIUM_BASE_URL.replace(/\/$/, ''), + IS_CLUSTER_DISCONNECTED: () => BaseTestConstants.TS_SELENIUM_BASE_URL.includes('airgap'), + /** * Choose the platform where "che" application deployed, "openshift" by default. */ diff --git a/tests/e2e/resources/pod-overrides-airgap.yaml b/tests/e2e/resources/pod-overrides-airgap.yaml new file mode 100644 index 00000000000..32a70ffc715 --- /dev/null +++ b/tests/e2e/resources/pod-overrides-airgap.yaml @@ -0,0 +1,37 @@ +kind: DevWorkspace +apiVersion: workspace.devfile.io/v1alpha2 +metadata: + name: code-latest-pod-overrides +spec: + started: true + template: + attributes: + pod-overrides: + metadata: + annotations: + io.openshift.userns: "true" + io.kubernetes.cri-o.userns-mode: "auto:size=65536;map-to-root=true" # <-- user namespace + openshift.io/scc: container-build + spec: + runtimeClassName: kata + schedulerName: stork + projects: + - name: web-nodejs-sample + git: + remotes: + origin: "https://github.com/che-samples/web-nodejs-sample.git" + commands: + - id: say-hello + exec: + component: che-code-runtime-description + commandLine: echo "Hello from $(pwd)" + workingDir: ${PROJECT_SOURCE}/app + contributions: + - name: che-code + uri: http://plugin-registry.openshift-devspaces.svc.cluster.local:8080/v3/plugins/che-incubator/che-code/latest/devfile.yaml + components: + - name: che-code-runtime-description + container: + env: + - name: CODE_HOST + value: 0.0.0.0 diff --git a/tests/e2e/specs/api/PodOverridesAPI.spec.ts b/tests/e2e/specs/api/PodOverridesAPI.spec.ts index a57e307ba50..985b9369c8c 100644 --- a/tests/e2e/specs/api/PodOverridesAPI.spec.ts +++ b/tests/e2e/specs/api/PodOverridesAPI.spec.ts @@ -4,9 +4,10 @@ import path from 'path'; import YAML from 'yaml'; import { expect } from 'chai'; import { ShellExecutor } from '../../utils/ShellExecutor'; +import { BaseTestConstants } from '../../constants/BaseTestConstants'; suite(`Test defining pod overrides via attribute.`, async function(): Promise { - const pathToSampleFile: string = path.resolve('resources/pod-overrides.yaml'); + const pathToSampleFile: string = path.resolve(`resources/pod-overrides${BaseTestConstants.IS_CLUSTER_DISCONNECTED() ? '-airgap' : ''}.yaml`); const workspaceName: string = YAML.parse(fs.readFileSync(pathToSampleFile, 'utf8')).metadata.name; const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(workspaceName);