@eclipse-che/che-e2e 7.116.0 → 7.117.0-next-5531154
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/.claude/skills/e2e-test-developer/SKILL.md +3 -0
- package/CODE_STYLE.md +5 -0
- package/dist/pageobjects/dashboard/TrustAuthorPopup.js +6 -0
- package/dist/pageobjects/dashboard/TrustAuthorPopup.js.map +1 -1
- package/dist/specs/miscellaneous/KubedockPodmanPersistUserHomeTest.spec.js +120 -0
- package/dist/specs/miscellaneous/KubedockPodmanPersistUserHomeTest.spec.js.map +1 -0
- package/package.json +2 -3
- package/pageobjects/dashboard/TrustAuthorPopup.ts +8 -0
- package/specs/miscellaneous/KubedockPodmanPersistUserHomeTest.spec.ts +154 -0
|
@@ -152,6 +152,7 @@ Classes must follow this order:
|
|
|
152
152
|
### Test File Conventions
|
|
153
153
|
|
|
154
154
|
1. **Naming**
|
|
155
|
+
|
|
155
156
|
- UI tests: `*.spec.ts` (e.g., `Factory.spec.ts`)
|
|
156
157
|
- API-only tests: `*API.spec.ts` (e.g., `EmptyWorkspaceAPI.spec.ts`)
|
|
157
158
|
|
|
@@ -216,10 +217,12 @@ async function doSomething(param, timeout) {
|
|
|
216
217
|
```
|
|
217
218
|
|
|
218
219
|
2. **Naming Conventions**
|
|
220
|
+
|
|
219
221
|
- Variables: camelCase or UPPER_CASE
|
|
220
222
|
- No leading/trailing underscores
|
|
221
223
|
|
|
222
224
|
3. **String Quotes**
|
|
225
|
+
|
|
223
226
|
- Use single quotes for strings
|
|
224
227
|
|
|
225
228
|
4. **Comments**
|
package/CODE_STYLE.md
CHANGED
|
@@ -28,6 +28,7 @@ Automated lint checking and code format performs with ESLint and Prettier tools
|
|
|
28
28
|
### Preferable code style
|
|
29
29
|
|
|
30
30
|
1. Page-object and util classes
|
|
31
|
+
|
|
31
32
|
1. ✔ Class declaration using dependency injection (inversify library)
|
|
32
33
|
|
|
33
34
|
```
|
|
@@ -37,6 +38,7 @@ Automated lint checking and code format performs with ESLint and Prettier tools
|
|
|
37
38
|
```
|
|
38
39
|
|
|
39
40
|
2. Public methods
|
|
41
|
+
|
|
40
42
|
- ✔ Declare public methods without "public "keyword
|
|
41
43
|
- ✔ Add Logger.debug() inside method to log its name (with optional message)
|
|
42
44
|
|
|
@@ -49,6 +51,7 @@ Automated lint checking and code format performs with ESLint and Prettier tools
|
|
|
49
51
|
```
|
|
50
52
|
|
|
51
53
|
3. Locators
|
|
54
|
+
|
|
52
55
|
- ✔ For static locators - private static readonly fields type of By
|
|
53
56
|
|
|
54
57
|
```
|
|
@@ -102,6 +105,7 @@ Automated lint checking and code format performs with ESLint and Prettier tools
|
|
|
102
105
|
```
|
|
103
106
|
|
|
104
107
|
2. Mocha framework
|
|
108
|
+
|
|
105
109
|
- ✔ TDD framework (`suite()`, `test()`)
|
|
106
110
|
- ✔ Inject class instances, declare all test data inside test `suit()` function to avoid unnecessary code execution if test suit will not be run
|
|
107
111
|
|
|
@@ -118,6 +122,7 @@ Automated lint checking and code format performs with ESLint and Prettier tools
|
|
|
118
122
|
- ✔ Use test [./constants](constants) to make test flexible
|
|
119
123
|
|
|
120
124
|
3. Packages
|
|
125
|
+
|
|
121
126
|
1. Add packages as dev dependencies
|
|
122
127
|
2. If any changes re-create package-lock.json before push
|
|
123
128
|
|
|
@@ -37,12 +37,18 @@ let TrustAuthorPopup = TrustAuthorPopup_1 = class TrustAuthorPopup {
|
|
|
37
37
|
async clickContinue(timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
38
38
|
Logger_1.Logger.debug();
|
|
39
39
|
await this.waitPopupIsOpened();
|
|
40
|
+
await this.driverHelper.wait(TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM);
|
|
40
41
|
await this.driverHelper.waitAndClick(TrustAuthorPopup_1.CONTINUE_BUTTON, timeout);
|
|
42
|
+
await this.waitPopupIsClosed();
|
|
41
43
|
}
|
|
42
44
|
async waitPopupIsOpened(timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
43
45
|
Logger_1.Logger.debug();
|
|
44
46
|
await this.driverHelper.waitVisibility(TrustAuthorPopup_1.TRUST_AUTHOR_POPUP_PAGE, timeout);
|
|
45
47
|
}
|
|
48
|
+
async waitPopupIsClosed(timeout = TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
|
|
49
|
+
Logger_1.Logger.debug();
|
|
50
|
+
await this.driverHelper.waitDisappearance(TrustAuthorPopup_1.TRUST_AUTHOR_POPUP_PAGE, timeout);
|
|
51
|
+
}
|
|
46
52
|
};
|
|
47
53
|
TrustAuthorPopup.CONTINUE_BUTTON = selenium_webdriver_1.By.xpath('//span[text()="Continue"]');
|
|
48
54
|
TrustAuthorPopup.TRUST_AUTHOR_POPUP_PAGE = selenium_webdriver_1.By.xpath('//span[contains(text(), "Do you trust the authors of this repository?")]');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrustAuthorPopup.js","sourceRoot":"","sources":["../../../pageobjects/dashboard/TrustAuthorPopup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;wEAQwE;AACxE,yCAA+C;AAC/C,4BAA0B;AAC1B,mEAAwD;AACxD,2DAAwC;AACxC,2DAAwD;AACxD,+CAA4C;AAC5C,yEAAsE;AAG/D,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAM5B,YAEU,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IACjC,CAAC;IAEJ,KAAK,CAAC,aAAa,CAAC,UAAkB,qCAAiB,CAAC,iCAAiC;QACxF,eAAM,CAAC,KAAK,EAAE,CAAC;QAEf,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAA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AC;IAC9F,CAAC;;AA7BuB,gCAAe,GAAO,uBAAE,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAC5D,wCAAuB,GAAO,uBAAE,CAAC,KAAK,CAC7D,0EAA0E,CAC1E,CAAC;AAJU,gBAAgB;IAD5B,IAAA,sBAAU,GAAE;IAQV,WAAA,IAAA,kBAAM,EAAC,yBAAO,CAAC,YAAY,CAAC,CAAA;qCACN,2BAAY;GARxB,gBAAgB,CA+B5B;AA/BY,4CAAgB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** *******************************************************************
|
|
3
|
+
* copyright (c) 2020-2026 Red Hat, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made
|
|
6
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
7
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
8
|
+
*
|
|
9
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
10
|
+
**********************************************************************/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const inversify_types_1 = require("../../configs/inversify.types");
|
|
13
|
+
const inversify_config_1 = require("../../configs/inversify.config");
|
|
14
|
+
const WorkspaceHandlingTests_1 = require("../../tests-library/WorkspaceHandlingTests");
|
|
15
|
+
const MochaHooks_1 = require("../MochaHooks");
|
|
16
|
+
const chai_1 = require("chai");
|
|
17
|
+
const BASE_TEST_CONSTANTS_1 = require("../../constants/BASE_TEST_CONSTANTS");
|
|
18
|
+
const FACTORY_TEST_CONSTANTS_1 = require("../../constants/FACTORY_TEST_CONSTANTS");
|
|
19
|
+
suite(`Test image build with persistUserHome enabled (kubedock and podman) ${BASE_TEST_CONSTANTS_1.BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function () {
|
|
20
|
+
const projectAndFileTests = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.ProjectAndFileTests);
|
|
21
|
+
const workspaceHandlingTests = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.WorkspaceHandlingTests);
|
|
22
|
+
const loginTests = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.LoginTests);
|
|
23
|
+
const browserTabsUtil = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.BrowserTabsUtil);
|
|
24
|
+
const testWorkspaceUtil = inversify_config_1.e2eContainer.get(inversify_types_1.TYPES.WorkspaceUtil);
|
|
25
|
+
const dashboard = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.Dashboard);
|
|
26
|
+
const shellExecutor = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.ShellExecutor);
|
|
27
|
+
const kubernetesCommandLineToolsExecutor = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.KubernetesCommandLineToolsExecutor);
|
|
28
|
+
let workspaceName = '';
|
|
29
|
+
let defaultPersistentHomeValue = false;
|
|
30
|
+
const cheClusterName = 'devspaces';
|
|
31
|
+
const testScript = '# Enable Kubedock\n' +
|
|
32
|
+
'export KUBEDOCK_ENABLED=true\n' +
|
|
33
|
+
'echo KUBEDOCK_ENABLED\n' +
|
|
34
|
+
'/entrypoint.sh\n' +
|
|
35
|
+
'cd $PROJECT_SOURCE\n' +
|
|
36
|
+
'export ARCH=$(uname -m)\n' +
|
|
37
|
+
'export DATE=$(date +"%m%d%y")\n' +
|
|
38
|
+
'export USER=$(oc whoami)\n' +
|
|
39
|
+
'export TKN=$(oc whoami -t)\n' +
|
|
40
|
+
'export REG="image-registry.openshift-image-registry.svc:5000"\n' +
|
|
41
|
+
'export PROJECT=$(oc project -q)\n' +
|
|
42
|
+
'export IMG="${REG}/${PROJECT}/hello:${DATE}"\n' +
|
|
43
|
+
'podman login --tls-verify=false --username ${USER} --password ${TKN} ${REG}\n' +
|
|
44
|
+
'podman build -t ${IMG} -f Dockerfile.${ARCH}\n' +
|
|
45
|
+
'podman push --tls-verify=false ${IMG}\n';
|
|
46
|
+
const runTestScript = '# Enable Kubedock\n' +
|
|
47
|
+
'export KUBEDOCK_ENABLED=true\n' +
|
|
48
|
+
'echo KUBEDOCK_ENABLED\n' +
|
|
49
|
+
'/entrypoint.sh\n' +
|
|
50
|
+
'export DATE=$(date +"%m%d%y")\n' +
|
|
51
|
+
'export USER=$(oc whoami)\n' +
|
|
52
|
+
'export TKN=$(oc whoami -t)\n' +
|
|
53
|
+
'export REG="image-registry.openshift-image-registry.svc:5000"\n' +
|
|
54
|
+
'export PROJECT=$(oc project -q)\n' +
|
|
55
|
+
'export IMG="${REG}/${PROJECT}/hello:${DATE}"\n' +
|
|
56
|
+
'podman login --tls-verify=false --username ${USER} --password ${TKN} ${REG}\n' +
|
|
57
|
+
'podman run --rm ${IMG}';
|
|
58
|
+
const factoryUrl = BASE_TEST_CONSTANTS_1.BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED()
|
|
59
|
+
? FACTORY_TEST_CONSTANTS_1.FACTORY_TEST_CONSTANTS.TS_SELENIUM_AIRGAP_FACTORY_GIT_REPO_URL ||
|
|
60
|
+
'https://gh.crw-qe.com/test-automation-only/dockerfile-hello-world'
|
|
61
|
+
: FACTORY_TEST_CONSTANTS_1.FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL || 'https://github.com/crw-qe/dockerfile-hello-world';
|
|
62
|
+
suiteSetup(function () {
|
|
63
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
64
|
+
shellExecutor.executeCommand('oc project openshift-devspaces');
|
|
65
|
+
// get current value of spec.devEnvironments.persistUserHome.enabled
|
|
66
|
+
const currentValue = shellExecutor
|
|
67
|
+
.executeCommand(`oc get checluster/${cheClusterName} -o "jsonpath={.spec.devEnvironments.persistUserHome.enabled}"`)
|
|
68
|
+
.stdout.trim();
|
|
69
|
+
defaultPersistentHomeValue = currentValue === 'true';
|
|
70
|
+
// set spec.devEnvironments.persistUserHome.enabled to true
|
|
71
|
+
const patchResult = shellExecutor.executeCommand(`oc patch checluster ${cheClusterName} --type=merge ` +
|
|
72
|
+
'-p \'{"spec":{"devEnvironments":{"persistUserHome":{"enabled": true}}}}\'');
|
|
73
|
+
(0, chai_1.expect)(patchResult.code).to.equal(0, 'Failed to patch CheCluster to enable persistUserHome');
|
|
74
|
+
});
|
|
75
|
+
suiteSetup('Login', async function () {
|
|
76
|
+
await loginTests.loginIntoChe();
|
|
77
|
+
});
|
|
78
|
+
test(`Create and open new workspace from factory:${factoryUrl}`, async function () {
|
|
79
|
+
await workspaceHandlingTests.createAndOpenWorkspaceFromGitRepository(factoryUrl);
|
|
80
|
+
});
|
|
81
|
+
test('Obtain workspace name from workspace loader page', async function () {
|
|
82
|
+
await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
|
|
83
|
+
workspaceName = WorkspaceHandlingTests_1.WorkspaceHandlingTests.getWorkspaceName();
|
|
84
|
+
(0, chai_1.expect)(workspaceName, 'Workspace name was not fetched from the loading page').not.undefined;
|
|
85
|
+
});
|
|
86
|
+
test('Register running workspace', function () {
|
|
87
|
+
(0, MochaHooks_1.registerRunningWorkspace)(workspaceName);
|
|
88
|
+
});
|
|
89
|
+
test('Wait workspace readiness', async function () {
|
|
90
|
+
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
|
|
91
|
+
});
|
|
92
|
+
test('Check the project files were imported', async function () {
|
|
93
|
+
const projectSection = await projectAndFileTests.getProjectViewSession();
|
|
94
|
+
(0, chai_1.expect)(await projectAndFileTests.getProjectTreeItem(projectSection, 'Dockerfile.ppc64le'), 'Files not imported').not.undefined;
|
|
95
|
+
});
|
|
96
|
+
test('Create and check container runs using kubedock and podman with persistUserHome', function () {
|
|
97
|
+
kubernetesCommandLineToolsExecutor.workspaceName = workspaceName;
|
|
98
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
99
|
+
kubernetesCommandLineToolsExecutor.getPodAndContainerNames();
|
|
100
|
+
const output = kubernetesCommandLineToolsExecutor.execInContainerCommand(testScript);
|
|
101
|
+
(0, chai_1.expect)(output, 'Podman test script failed').contains('Successfully tagged');
|
|
102
|
+
const runOutput = kubernetesCommandLineToolsExecutor.execInContainerCommand(runTestScript);
|
|
103
|
+
(0, chai_1.expect)(runOutput, 'Podman test script failed').contains('Hello from Kubedock!');
|
|
104
|
+
});
|
|
105
|
+
suiteTeardown(function () {
|
|
106
|
+
// restore spec.devEnvironments.persistUserHome.enabled to original value
|
|
107
|
+
const restoreResult = shellExecutor.executeCommand(`oc patch checluster ${cheClusterName} --type=merge ` +
|
|
108
|
+
`-p '{"spec":{"devEnvironments":{"persistUserHome":{"enabled": ${defaultPersistentHomeValue}}}}}'`);
|
|
109
|
+
(0, chai_1.expect)(restoreResult.code).to.equal(0, 'Failed to restore CheCluster persistUserHome setting');
|
|
110
|
+
});
|
|
111
|
+
suiteTeardown('Stop and delete the workspace by API', async function () {
|
|
112
|
+
await dashboard.openDashboard();
|
|
113
|
+
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
114
|
+
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests_1.WorkspaceHandlingTests.getWorkspaceName());
|
|
115
|
+
});
|
|
116
|
+
suiteTeardown('Unregister running workspace', function () {
|
|
117
|
+
(0, MochaHooks_1.registerRunningWorkspace)('');
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
//# sourceMappingURL=KubedockPodmanPersistUserHomeTest.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KubedockPodmanPersistUserHomeTest.spec.js","sourceRoot":"","sources":["../../../specs/miscellaneous/KubedockPodmanPersistUserHomeTest.spec.ts"],"names":[],"mappings":";AAAA;;;;;;;;wEAQwE;;AAIxE,mEAA+D;AAC/D,qEAA8D;AAC9D,uFAAoF;AACpF,8CAAyD;AAGzD,+BAA8B;AAG9B,6EAA0E;AAG1E,mFAAgF;AAGhF,KAAK,CAAC,uEAAuE,yCAAmB,CAAC,gBAAgB,EAAE,EAAE;IACpH,MAAM,mBAAmB,GAAwB,+BAA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MAAM,SAAS,CAAC,aAAa,EAAE,CAAC;QAChC,MAAM,eAAe,CAAC,yBAAyB,EAAE,CAAC;QAClD,MAAM,iBAAiB,CAAC,4BAA4B,CAAC,+CAAsB,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACjG,CAAC,CAAC,CAAC;IAEH,aAAa,CAAC,8BAA8B,EAAE;QAC7C,IAAA,qCAAwB,EAAC,EAAE,CAAC,CAAC;IAC9B,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.
|
|
3
|
+
"version": "7.117.0-next-5531154",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -66,8 +66,7 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@eclipse-che/api": "latest",
|
|
68
68
|
"inversify": "6.0.1",
|
|
69
|
-
"reflect-metadata": "0.1.13"
|
|
70
|
-
"@eclipse-che/che-devworkspace-generator": "7.116.0"
|
|
69
|
+
"reflect-metadata": "0.1.13"
|
|
71
70
|
},
|
|
72
71
|
"resolutions": {
|
|
73
72
|
"minimist": "^1.2.5"
|
|
@@ -31,7 +31,9 @@ export class TrustAuthorPopup {
|
|
|
31
31
|
Logger.debug();
|
|
32
32
|
|
|
33
33
|
await this.waitPopupIsOpened();
|
|
34
|
+
await this.driverHelper.wait(TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM);
|
|
34
35
|
await this.driverHelper.waitAndClick(TrustAuthorPopup.CONTINUE_BUTTON, timeout);
|
|
36
|
+
await this.waitPopupIsClosed();
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
async waitPopupIsOpened(timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
@@ -39,4 +41,10 @@ export class TrustAuthorPopup {
|
|
|
39
41
|
|
|
40
42
|
await this.driverHelper.waitVisibility(TrustAuthorPopup.TRUST_AUTHOR_POPUP_PAGE, timeout);
|
|
41
43
|
}
|
|
44
|
+
|
|
45
|
+
async waitPopupIsClosed(timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
|
|
46
|
+
Logger.debug();
|
|
47
|
+
|
|
48
|
+
await this.driverHelper.waitDisappearance(TrustAuthorPopup.TRUST_AUTHOR_POPUP_PAGE, timeout);
|
|
49
|
+
}
|
|
42
50
|
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2020-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 { ViewSection } from 'monaco-page-objects';
|
|
12
|
+
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
|
|
13
|
+
import { CLASSES, TYPES } from '../../configs/inversify.types';
|
|
14
|
+
import { e2eContainer } from '../../configs/inversify.config';
|
|
15
|
+
import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
|
|
16
|
+
import { registerRunningWorkspace } from '../MochaHooks';
|
|
17
|
+
import { LoginTests } from '../../tests-library/LoginTests';
|
|
18
|
+
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
19
|
+
import { expect } from 'chai';
|
|
20
|
+
import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
|
|
21
|
+
import { ShellString } from 'shelljs';
|
|
22
|
+
import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
|
|
23
|
+
import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil';
|
|
24
|
+
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
|
|
25
|
+
import { FACTORY_TEST_CONSTANTS } from '../../constants/FACTORY_TEST_CONSTANTS';
|
|
26
|
+
import { ShellExecutor } from '../../utils/ShellExecutor';
|
|
27
|
+
|
|
28
|
+
suite(`Test image build with persistUserHome enabled (kubedock and podman) ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
|
|
29
|
+
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
|
|
30
|
+
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
31
|
+
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
32
|
+
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
33
|
+
const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
|
|
34
|
+
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
|
|
35
|
+
const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
|
|
36
|
+
const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get(
|
|
37
|
+
CLASSES.KubernetesCommandLineToolsExecutor
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
let workspaceName: string = '';
|
|
41
|
+
let defaultPersistentHomeValue: boolean = false;
|
|
42
|
+
const cheClusterName: string = 'devspaces';
|
|
43
|
+
|
|
44
|
+
const testScript: string =
|
|
45
|
+
'# Enable Kubedock\n' +
|
|
46
|
+
'export KUBEDOCK_ENABLED=true\n' +
|
|
47
|
+
'echo KUBEDOCK_ENABLED\n' +
|
|
48
|
+
'/entrypoint.sh\n' +
|
|
49
|
+
'cd $PROJECT_SOURCE\n' +
|
|
50
|
+
'export ARCH=$(uname -m)\n' +
|
|
51
|
+
'export DATE=$(date +"%m%d%y")\n' +
|
|
52
|
+
'export USER=$(oc whoami)\n' +
|
|
53
|
+
'export TKN=$(oc whoami -t)\n' +
|
|
54
|
+
'export REG="image-registry.openshift-image-registry.svc:5000"\n' +
|
|
55
|
+
'export PROJECT=$(oc project -q)\n' +
|
|
56
|
+
'export IMG="${REG}/${PROJECT}/hello:${DATE}"\n' +
|
|
57
|
+
'podman login --tls-verify=false --username ${USER} --password ${TKN} ${REG}\n' +
|
|
58
|
+
'podman build -t ${IMG} -f Dockerfile.${ARCH}\n' +
|
|
59
|
+
'podman push --tls-verify=false ${IMG}\n';
|
|
60
|
+
|
|
61
|
+
const runTestScript: string =
|
|
62
|
+
'# Enable Kubedock\n' +
|
|
63
|
+
'export KUBEDOCK_ENABLED=true\n' +
|
|
64
|
+
'echo KUBEDOCK_ENABLED\n' +
|
|
65
|
+
'/entrypoint.sh\n' +
|
|
66
|
+
'export DATE=$(date +"%m%d%y")\n' +
|
|
67
|
+
'export USER=$(oc whoami)\n' +
|
|
68
|
+
'export TKN=$(oc whoami -t)\n' +
|
|
69
|
+
'export REG="image-registry.openshift-image-registry.svc:5000"\n' +
|
|
70
|
+
'export PROJECT=$(oc project -q)\n' +
|
|
71
|
+
'export IMG="${REG}/${PROJECT}/hello:${DATE}"\n' +
|
|
72
|
+
'podman login --tls-verify=false --username ${USER} --password ${TKN} ${REG}\n' +
|
|
73
|
+
'podman run --rm ${IMG}';
|
|
74
|
+
|
|
75
|
+
const factoryUrl: string = BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED()
|
|
76
|
+
? FACTORY_TEST_CONSTANTS.TS_SELENIUM_AIRGAP_FACTORY_GIT_REPO_URL ||
|
|
77
|
+
'https://gh.crw-qe.com/test-automation-only/dockerfile-hello-world'
|
|
78
|
+
: FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL || 'https://github.com/crw-qe/dockerfile-hello-world';
|
|
79
|
+
|
|
80
|
+
suiteSetup(function (): void {
|
|
81
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
82
|
+
shellExecutor.executeCommand('oc project openshift-devspaces');
|
|
83
|
+
|
|
84
|
+
// get current value of spec.devEnvironments.persistUserHome.enabled
|
|
85
|
+
const currentValue: string = shellExecutor
|
|
86
|
+
.executeCommand(`oc get checluster/${cheClusterName} -o "jsonpath={.spec.devEnvironments.persistUserHome.enabled}"`)
|
|
87
|
+
.stdout.trim();
|
|
88
|
+
defaultPersistentHomeValue = currentValue === 'true';
|
|
89
|
+
|
|
90
|
+
// set spec.devEnvironments.persistUserHome.enabled to true
|
|
91
|
+
const patchResult: ShellString = shellExecutor.executeCommand(
|
|
92
|
+
`oc patch checluster ${cheClusterName} --type=merge ` +
|
|
93
|
+
'-p \'{"spec":{"devEnvironments":{"persistUserHome":{"enabled": true}}}}\''
|
|
94
|
+
);
|
|
95
|
+
expect(patchResult.code).to.equal(0, 'Failed to patch CheCluster to enable persistUserHome');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
suiteSetup('Login', async function (): Promise<void> {
|
|
99
|
+
await loginTests.loginIntoChe();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test(`Create and open new workspace from factory:${factoryUrl}`, async function (): Promise<void> {
|
|
103
|
+
await workspaceHandlingTests.createAndOpenWorkspaceFromGitRepository(factoryUrl);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
|
|
107
|
+
await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
|
|
108
|
+
workspaceName = WorkspaceHandlingTests.getWorkspaceName();
|
|
109
|
+
expect(workspaceName, 'Workspace name was not fetched from the loading page').not.undefined;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('Register running workspace', function (): void {
|
|
113
|
+
registerRunningWorkspace(workspaceName);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('Wait workspace readiness', async function (): Promise<void> {
|
|
117
|
+
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test('Check the project files were imported', async function (): Promise<void> {
|
|
121
|
+
const projectSection: ViewSection = await projectAndFileTests.getProjectViewSession();
|
|
122
|
+
expect(await projectAndFileTests.getProjectTreeItem(projectSection, 'Dockerfile.ppc64le'), 'Files not imported').not.undefined;
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test('Create and check container runs using kubedock and podman with persistUserHome', function (): void {
|
|
126
|
+
kubernetesCommandLineToolsExecutor.workspaceName = workspaceName;
|
|
127
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
128
|
+
kubernetesCommandLineToolsExecutor.getPodAndContainerNames();
|
|
129
|
+
const output: ShellString = kubernetesCommandLineToolsExecutor.execInContainerCommand(testScript);
|
|
130
|
+
expect(output, 'Podman test script failed').contains('Successfully tagged');
|
|
131
|
+
const runOutput: ShellString = kubernetesCommandLineToolsExecutor.execInContainerCommand(runTestScript);
|
|
132
|
+
expect(runOutput, 'Podman test script failed').contains('Hello from Kubedock!');
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
suiteTeardown(function (): void {
|
|
136
|
+
// restore spec.devEnvironments.persistUserHome.enabled to original value
|
|
137
|
+
const restoreResult: ShellString = shellExecutor.executeCommand(
|
|
138
|
+
`oc patch checluster ${cheClusterName} --type=merge ` +
|
|
139
|
+
`-p '{"spec":{"devEnvironments":{"persistUserHome":{"enabled": ${defaultPersistentHomeValue}}}}}'`
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
expect(restoreResult.code).to.equal(0, 'Failed to restore CheCluster persistUserHome setting');
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
suiteTeardown('Stop and delete the workspace by API', async function (): Promise<void> {
|
|
146
|
+
await dashboard.openDashboard();
|
|
147
|
+
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
148
|
+
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
suiteTeardown('Unregister running workspace', function (): void {
|
|
152
|
+
registerRunningWorkspace('');
|
|
153
|
+
});
|
|
154
|
+
});
|