@eclipse-che/che-e2e 7.122.0-next-d12244e → 7.122.0-next-3c10512
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/configs/inversify.config.ts +2 -0
- package/configs/inversify.types.ts +2 -1
- package/dist/configs/inversify.config.js +2 -0
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js +2 -1
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +6 -0
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/ide/RestartWorkspaceDialog.js +80 -0
- package/dist/pageobjects/ide/RestartWorkspaceDialog.js.map +1 -0
- package/dist/specs/api/AnsibleDevFileAPI.spec.js +31 -24
- package/dist/specs/api/AnsibleDevFileAPI.spec.js.map +1 -1
- package/dist/specs/restart-tests/RestartFromLocalDevfile.spec.js +266 -0
- package/dist/specs/restart-tests/RestartFromLocalDevfile.spec.js.map +1 -0
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/index.ts +1 -0
- package/package.json +1 -1
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +10 -0
- package/pageobjects/ide/RestartWorkspaceDialog.ts +74 -0
- package/specs/api/AnsibleDevFileAPI.spec.ts +36 -24
- package/specs/restart-tests/RestartFromLocalDevfile.spec.ts +351 -0
- package/utils/KubernetesCommandLineToolsExecutor.ts +1 -1
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2026 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
|
+
|
|
11
|
+
import { ContainerTerminal, KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
|
|
12
|
+
import { expect } from 'chai';
|
|
13
|
+
import { ShellString } from 'shelljs';
|
|
14
|
+
import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
|
|
15
|
+
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
|
|
16
|
+
import { e2eContainer } from '../../configs/inversify.config';
|
|
17
|
+
import { CLASSES } from '../../configs/inversify.types';
|
|
18
|
+
import { ShellExecutor } from '../../utils/ShellExecutor';
|
|
19
|
+
import { Logger } from '../../utils/Logger';
|
|
20
|
+
import { LoginTests } from '../../tests-library/LoginTests';
|
|
21
|
+
import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
|
|
22
|
+
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
|
|
23
|
+
import { Workspaces } from '../../pageobjects/dashboard/Workspaces';
|
|
24
|
+
import { WorkspaceDetails } from '../../pageobjects/dashboard/workspace-details/WorkspaceDetails';
|
|
25
|
+
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
26
|
+
import { DriverHelper } from '../../utils/DriverHelper';
|
|
27
|
+
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
|
|
28
|
+
import { RestartWorkspaceDialog } from '../../pageobjects/ide/RestartWorkspaceDialog';
|
|
29
|
+
import { By } from 'selenium-webdriver';
|
|
30
|
+
import { registerRunningWorkspace } from '../MochaHooks';
|
|
31
|
+
|
|
32
|
+
suite(`Test case with empty workspace (per-user storage) ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
|
|
33
|
+
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
34
|
+
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
35
|
+
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
|
|
36
|
+
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
37
|
+
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
|
|
38
|
+
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
|
|
39
|
+
const containerTerminal: ContainerTerminal = e2eContainer.get(CLASSES.ContainerTerminal);
|
|
40
|
+
const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get(
|
|
41
|
+
CLASSES.KubernetesCommandLineToolsExecutor
|
|
42
|
+
);
|
|
43
|
+
const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
|
|
44
|
+
const restartWorkspaceDialog: RestartWorkspaceDialog = e2eContainer.get(CLASSES.RestartWorkspaceDialog);
|
|
45
|
+
const testFileName: string = 'test-new-file.txt';
|
|
46
|
+
const testFileContent: string = 'test file content for restart verification';
|
|
47
|
+
const gitRepository: string = BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED()
|
|
48
|
+
? 'https://gh.crw-qe.com/test-automation-only/devfile-with-typo'
|
|
49
|
+
: 'https://github.com/dmytro-ndp/devfile-with-typo';
|
|
50
|
+
const projectName: string = 'devfile-with-typo';
|
|
51
|
+
let currentTabHandle: string = 'undefined';
|
|
52
|
+
const editorXpath: string = '//*[@id="editor-selector-card-che-incubator/che-code/latest"]';
|
|
53
|
+
const xPathToWaitFor: string = '//*[@id="workbench.parts.sidebar"]';
|
|
54
|
+
const cheClusterName: string = 'devspaces';
|
|
55
|
+
let originalStorageStrategy: string = '';
|
|
56
|
+
|
|
57
|
+
suiteSetup('Login into Che and set per-user storage strategy', async function (): Promise<void> {
|
|
58
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
59
|
+
shellExecutor.executeCommand('oc project openshift-devspaces');
|
|
60
|
+
|
|
61
|
+
originalStorageStrategy = shellExecutor
|
|
62
|
+
.executeCommand(`oc get checluster/${cheClusterName} -o "jsonpath={.spec.devEnvironments.storage.pvcStrategy}"`)
|
|
63
|
+
.stdout.trim();
|
|
64
|
+
|
|
65
|
+
if (originalStorageStrategy !== 'per-user') {
|
|
66
|
+
const patchResult: ShellString = shellExecutor.executeCommand(
|
|
67
|
+
`oc patch checluster ${cheClusterName} --type=merge ` +
|
|
68
|
+
'-p \'{"spec":{"devEnvironments":{"storage":{"pvcStrategy":"per-user"}}}}\''
|
|
69
|
+
);
|
|
70
|
+
expect(patchResult.code).to.equal(0, 'Failed to patch CheCluster to set per-user storage strategy');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
await loginTests.loginIntoChe();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
function clearCurrentTabHandle(): void {
|
|
77
|
+
currentTabHandle = 'undefined';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
test('Create Empty workspace', async function (): Promise<void> {
|
|
81
|
+
await dashboard.openDashboard();
|
|
82
|
+
currentTabHandle = await browserTabsUtil.getCurrentWindowHandle();
|
|
83
|
+
await dashboard.clickCreateWorkspaceButton();
|
|
84
|
+
await workspaceHandlingTests.createAndOpenWorkspaceWithSpecificEditorAndSample(editorXpath, 'Empty Workspace', xPathToWaitFor);
|
|
85
|
+
registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('Setup workspace context for API operations', function (): void {
|
|
89
|
+
kubernetesCommandLineToolsExecutor.workspaceName = WorkspaceHandlingTests.getWorkspaceName();
|
|
90
|
+
kubernetesCommandLineToolsExecutor.getPodAndContainerNames();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('Clone devfile-with-typo repository', function (): void {
|
|
94
|
+
const cloneOutput: ShellString = containerTerminal.gitClone(gitRepository);
|
|
95
|
+
expect(cloneOutput.stdout + cloneOutput.stderr).includes('Cloning');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('Accept the project as a trusted one', async function (): Promise<void> {
|
|
99
|
+
await projectAndFileTests.performTrustAuthorDialog();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('Verify cloned project exists', function (): void {
|
|
103
|
+
expect(containerTerminal.ls().stdout).includes(projectName);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('Create new file in project root', function (): void {
|
|
107
|
+
const output: ShellString = containerTerminal.execInContainerCommand(
|
|
108
|
+
`echo "${testFileContent}" > /projects/${projectName}/${testFileName}`
|
|
109
|
+
);
|
|
110
|
+
expect(output.code).to.equal(0);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test('Restart workspace from local devfile with bad image', async function (): Promise<void> {
|
|
114
|
+
await restartWorkspaceDialog.restartFromLocalDevfile(projectName);
|
|
115
|
+
Logger.info('Waiting for "Restart Workspace" confirmation popup');
|
|
116
|
+
await restartWorkspaceDialog.confirmRestartWorkspace();
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('Wait for workspace start failure and restart', async function (): Promise<void> {
|
|
120
|
+
Logger.info('Waiting for workspace to enter Failed phase and restart with default devfile');
|
|
121
|
+
await restartWorkspaceDialog.clickRestartWithDefaultDevfile();
|
|
122
|
+
await driverHelper.waitVisibility(By.xpath(xPathToWaitFor), TIMEOUT_CONSTANTS.TS_IDE_START_TIMEOUT);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test('Re-initialize workspace context after restart', function (): void {
|
|
126
|
+
kubernetesCommandLineToolsExecutor.getPodAndContainerNames();
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test('Verify project exists with cloned files after restart', function (): void {
|
|
130
|
+
expect(containerTerminal.ls().stdout).includes(projectName);
|
|
131
|
+
expect(containerTerminal.ls(`/projects/${projectName}`).stdout).includes('devfile.yaml');
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('Verify new file is present in project root after restart', function (): void {
|
|
135
|
+
const output: ShellString = containerTerminal.execInContainerCommand(`cat /projects/${projectName}/${testFileName}`);
|
|
136
|
+
expect(output.stdout.trim()).to.equal(testFileContent);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test('Verify devfile schema validation error on invalid env declaration', async function (): Promise<void> {
|
|
140
|
+
Logger.info('Appending invalid env declaration to devfile.yaml');
|
|
141
|
+
const appendOutput: ShellString = containerTerminal.execInContainerCommand(
|
|
142
|
+
`echo " env:" >> /projects/${projectName}/devfile.yaml && ` +
|
|
143
|
+
`echo " - name: test-env" >> /projects/${projectName}/devfile.yaml && ` +
|
|
144
|
+
`echo " value: true" >> /projects/${projectName}/devfile.yaml`
|
|
145
|
+
);
|
|
146
|
+
expect(appendOutput.code).to.equal(0, 'Failed to append invalid env content to devfile.yaml');
|
|
147
|
+
|
|
148
|
+
Logger.info('Restart from local devfile');
|
|
149
|
+
await restartWorkspaceDialog.restartFromLocalDevfile(projectName);
|
|
150
|
+
|
|
151
|
+
Logger.info('Check error popup');
|
|
152
|
+
const dialogText: string = await restartWorkspaceDialog.getErrorDialogText();
|
|
153
|
+
Logger.info(`Error dialog title text: ${dialogText}`);
|
|
154
|
+
|
|
155
|
+
const detailText: string = await restartWorkspaceDialog.getErrorDetailText();
|
|
156
|
+
Logger.info(`Error dialog detail text: ${detailText}`);
|
|
157
|
+
|
|
158
|
+
expect(detailText).to.equal(
|
|
159
|
+
'Devfile schema validation failed. Error: 0: instance.components[0] is not allowed to have the additional property "env"'
|
|
160
|
+
);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
suiteTeardown('Delete DevWorkspace', async function (): Promise<void> {
|
|
164
|
+
Logger.debug('Delete DevWorkspace. After each test.');
|
|
165
|
+
if (currentTabHandle !== 'undefined') {
|
|
166
|
+
await browserTabsUtil.switchToWindow(currentTabHandle);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
await dashboard.openDashboard();
|
|
170
|
+
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
171
|
+
|
|
172
|
+
if (WorkspaceHandlingTests.getWorkspaceName() !== 'undefined') {
|
|
173
|
+
Logger.debug('Workspace name is defined. Deleting workspace...');
|
|
174
|
+
await dashboard.deleteStoppedWorkspaceByUI(WorkspaceHandlingTests.getWorkspaceName());
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
WorkspaceHandlingTests.clearWorkspaceName();
|
|
178
|
+
clearCurrentTabHandle();
|
|
179
|
+
registerRunningWorkspace('');
|
|
180
|
+
|
|
181
|
+
if (originalStorageStrategy !== '' && originalStorageStrategy !== 'per-user') {
|
|
182
|
+
const restoreResult: ShellString = shellExecutor.executeCommand(
|
|
183
|
+
`oc patch checluster ${cheClusterName} --type=merge ` +
|
|
184
|
+
`-p '{"spec":{"devEnvironments":{"storage":{"pvcStrategy":"${originalStorageStrategy}"}}}}'`
|
|
185
|
+
);
|
|
186
|
+
expect(restoreResult.code).to.equal(0, 'Failed to restore CheCluster storage strategy');
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
suite(`Test case with pvc-fail workspace (bad image restart) ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
|
|
192
|
+
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
193
|
+
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
194
|
+
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
|
|
195
|
+
const workspaces: Workspaces = e2eContainer.get(CLASSES.Workspaces);
|
|
196
|
+
const workspaceDetails: WorkspaceDetails = e2eContainer.get(CLASSES.WorkspaceDetails);
|
|
197
|
+
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
198
|
+
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
|
|
199
|
+
const containerTerminal: ContainerTerminal = e2eContainer.get(CLASSES.ContainerTerminal);
|
|
200
|
+
const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get(
|
|
201
|
+
CLASSES.KubernetesCommandLineToolsExecutor
|
|
202
|
+
);
|
|
203
|
+
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
|
|
204
|
+
const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
|
|
205
|
+
const restartWorkspaceDialog: RestartWorkspaceDialog = e2eContainer.get(CLASSES.RestartWorkspaceDialog);
|
|
206
|
+
const testFileName: string = 'test-new-file.txt';
|
|
207
|
+
const testFileContent: string = 'test file content for pvc-fail restart verification';
|
|
208
|
+
const gitRepository: string = 'https://github.com/cgruver/test-workspace/tree/pvc-fail';
|
|
209
|
+
const projectName: string = 'test-workspace';
|
|
210
|
+
let currentTabHandle: string = 'undefined';
|
|
211
|
+
const xPathToWaitFor: string = '//*[@id="workbench.parts.sidebar"]';
|
|
212
|
+
const editorXpath: string = '//*[@id="editor-selector-card-che-incubator/che-code/latest"]';
|
|
213
|
+
const cheClusterName: string = 'devspaces';
|
|
214
|
+
let originalStorageStrategy: string = '';
|
|
215
|
+
|
|
216
|
+
suiteSetup('Skip suite on disconnected clusters', function (): void {
|
|
217
|
+
if (BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED()) {
|
|
218
|
+
Logger.info('Test cluster is disconnected. Skipping pvc-fail workspace suite.');
|
|
219
|
+
this.skip();
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
suiteSetup('Login into Che and set per-workspace storage strategy', async function (): Promise<void> {
|
|
224
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
225
|
+
shellExecutor.executeCommand('oc project openshift-devspaces');
|
|
226
|
+
|
|
227
|
+
originalStorageStrategy = shellExecutor
|
|
228
|
+
.executeCommand(`oc get checluster/${cheClusterName} -o "jsonpath={.spec.devEnvironments.storage.pvcStrategy}"`)
|
|
229
|
+
.stdout.trim();
|
|
230
|
+
|
|
231
|
+
if (originalStorageStrategy !== 'per-workspace') {
|
|
232
|
+
const patchResult: ShellString = shellExecutor.executeCommand(
|
|
233
|
+
`oc patch checluster ${cheClusterName} --type=merge ` +
|
|
234
|
+
'-p \'{"spec":{"devEnvironments":{"storage":{"pvcStrategy":"per-workspace"}}}}\''
|
|
235
|
+
);
|
|
236
|
+
expect(patchResult.code).to.equal(0, 'Failed to patch CheCluster to set per-workspace storage strategy');
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
await loginTests.loginIntoChe();
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
function clearCurrentTabHandle(): void {
|
|
243
|
+
currentTabHandle = 'undefined';
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
test('Create workspace from test-workspace pvc-fail branch', async function (): Promise<void> {
|
|
247
|
+
await dashboard.openDashboard();
|
|
248
|
+
currentTabHandle = await browserTabsUtil.getCurrentWindowHandle();
|
|
249
|
+
await dashboard.clickCreateWorkspaceButton();
|
|
250
|
+
await workspaceHandlingTests.createAndOpenWorkspaceWithSpecificEditorAndGitUrl(editorXpath, gitRepository, xPathToWaitFor);
|
|
251
|
+
registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
test('Accept the project as a trusted one', async function (): Promise<void> {
|
|
255
|
+
await projectAndFileTests.performTrustAuthorDialog();
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
test('Setup workspace context for API operations', function (): void {
|
|
259
|
+
kubernetesCommandLineToolsExecutor.workspaceName = WorkspaceHandlingTests.getWorkspaceName();
|
|
260
|
+
kubernetesCommandLineToolsExecutor.getPodAndContainerNames();
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
test('Create new file in project folder', function (): void {
|
|
264
|
+
const output: ShellString = containerTerminal.execInContainerCommand(
|
|
265
|
+
`echo "${testFileContent}" > /projects/${projectName}/${testFileName}`
|
|
266
|
+
);
|
|
267
|
+
expect(output.code).to.equal(0);
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
test('Modify devfile to point to bad image location', function (): void {
|
|
271
|
+
Logger.info('Replacing ":latest" with ":badimage" in devfile.yaml using sed');
|
|
272
|
+
const output: ShellString = containerTerminal.execInContainerCommand(
|
|
273
|
+
`sed -i 's/:latest/:badimage/g' /projects/${projectName}/devfile.yaml`
|
|
274
|
+
);
|
|
275
|
+
expect(output.code).to.equal(0, 'Failed to replace :latest with :badimage in devfile.yaml');
|
|
276
|
+
|
|
277
|
+
const verifyOutput: ShellString = containerTerminal.execInContainerCommand(`cat /projects/${projectName}/devfile.yaml`);
|
|
278
|
+
expect(verifyOutput.stdout).to.include(':badimage');
|
|
279
|
+
expect(verifyOutput.stdout).to.not.include(':latest');
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
test('Restart workspace from local devfile with bad image', async function (): Promise<void> {
|
|
283
|
+
await restartWorkspaceDialog.restartFromLocalDevfile(projectName);
|
|
284
|
+
Logger.info('Waiting for "Restart Workspace" confirmation popup');
|
|
285
|
+
await restartWorkspaceDialog.confirmRestartWorkspace();
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
test('Wait for workspace start failure and restart with default devfile', async function (): Promise<void> {
|
|
289
|
+
Logger.info('Waiting for workspace to enter Failed phase and restart with default devfile');
|
|
290
|
+
await restartWorkspaceDialog.clickRestartWithDefaultDevfile();
|
|
291
|
+
await driverHelper.waitVisibility(By.xpath(xPathToWaitFor), TIMEOUT_CONSTANTS.TS_IDE_START_TIMEOUT);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
test('Re-initialize workspace context after restart', function (): void {
|
|
295
|
+
kubernetesCommandLineToolsExecutor.getPodAndContainerNames();
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
test('Verify project exists after restart with default devfile', function (): void {
|
|
299
|
+
expect(containerTerminal.ls().stdout).includes(projectName);
|
|
300
|
+
expect(containerTerminal.ls(`/projects/${projectName}`).stdout).includes('devfile.yaml');
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
test('Verify new file is present after restart with default devfile', function (): void {
|
|
304
|
+
const output: ShellString = containerTerminal.execInContainerCommand(`cat /projects/${projectName}/${testFileName}`);
|
|
305
|
+
expect(output.stdout.trim()).to.equal(testFileContent);
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
test('Verify storage type is per-workspace in workspace details', async function (): Promise<void> {
|
|
309
|
+
const workspaceName: string = WorkspaceHandlingTests.getWorkspaceName();
|
|
310
|
+
|
|
311
|
+
Logger.info('Opening Workspaces page');
|
|
312
|
+
await dashboard.openDashboard();
|
|
313
|
+
await dashboard.clickWorkspacesButton();
|
|
314
|
+
await workspaces.waitPage();
|
|
315
|
+
|
|
316
|
+
Logger.info(`Opening workspace details for: ${workspaceName}`);
|
|
317
|
+
await workspaces.clickWorkspaceListItemLink(workspaceName);
|
|
318
|
+
await workspaceDetails.waitWorkspaceTitle(workspaceName);
|
|
319
|
+
|
|
320
|
+
Logger.info('Verifying storage type is per-workspace on Overview tab');
|
|
321
|
+
const storageTypeValue: string = await workspaceDetails.getStorageTypeValue();
|
|
322
|
+
expect(storageTypeValue).to.equal('per-workspace');
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
suiteTeardown('Delete DevWorkspace', async function (): Promise<void> {
|
|
326
|
+
Logger.debug('Delete DevWorkspace. After each test.');
|
|
327
|
+
if (currentTabHandle !== 'undefined') {
|
|
328
|
+
await browserTabsUtil.switchToWindow(currentTabHandle);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
await dashboard.openDashboard();
|
|
332
|
+
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
333
|
+
|
|
334
|
+
if (WorkspaceHandlingTests.getWorkspaceName() !== 'undefined') {
|
|
335
|
+
Logger.debug('Workspace name is defined. Deleting workspace...');
|
|
336
|
+
await dashboard.deleteStoppedWorkspaceByUI(WorkspaceHandlingTests.getWorkspaceName());
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
WorkspaceHandlingTests.clearWorkspaceName();
|
|
340
|
+
clearCurrentTabHandle();
|
|
341
|
+
registerRunningWorkspace('');
|
|
342
|
+
|
|
343
|
+
if (originalStorageStrategy !== '' && originalStorageStrategy !== 'per-workspace') {
|
|
344
|
+
const restoreResult: ShellString = shellExecutor.executeCommand(
|
|
345
|
+
`oc patch checluster ${cheClusterName} --type=merge ` +
|
|
346
|
+
`-p '{"spec":{"devEnvironments":{"storage":{"pvcStrategy":"${originalStorageStrategy}"}}}}'`
|
|
347
|
+
);
|
|
348
|
+
expect(restoreResult.code).to.equal(0, 'Failed to restore CheCluster storage strategy');
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
});
|
|
@@ -176,7 +176,7 @@ export class KubernetesCommandLineToolsExecutor implements IKubernetesCommandLin
|
|
|
176
176
|
Logger.debug(`${this.kubernetesCommandLineTool}`);
|
|
177
177
|
|
|
178
178
|
return this.shellExecutor.executeCommand(
|
|
179
|
-
`${this.kubernetesCommandLineTool} exec -i
|
|
179
|
+
`${this.kubernetesCommandLineTool} exec -i ${KubernetesCommandLineToolsExecutor.pod} -n ${this.namespace} -c ${container} -- sh -c '${commandToExecute}'`
|
|
180
180
|
);
|
|
181
181
|
}
|
|
182
182
|
|