@eclipse-che/che-e2e 7.100.0-next-45d4d3d → 7.100.0

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.
package/CODE_STYLE.md CHANGED
@@ -33,8 +33,8 @@ Automated lint checking and code format performs with ESLint and Prettier tools
33
33
  pre-commit hook.
34
34
  Full set of rules can be found:
35
35
 
36
- - [.eslintrc](.eslintrc.js)
37
- - [.prettierrc](.prettierrc.json)
36
+ - [.eslintrc](.eslintrc.js)
37
+ - [.prettierrc](.prettierrc.json)
38
38
 
39
39
  ### Preferable code style
40
40
 
package/README.md CHANGED
@@ -2,33 +2,33 @@
2
2
 
3
3
  ## Requirements
4
4
 
5
- - node 16.x
6
- - "Chrome" browser 114.x or later
7
- - deployed Che 7 with accessible URL
5
+ - node 16.x
6
+ - "Chrome" browser 114.x or later
7
+ - deployed Che 7 with accessible URL
8
8
 
9
9
  ## Before launch
10
10
 
11
11
  **Perform commands:**
12
12
 
13
- - `export TS_SELENIUM_BASE_URL=<Che7 URL>`
14
- - `npm ci`
13
+ - `export TS_SELENIUM_BASE_URL=<Che7 URL>`
14
+ - `npm ci`
15
15
 
16
16
  Note: If there is any modifications in package.json, manually execute the `npm install` to update the package-lock.json. So that errors can be avoided while executing npm ci
17
17
 
18
18
  ## Default launch
19
19
 
20
- - Provide connection credentials:
21
- - `export TS_SELENIUM_OCP_USERNAME=<username>`
22
- - `export TS_SELENIUM_OCP_PASSWORD=<password>`
23
- - `npm run test`
20
+ - Provide connection credentials:
21
+ - `export TS_SELENIUM_OCP_USERNAME=<username>`
22
+ - `export TS_SELENIUM_OCP_PASSWORD=<password>`
23
+ - `npm run test`
24
24
 
25
25
  ## Custom launch
26
26
 
27
- - Use environment variables which described in the "constants" folder
28
- - Use environment variables for setting timeouts if needed. You can see the list in **`'TimeoutConstants.ts'`**. You can see the list of those variables and their value if you set the `'TS_SELENIUM_PRINT_TIMEOUT_VARIABLES = true'`
29
- - To test one specification export file name as `export USERSTORY=<spec-file-name-without-extension> && npm run test` (example: `-e USERSTORY=Quarkus`)
30
- - To run test without Selenium WebDriver (API tests etc.) use `export USERSTORY=<spec-file-name-without-extension> && npm run driver-less-test` (example: `-e USERSTORY=CloneGitRepoAPI`)
31
- - This project support application testing deployed on Kubernetes or Openshift platform. Openshift is default value. To switch into Kubernetes, please, use `TS_PLATFORM=kubernetes` environmental variable and `TS_SELENIUM_K8S_PASSWORD`, `TS_SELENIUM_K8S_USERNAME` to provide credentials. The sample of test command in this case:
27
+ - Use environment variables which described in the "constants" folder
28
+ - Use environment variables for setting timeouts if needed. You can see the list in **`'TimeoutConstants.ts'`**. You can see the list of those variables and their value if you set the `'TS_SELENIUM_PRINT_TIMEOUT_VARIABLES = true'`
29
+ - To test one specification export file name as `export USERSTORY=<spec-file-name-without-extension> && npm run test` (example: `-e USERSTORY=Quarkus`)
30
+ - To run test without Selenium WebDriver (API tests etc.) use `export USERSTORY=<spec-file-name-without-extension> && npm run driver-less-test` (example: `-e USERSTORY=CloneGitRepoAPI`)
31
+ - This project support application testing deployed on Kubernetes or Openshift platform. Openshift is default value. To switch into Kubernetes, please, use `TS_PLATFORM=kubernetes` environmental variable and `TS_SELENIUM_K8S_PASSWORD`, `TS_SELENIUM_K8S_USERNAME` to provide credentials. The sample of test command in this case:
32
32
  ```
33
33
  export TS_PLATFORM=kubernetes && \
34
34
  export TS_SELENIUM_K8S_USERNAME=<username> && \
@@ -37,21 +37,21 @@ Note: If there is any modifications in package.json, manually execute the `npm i
37
37
  npm run test
38
38
  ```
39
39
  Also, environmental variables can be set in files in "constants" folder.
40
- - Local test results can be represented with Allure reporter `npm run open-allure-dasboard`
40
+ - Local test results can be represented with Allure reporter `npm run open-allure-dasboard`
41
41
 
42
42
  ## Docker launch
43
43
 
44
- - open terminal and go to the "e2e" directory
45
- - export the `"TS_SELENIUM_BASE_URL"` variable with "Che" url
46
- - run command `"npm run test-docker"`
44
+ - open terminal and go to the "e2e" directory
45
+ - export the `"TS_SELENIUM_BASE_URL"` variable with "Che" url
46
+ - run command `"npm run test-docker"`
47
47
 
48
48
  ## Docker launch with changed tests
49
49
 
50
50
  **For launching tests with local changes perform next steps:**
51
51
 
52
- - open terminal and go to the "e2e" directory
53
- - export the `"TS_SELENIUM_BASE_URL"` variable with "Che" url
54
- - run command `"npm run test-docker-mount-e2e"`
52
+ - open terminal and go to the "e2e" directory
53
+ - export the `"TS_SELENIUM_BASE_URL"` variable with "Che" url
54
+ - run command `"npm run test-docker-mount-e2e"`
55
55
 
56
56
  ## Debug docker launch
57
57
 
@@ -62,27 +62,27 @@ The `'eclipse/che-e2e'` docker image has VNC server installed inside. For connec
62
62
  **The easiest way to do that is to perform steps which are described in the "Docker launch" paragraph.
63
63
  For running tests without docker, please perform next steps:**
64
64
 
65
- - Deploy Che on Kubernetes infrastructure by using 'Minikube' and 'Chectl' <https://github.com/eclipse-che/che-server/blob/HEAD/deploy/kubernetes/README.md>
66
- - Create workspace by using 'Chectl' and devfile
67
- - link to 'Chectl' manual <https://github.com/che-incubator/chectl#chectl-workspacestart>
68
- - link to devfile ( **`For successfull test passing, exactly provided devfile should be used`** )
69
- <https://gist.githubusercontent.com/Ohrimenko1988/93f5426f4ebc1705c55feb8ff0396a49/raw/cbea89ad145ba33ed34a151a12c50f045f9f3b78/yaml-ls-bug.yaml>
70
- - Provide the **`'TS_SELENIUM_BASE_URL'`** environment variable as described above
71
- - export TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME=EmptyWorkspace (default value, see BASE_TEST_CONSTANTS.ts)
72
- - perform command **`export USERSTORY=$TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME && npm run test-all-devfiles`**
65
+ - Deploy Che on Kubernetes infrastructure by using 'Minikube' and 'Chectl' <https://github.com/eclipse-che/che-server/blob/HEAD/deploy/kubernetes/README.md>
66
+ - Create workspace by using 'Chectl' and devfile
67
+ - link to 'Chectl' manual <https://github.com/che-incubator/chectl#chectl-workspacestart>
68
+ - link to devfile ( **`For successfull test passing, exactly provided devfile should be used`** )
69
+ <https://gist.githubusercontent.com/Ohrimenko1988/93f5426f4ebc1705c55feb8ff0396a49/raw/cbea89ad145ba33ed34a151a12c50f045f9f3b78/yaml-ls-bug.yaml>
70
+ - Provide the **`'TS_SELENIUM_BASE_URL'`** environment variable as described above
71
+ - export TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME=EmptyWorkspace (default value, see BASE_TEST_CONSTANTS.ts)
72
+ - perform command **`export USERSTORY=$TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME && npm run test-all-devfiles`**
73
73
 
74
74
  ## Launching the DevWorkspaceHappyPath spec file using Che with oauth authentication
75
75
 
76
76
  **Setup next environment variables:**
77
77
 
78
- - export TS_SELENIUM_BASE_URL=\<Che-URL\>
79
- - export TS_SELENIUM_OCP_USERNAME=\<cluster-username\>
80
- - export TS_SELENIUM_OCP_PASSWORD=\<cluster-password\>
81
- - export TS_SELENIUM_VALUE_OPENSHIFT_OAUTH="true"
82
- - export TS_OCP_LOGIN_PAGE_PROVIDER_TITLE=\<login-provide-title\>
83
- - export TS_SELENIUM_DEVWORKSPACE_URL=\<devworkspace-url\>
84
- - export TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME=EmptyWorkspace (default value, see BASE_TEST_CONSTANTS.ts)
78
+ - export TS_SELENIUM_BASE_URL=\<Che-URL\>
79
+ - export TS_SELENIUM_OCP_USERNAME=\<cluster-username\>
80
+ - export TS_SELENIUM_OCP_PASSWORD=\<cluster-password\>
81
+ - export TS_SELENIUM_VALUE_OPENSHIFT_OAUTH="true"
82
+ - export TS_OCP_LOGIN_PAGE_PROVIDER_TITLE=\<login-provide-title\>
83
+ - export TS_SELENIUM_DEVWORKSPACE_URL=\<devworkspace-url\>
84
+ - export TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME=EmptyWorkspace (default value, see BASE_TEST_CONSTANTS.ts)
85
85
 
86
86
  **Execute the npm command:**
87
87
 
88
- - perform command `export USERSTORY=$TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME && npm run test-all-devfiles`
88
+ - perform command `export USERSTORY=$TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME && npm run test-all-devfiles`
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /** *******************************************************************
4
+ * copyright (c) 2025 Red Hat, Inc.
5
+ *
6
+ * This program and the accompanying materials are made
7
+ * available under the terms of the Eclipse Public License 2.0
8
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
9
+ *
10
+ * SPDX-License-Identifier: EPL-2.0
11
+ **********************************************************************/
12
+ const chai_1 = require("chai");
13
+ const inversify_config_1 = require("../../configs/inversify.config");
14
+ const inversify_types_1 = require("../../configs/inversify.types");
15
+ const BASE_TEST_CONSTANTS_1 = require("../../constants/BASE_TEST_CONSTANTS");
16
+ const WorkspaceHandlingTests_1 = require("../../tests-library/WorkspaceHandlingTests");
17
+ const MochaHooks_1 = require("../MochaHooks");
18
+ suite(`Test podman build container functionality ${BASE_TEST_CONSTANTS_1.BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function () {
19
+ const projectAndFileTests = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.ProjectAndFileTests);
20
+ const workspaceHandlingTests = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.WorkspaceHandlingTests);
21
+ const loginTests = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.LoginTests);
22
+ const browserTabsUtil = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.BrowserTabsUtil);
23
+ const testWorkspaceUtil = inversify_config_1.e2eContainer.get(inversify_types_1.TYPES.WorkspaceUtil);
24
+ const dashboard = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.Dashboard);
25
+ const shellExecutor = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.ShellExecutor);
26
+ let kubernetesCommandLineToolsExecutor;
27
+ let workspaceName = '';
28
+ let originalBuildCapabilitiesSetting = '';
29
+ let devSpacesNamespace = '';
30
+ let cheClusterName = '';
31
+ const buildPushScript = `
32
+ export ARCH=$(uname -m)
33
+ export DATE=$(date +"%m%d%y")
34
+ export USER=$(oc whoami)
35
+ export TKN=$(oc whoami -t)
36
+ export REG="image-registry.openshift-image-registry.svc:5000"
37
+ export PROJECT=$(oc project -q)
38
+ export IMG="\${REG}/\${PROJECT}/hello:\${DATE}"
39
+
40
+ # Create test directory and Dockerfile
41
+ mkdir -p /projects/dockerfile-test
42
+ cd /projects/dockerfile-test
43
+
44
+ cat > Dockerfile << EOF
45
+ FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
46
+ RUN echo "Hello from Kubedock!" > /hello.txt
47
+ CMD ["cat", "/hello.txt"]
48
+ EOF
49
+
50
+ podman login --tls-verify=false --username "\${USER}" --password "\${TKN}" "\${REG}"
51
+ podman build -t "\${IMG}" .
52
+ podman push --tls-verify=false "\${IMG}"
53
+ `;
54
+ const runTestScript = `
55
+ export DATE=$(date +"%m%d%y")
56
+ export REG="image-registry.openshift-image-registry.svc:5000"
57
+ export PROJECT=$(oc project -q)
58
+ export IMG="\${REG}/\${PROJECT}/hello:\${DATE}"
59
+
60
+ oc delete pod test-hello-pod --ignore-not-found
61
+ oc run test-hello-pod --restart=Never --image="\${IMG}"
62
+
63
+ if ! oc wait --for=jsonpath='{.status.phase}'=Succeeded pod/test-hello-pod --timeout=60s; then
64
+ PHASE=$(oc get pod test-hello-pod -o jsonpath='{.status.phase}')
65
+ if [[ "$PHASE" == "Failed" ]]; then
66
+ oc describe pod test-hello-pod
67
+ exit 1
68
+ fi
69
+ fi
70
+
71
+ oc logs test-hello-pod
72
+ `;
73
+ suiteSetup('Setup DevSpaces with container build capabilities enabled', function () {
74
+ kubernetesCommandLineToolsExecutor = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.KubernetesCommandLineToolsExecutor);
75
+ kubernetesCommandLineToolsExecutor.loginToOcp();
76
+ // get the namespace where DevSpaces is installed
77
+ const getDevSpacesNamespaceCommand = 'oc get checluster --all-namespaces -o jsonpath="{.items[0].metadata.namespace}"';
78
+ devSpacesNamespace = shellExecutor.executeCommand(getDevSpacesNamespaceCommand).stdout.trim();
79
+ // get the name of the CheCluster
80
+ const getCheClusterNameCommand = `oc get checluster -n ${devSpacesNamespace} -o jsonpath='{.items[0].metadata.name}'`;
81
+ cheClusterName = shellExecutor.executeCommand(getCheClusterNameCommand).stdout.trim();
82
+ // get the original value of disableContainerBuildCapabilities
83
+ const getOriginalSettingCommand = `oc get checluster/${cheClusterName} -n ${devSpacesNamespace} -o jsonpath='{.spec.devEnvironments.disableContainerBuildCapabilities}'`;
84
+ originalBuildCapabilitiesSetting = shellExecutor.executeCommand(getOriginalSettingCommand).stdout.trim();
85
+ // patch the CheCluster to enable container build capabilities
86
+ const patchCommand = `oc patch checluster/${cheClusterName} -n ${devSpacesNamespace} --type=merge -p '{"spec":{"devEnvironments":{"disableContainerBuildCapabilities":false}}}'`;
87
+ const patchResult = shellExecutor.executeCommand(patchCommand);
88
+ (0, chai_1.expect)(patchResult.code).to.equal(0, 'Failed to patch CheCluster to enable container build capabilities');
89
+ });
90
+ suiteSetup('Login into DevSpaces', async function () {
91
+ await loginTests.loginIntoChe();
92
+ });
93
+ test('Create and open new Empty Workspace', async function () {
94
+ await dashboard.waitPage();
95
+ await workspaceHandlingTests.createAndOpenWorkspace('Empty Workspace');
96
+ await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
97
+ workspaceName = WorkspaceHandlingTests_1.WorkspaceHandlingTests.getWorkspaceName();
98
+ (0, chai_1.expect)(workspaceName, 'Workspace name was not detected').not.empty;
99
+ (0, MochaHooks_1.registerRunningWorkspace)(workspaceName);
100
+ });
101
+ test('Wait for workspace readiness', async function () {
102
+ await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
103
+ });
104
+ test('Build and push container image from workspace', function () {
105
+ kubernetesCommandLineToolsExecutor = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.KubernetesCommandLineToolsExecutor);
106
+ kubernetesCommandLineToolsExecutor.workspaceName = workspaceName;
107
+ kubernetesCommandLineToolsExecutor.loginToOcp();
108
+ kubernetesCommandLineToolsExecutor.getPodAndContainerNames();
109
+ kubernetesCommandLineToolsExecutor.execInContainerCommand(buildPushScript);
110
+ });
111
+ test('Verify container image can be used in a pod', function () {
112
+ const runTestScriptOutput = kubernetesCommandLineToolsExecutor.execInContainerCommand(runTestScript);
113
+ (0, chai_1.expect)(runTestScriptOutput.stdout).to.include('Hello from Kubedock!', 'Expected "Hello from Kubedock!" message not found in logs');
114
+ });
115
+ suiteTeardown('Open dashboard and close all other tabs', async function () {
116
+ await dashboard.openDashboard();
117
+ await browserTabsUtil.closeAllTabsExceptCurrent();
118
+ });
119
+ suiteTeardown('Stop and delete the workspace by API', async function () {
120
+ await testWorkspaceUtil.stopAndDeleteWorkspaceByName(workspaceName);
121
+ });
122
+ suiteTeardown('Unregister running workspace', function () {
123
+ (0, MochaHooks_1.registerRunningWorkspace)('');
124
+ });
125
+ suiteTeardown('Restore DevSpaces container build capabilities setting', function () {
126
+ kubernetesCommandLineToolsExecutor = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.KubernetesCommandLineToolsExecutor);
127
+ kubernetesCommandLineToolsExecutor.loginToOcp();
128
+ // default to false if value wasn't found
129
+ const validSetting = ['true', 'false'].includes(originalBuildCapabilitiesSetting)
130
+ ? originalBuildCapabilitiesSetting
131
+ : 'false';
132
+ const restorePatchCommand = `oc patch checluster/${cheClusterName} -n ${devSpacesNamespace} --type=merge -p '{"spec":{"devEnvironments":{"disableContainerBuildCapabilities":${validSetting}}}}'`;
133
+ const restorePatchResult = shellExecutor.executeCommand(restorePatchCommand);
134
+ (0, chai_1.expect)(restorePatchResult.code).to.equal(0, 'Failed to restore CheCluster container build capabilities setting');
135
+ });
136
+ });
137
+ //# sourceMappingURL=BuildPushRunPodmanContainerAPI.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuildPushR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BAAY,CAAC,GAAG,CAAC,yBAAO,CAAC,kCAAkC,CAAC,CAAC;QAClG,kCAAkC,CAAC,UAAU,EAAE,CAAC;QAEhD,yCAAyC;QACzC,MAAM,YAAY,GAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,gCAAgC,CAAC;YACxF,CAAC,CAAC,gCAAgC;YAClC,CAAC,CAAC,OAAO,CAAC;QAEX,MAAM,mBAAmB,GAAW,uBAAuB,cAAc,OAAO,kBAAkB,qFAAqF,YAAY,MAAM,CAAC;QAC1M,MAAM,kBAAkB,GAAgB,aAAa,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;QAE1F,IAAA,aAAM,EAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,mEAAmE,CAAC,CAAC;IAClH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-che/che-e2e",
3
- "version": "7.100.0-next-45d4d3d",
3
+ "version": "7.100.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -66,7 +66,8 @@
66
66
  "dependencies": {
67
67
  "@eclipse-che/api": "latest",
68
68
  "inversify": "6.0.1",
69
- "reflect-metadata": "0.1.13"
69
+ "reflect-metadata": "0.1.13",
70
+ "@eclipse-che/che-devworkspace-generator": "7.100.0"
70
71
  },
71
72
  "resolutions": {
72
73
  "minimist": "^1.2.5"
@@ -0,0 +1,164 @@
1
+ /** *******************************************************************
2
+ * copyright (c) 2025 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ **********************************************************************/
10
+ import { expect } from 'chai';
11
+ import { e2eContainer } from '../../configs/inversify.config';
12
+ import { CLASSES, TYPES } from '../../configs/inversify.types';
13
+ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
14
+ import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
15
+ import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
16
+ import { LoginTests } from '../../tests-library/LoginTests';
17
+ import { registerRunningWorkspace } from '../MochaHooks';
18
+ import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
19
+ import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
20
+ import { ShellString } from 'shelljs';
21
+ import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil';
22
+ import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
23
+ import { ShellExecutor } from '../../utils/ShellExecutor';
24
+
25
+ suite(`Test podman build container functionality ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
26
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
27
+ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
28
+ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
29
+ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
30
+ const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
31
+ const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
32
+ const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
33
+
34
+ let kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor;
35
+ let workspaceName: string = '';
36
+ let originalBuildCapabilitiesSetting: string = '';
37
+ let devSpacesNamespace: string = '';
38
+ let cheClusterName: string = '';
39
+
40
+ const buildPushScript: string = `
41
+ export ARCH=$(uname -m)
42
+ export DATE=$(date +"%m%d%y")
43
+ export USER=$(oc whoami)
44
+ export TKN=$(oc whoami -t)
45
+ export REG="image-registry.openshift-image-registry.svc:5000"
46
+ export PROJECT=$(oc project -q)
47
+ export IMG="\${REG}/\${PROJECT}/hello:\${DATE}"
48
+
49
+ # Create test directory and Dockerfile
50
+ mkdir -p /projects/dockerfile-test
51
+ cd /projects/dockerfile-test
52
+
53
+ cat > Dockerfile << EOF
54
+ FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
55
+ RUN echo "Hello from Kubedock!" > /hello.txt
56
+ CMD ["cat", "/hello.txt"]
57
+ EOF
58
+
59
+ podman login --tls-verify=false --username "\${USER}" --password "\${TKN}" "\${REG}"
60
+ podman build -t "\${IMG}" .
61
+ podman push --tls-verify=false "\${IMG}"
62
+ `;
63
+
64
+ const runTestScript: string = `
65
+ export DATE=$(date +"%m%d%y")
66
+ export REG="image-registry.openshift-image-registry.svc:5000"
67
+ export PROJECT=$(oc project -q)
68
+ export IMG="\${REG}/\${PROJECT}/hello:\${DATE}"
69
+
70
+ oc delete pod test-hello-pod --ignore-not-found
71
+ oc run test-hello-pod --restart=Never --image="\${IMG}"
72
+
73
+ if ! oc wait --for=jsonpath='{.status.phase}'=Succeeded pod/test-hello-pod --timeout=60s; then
74
+ PHASE=$(oc get pod test-hello-pod -o jsonpath='{.status.phase}')
75
+ if [[ "$PHASE" == "Failed" ]]; then
76
+ oc describe pod test-hello-pod
77
+ exit 1
78
+ fi
79
+ fi
80
+
81
+ oc logs test-hello-pod
82
+ `;
83
+
84
+ suiteSetup('Setup DevSpaces with container build capabilities enabled', function (): void {
85
+ kubernetesCommandLineToolsExecutor = e2eContainer.get(CLASSES.KubernetesCommandLineToolsExecutor);
86
+ kubernetesCommandLineToolsExecutor.loginToOcp();
87
+
88
+ // get the namespace where DevSpaces is installed
89
+ const getDevSpacesNamespaceCommand: string = 'oc get checluster --all-namespaces -o jsonpath="{.items[0].metadata.namespace}"';
90
+ devSpacesNamespace = shellExecutor.executeCommand(getDevSpacesNamespaceCommand).stdout.trim();
91
+
92
+ // get the name of the CheCluster
93
+ const getCheClusterNameCommand: string = `oc get checluster -n ${devSpacesNamespace} -o jsonpath='{.items[0].metadata.name}'`;
94
+ cheClusterName = shellExecutor.executeCommand(getCheClusterNameCommand).stdout.trim();
95
+
96
+ // get the original value of disableContainerBuildCapabilities
97
+ const getOriginalSettingCommand: string = `oc get checluster/${cheClusterName} -n ${devSpacesNamespace} -o jsonpath='{.spec.devEnvironments.disableContainerBuildCapabilities}'`;
98
+ originalBuildCapabilitiesSetting = shellExecutor.executeCommand(getOriginalSettingCommand).stdout.trim();
99
+
100
+ // patch the CheCluster to enable container build capabilities
101
+ const patchCommand: string = `oc patch checluster/${cheClusterName} -n ${devSpacesNamespace} --type=merge -p '{"spec":{"devEnvironments":{"disableContainerBuildCapabilities":false}}}'`;
102
+ const patchResult: ShellString = shellExecutor.executeCommand(patchCommand);
103
+
104
+ expect(patchResult.code).to.equal(0, 'Failed to patch CheCluster to enable container build capabilities');
105
+ });
106
+
107
+ suiteSetup('Login into DevSpaces', async function (): Promise<void> {
108
+ await loginTests.loginIntoChe();
109
+ });
110
+
111
+ test('Create and open new Empty Workspace', async function (): Promise<void> {
112
+ await dashboard.waitPage();
113
+ await workspaceHandlingTests.createAndOpenWorkspace('Empty Workspace');
114
+ await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
115
+ workspaceName = WorkspaceHandlingTests.getWorkspaceName();
116
+ expect(workspaceName, 'Workspace name was not detected').not.empty;
117
+ registerRunningWorkspace(workspaceName);
118
+ });
119
+
120
+ test('Wait for workspace readiness', async function (): Promise<void> {
121
+ await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
122
+ });
123
+
124
+ test('Build and push container image from workspace', function (): void {
125
+ kubernetesCommandLineToolsExecutor = e2eContainer.get(CLASSES.KubernetesCommandLineToolsExecutor);
126
+ kubernetesCommandLineToolsExecutor.workspaceName = workspaceName;
127
+ kubernetesCommandLineToolsExecutor.loginToOcp();
128
+ kubernetesCommandLineToolsExecutor.getPodAndContainerNames();
129
+ kubernetesCommandLineToolsExecutor.execInContainerCommand(buildPushScript);
130
+ });
131
+
132
+ test('Verify container image can be used in a pod', function (): void {
133
+ const runTestScriptOutput: ShellString = kubernetesCommandLineToolsExecutor.execInContainerCommand(runTestScript);
134
+ expect(runTestScriptOutput.stdout).to.include('Hello from Kubedock!', 'Expected "Hello from Kubedock!" message not found in logs');
135
+ });
136
+
137
+ suiteTeardown('Open dashboard and close all other tabs', async function (): Promise<void> {
138
+ await dashboard.openDashboard();
139
+ await browserTabsUtil.closeAllTabsExceptCurrent();
140
+ });
141
+
142
+ suiteTeardown('Stop and delete the workspace by API', async function (): Promise<void> {
143
+ await testWorkspaceUtil.stopAndDeleteWorkspaceByName(workspaceName);
144
+ });
145
+
146
+ suiteTeardown('Unregister running workspace', function (): void {
147
+ registerRunningWorkspace('');
148
+ });
149
+
150
+ suiteTeardown('Restore DevSpaces container build capabilities setting', function (): void {
151
+ kubernetesCommandLineToolsExecutor = e2eContainer.get(CLASSES.KubernetesCommandLineToolsExecutor);
152
+ kubernetesCommandLineToolsExecutor.loginToOcp();
153
+
154
+ // default to false if value wasn't found
155
+ const validSetting: string = ['true', 'false'].includes(originalBuildCapabilitiesSetting)
156
+ ? originalBuildCapabilitiesSetting
157
+ : 'false';
158
+
159
+ const restorePatchCommand: string = `oc patch checluster/${cheClusterName} -n ${devSpacesNamespace} --type=merge -p '{"spec":{"devEnvironments":{"disableContainerBuildCapabilities":${validSetting}}}}'`;
160
+ const restorePatchResult: ShellString = shellExecutor.executeCommand(restorePatchCommand);
161
+
162
+ expect(restorePatchResult.code).to.equal(0, 'Failed to restore CheCluster container build capabilities setting');
163
+ });
164
+ });