@eclipse-che/che-e2e 7.68.0-dev-52d73d3 → 7.68.0-dev-270fc19
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/constants/DevfilesRegistryConstants.ts +26 -0
- package/constants/TestConstants.ts +14 -3
- package/dist/constants/DevfilesRegistryConstants.js +32 -0
- package/dist/constants/DevfilesRegistryConstants.js.map +1 -0
- package/dist/constants/TestConstants.js +12 -3
- package/dist/constants/TestConstants.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js +5 -4
- package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +40 -0
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -0
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +61 -0
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -0
- package/dist/specs/api/PodOverridesAPI.spec.js +5 -4
- package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/RecomendedExtentions.spec.js +3 -3
- package/dist/specs/dashboard-samples/RecomendedExtentions.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +3 -2
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +3 -2
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +3 -2
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js +72 -0
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -0
- package/dist/utils/DriverHelper.js +4 -0
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +14 -14
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/Sanitizer.js.map +1 -1
- package/dist/utils/ShellExecutor.js +5 -2
- package/dist/utils/ShellExecutor.js.map +1 -1
- package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
- package/dist/utils/vsc/GitUtil.js +22 -1
- package/dist/utils/vsc/GitUtil.js.map +1 -1
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/index.ts +1 -0
- package/package.json +2 -1
- package/specs/api/ContainerOverridesAPI.spec.ts +5 -4
- package/specs/api/DevfileAcceptanceTestAPI.spec.ts +49 -0
- package/specs/api/EmptyWorkspaceAPI.spec.ts +73 -0
- package/specs/api/PodOverridesAPI.spec.ts +5 -4
- package/specs/dashboard-samples/RecomendedExtentions.spec.ts +4 -4
- package/specs/factory/Factory.spec.ts +3 -2
- package/specs/factory/NoSetupRepoFactory.spec.ts +3 -2
- package/specs/factory/RefusedOAuthFactory.spec.ts +3 -2
- package/tests-library/LoginTests.ts +3 -3
- package/tests-library/ProjectAndFileTests.ts +1 -1
- package/tests-library/WorkspaceHandlingTests.ts +10 -10
- package/utils/DevWorkspaceConfigurationHelper.ts +83 -0
- package/utils/DriverHelper.ts +34 -29
- package/utils/KubernetesCommandLineToolsExecutor.ts +15 -15
- package/utils/Logger.ts +5 -5
- package/utils/Sanitizer.ts +1 -1
- package/utils/ShellExecutor.ts +6 -2
- package/utils/request-handlers/CheApiRequestHandler.ts +2 -2
- package/utils/vsc/GitUtil.ts +19 -1
- package/utils/workspace/ApiUrlResolver.ts +2 -2
- package/utils/workspace/TestWorkspaceUtil.ts +7 -7
- package/dist/specs/api/CloneGitRepoAPI.spec.js +0 -60
- package/dist/specs/api/CloneGitRepoAPI.spec.js.map +0 -1
- package/specs/api/CloneGitRepoAPI.spec.ts +0 -72
|
@@ -43,22 +43,22 @@ export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
|
43
43
|
|
|
44
44
|
getContainerName(): string {
|
|
45
45
|
Logger.debug(`${this.getLoggingName(this.getContainerName.name)}: Get container name.`);
|
|
46
|
-
const output: ShellString =
|
|
46
|
+
const output: ShellString = ShellExecutor.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} get ${(KubernetesCommandLineToolsExecutor.pod)} -o jsonpath='{.spec.containers[*].name}' -n ${this.namespace}`);
|
|
47
47
|
echo('\n');
|
|
48
48
|
return output.stderr ? output.stderr : output.stdout;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
getWorkspacePodName(): string {
|
|
52
52
|
Logger.debug(`${this.getLoggingName(this.getWorkspacePodName.name)}: Get workspace pod name.`);
|
|
53
|
-
const output: ShellString =
|
|
53
|
+
const output: ShellString = ShellExecutor.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} get pod -l controller.devfile.io/devworkspace_name=${this.workspaceName} -n ${this.namespace} -o name`);
|
|
54
54
|
return output.stderr ? output.stderr : output.stdout.replace('\n', '');
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
deleteDevWorkspace(): void {
|
|
58
58
|
Logger.debug(`${this.getLoggingName(this.deleteDevWorkspace.name)}: Delete '${this.workspaceName}' workspace`);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
ShellExecutor.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} patch dw ${this.workspaceName} -n ${this.namespace} -p '{ "metadata": { "finalizers": null }}' --type merge || true`);
|
|
60
|
+
ShellExecutor.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} delete dw ${this.workspaceName} -n ${this.namespace} || true`);
|
|
61
|
+
ShellExecutor.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} delete dwt ${TestConstants.TS_SELENIUM_EDITOR}-${this.workspaceName} -n ${this.namespace} || true`);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
applyAndWaitDevWorkspace(yamlConfiguration: string): ShellString {
|
|
@@ -74,48 +74,48 @@ export class KubernetesCommandLineToolsExecutor extends ShellExecutor {
|
|
|
74
74
|
|
|
75
75
|
executeCommand(commandToExecute: string): ShellString {
|
|
76
76
|
Logger.debug(`${this.getLoggingName(this.executeCommand.name)}:`);
|
|
77
|
-
return
|
|
77
|
+
return ShellExecutor.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} exec -i ${KubernetesCommandLineToolsExecutor.pod} -n ${this.namespace} -c ${KubernetesCommandLineToolsExecutor.container} -- sh -c "${commandToExecute}"`);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
applyYamlConfigurationAsStringOutput(yamlConfiguration: string):
|
|
80
|
+
applyYamlConfigurationAsStringOutput(yamlConfiguration: string): ShellString {
|
|
81
81
|
Logger.debug(`${this.getLoggingName(this.applyYamlConfigurationAsStringOutput.name)}:`);
|
|
82
|
-
|
|
82
|
+
return ShellExecutor.execWithLog(`cat <<EOF | ${this.KUBERNETES_COMMAND_LINE_TOOL} apply -n ${this.namespace} -f - \n` +
|
|
83
83
|
yamlConfiguration + '\n' +
|
|
84
84
|
'EOF');
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
applyYamlConfigurationAsFile(pathToFile: string): void {
|
|
88
88
|
Logger.debug(`${this.getLoggingName(this.applyYamlConfigurationAsFile.name)}:`);
|
|
89
|
-
|
|
89
|
+
ShellExecutor.execWithLog(`${this.KUBERNETES_COMMAND_LINE_TOOL} apply -n ${this.namespace} -f "${path.resolve(pathToFile)}"`);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
getDevWorkspaceYamlConfiguration(): ShellString {
|
|
93
93
|
Logger.debug(`${this.getLoggingName(this.getDevWorkspaceYamlConfiguration.name)}:`);
|
|
94
|
-
return
|
|
94
|
+
return ShellExecutor.execWithLog(`${this.KUBERNETES_COMMAND_LINE_TOOL} get dw ${this.workspaceName} -n ${this.namespace} -o yaml`);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
waitDevWorkspace(timeout: number = 360): ShellString {
|
|
98
98
|
Logger.debug(`${this.getLoggingName(this.waitDevWorkspace.name)}: Wait till workspace ready.`);
|
|
99
|
-
return
|
|
99
|
+
return ShellExecutor.execWithLog(`${(this.KUBERNETES_COMMAND_LINE_TOOL)} wait -n ${this.namespace} --for=condition=Ready dw ${this.workspaceName} --timeout=${timeout}s`);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
createNamespace(): void {
|
|
103
103
|
Logger.debug(`${this.getLoggingName(this.createNamespace.name)}: Create namespace "${this.namespace}".`);
|
|
104
|
-
|
|
104
|
+
ShellExecutor.execWithLog(`${this.KUBERNETES_COMMAND_LINE_TOOL} create namespace ${this.namespace}`);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
createProject(projectName: string): void {
|
|
108
108
|
Logger.debug(`${this.getLoggingName(this.createProject.name)}: Create new project "${projectName}".`);
|
|
109
|
-
|
|
109
|
+
ShellExecutor.execWithLog(`${this.KUBERNETES_COMMAND_LINE_TOOL} new-project ${projectName} -n ${this.namespace}`);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
deleteProject(projectName: string): void {
|
|
113
113
|
Logger.debug(`${this.getLoggingName(this.deleteProject.name)}: Delete "${projectName}".`);
|
|
114
|
-
|
|
114
|
+
ShellExecutor.execWithLog(`${this.KUBERNETES_COMMAND_LINE_TOOL} delete project ${projectName} -n ${this.namespace}`);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
private isUserLoggedIn(): boolean {
|
|
118
|
-
const whoamiCommandOutput: ShellString =
|
|
118
|
+
const whoamiCommandOutput: ShellString = ShellExecutor.execWithLog('oc whoami && oc whoami --show-server=true');
|
|
119
119
|
|
|
120
120
|
return whoamiCommandOutput.stdout.includes(TestConstants.TS_SELENIUM_OCP_USERNAME) && whoamiCommandOutput.stdout.includes(this.getServerUrl());
|
|
121
121
|
}
|
package/utils/Logger.ts
CHANGED
|
@@ -17,7 +17,7 @@ export abstract class Logger {
|
|
|
17
17
|
* @param text log text
|
|
18
18
|
* @param indentLevel log level
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
static error(text: string, indentLevel: number = 1): void {
|
|
21
21
|
this.logText(indentLevel, `[ERROR] ${text}`);
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -26,7 +26,7 @@ export abstract class Logger {
|
|
|
26
26
|
* @param text log text
|
|
27
27
|
* @param indentLevel log level
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
static warn(text: string, indentLevel: number = 1): void {
|
|
30
30
|
if (TestConstants.TS_SELENIUM_LOG_LEVEL === 'ERROR') {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
@@ -38,7 +38,7 @@ export abstract class Logger {
|
|
|
38
38
|
* @param text log text
|
|
39
39
|
* @param indentLevel log level
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
static info(text: string, indentLevel: number = 3): void {
|
|
42
42
|
if (TestConstants.TS_SELENIUM_LOG_LEVEL === 'ERROR' ||
|
|
43
43
|
TestConstants.TS_SELENIUM_LOG_LEVEL === 'WARN') {
|
|
44
44
|
return;
|
|
@@ -51,7 +51,7 @@ export abstract class Logger {
|
|
|
51
51
|
* @param text log text
|
|
52
52
|
* @param indentLevel log level
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
static debug(text: string, indentLevel: number = 5): void {
|
|
55
55
|
if (TestConstants.TS_SELENIUM_LOG_LEVEL === 'ERROR' ||
|
|
56
56
|
TestConstants.TS_SELENIUM_LOG_LEVEL === 'WARN' ||
|
|
57
57
|
TestConstants.TS_SELENIUM_LOG_LEVEL === 'INFO') {
|
|
@@ -66,7 +66,7 @@ export abstract class Logger {
|
|
|
66
66
|
* @param text log text
|
|
67
67
|
* @param indentLevel log level
|
|
68
68
|
*/
|
|
69
|
-
|
|
69
|
+
static trace(text: string, indentLevel: number = 6): void {
|
|
70
70
|
if (TestConstants.TS_SELENIUM_LOG_LEVEL === 'ERROR' ||
|
|
71
71
|
TestConstants.TS_SELENIUM_LOG_LEVEL === 'WARN' ||
|
|
72
72
|
TestConstants.TS_SELENIUM_LOG_LEVEL === 'INFO' ||
|
package/utils/Sanitizer.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { injectable } from 'inversify';
|
|
|
13
13
|
@injectable()
|
|
14
14
|
export class Sanitizer {
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
sanitize(arg: string): string {
|
|
17
17
|
return arg.replace(/[\/]/g, '+').replace(/[\,]/g, '.').replace(/[\:]/g, '-').replace(/[\'\"]/g, '').replace(/[^a-z0-9\+\-\.\(\)\[\]\_]/gi, '_');
|
|
18
18
|
}
|
|
19
19
|
}
|
package/utils/ShellExecutor.ts
CHANGED
|
@@ -2,11 +2,15 @@ import { echo, exec, ShellString } from 'shelljs';
|
|
|
2
2
|
|
|
3
3
|
export class ShellExecutor {
|
|
4
4
|
|
|
5
|
-
wait(seconds: number): void {
|
|
5
|
+
static wait(seconds: number): void {
|
|
6
6
|
this.execWithLog(`sleep ${seconds}s`);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
static curl(link: string): ShellString {
|
|
10
|
+
return this.execWithLog(`curl -k ${link}`);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
protected static execWithLog(command: string): ShellString {
|
|
10
14
|
echo(command);
|
|
11
15
|
return exec(command);
|
|
12
16
|
}
|
|
@@ -21,7 +21,7 @@ export class CheApiRequestHandler {
|
|
|
21
21
|
/**
|
|
22
22
|
* This method adds a request interceptor into axios request interceptors list and returns an ID of the interceptor
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
static enableRequestInterceptor(): number {
|
|
25
25
|
Logger.debug(`CheApiRequestHandler.enableRequestInterceptor`);
|
|
26
26
|
return axios.interceptors.request.use( request => {
|
|
27
27
|
try {
|
|
@@ -47,7 +47,7 @@ export class CheApiRequestHandler {
|
|
|
47
47
|
/**
|
|
48
48
|
* This method adds a response interceptor into axios response interceptors list and returns an ID of the interceptor
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
static enableResponseInterceptor(): number {
|
|
51
51
|
Logger.debug(`CheApiRequestHandler.enableResponseRedirects`);
|
|
52
52
|
return axios.interceptors.response.use( response => {
|
|
53
53
|
try {
|
package/utils/vsc/GitUtil.ts
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
|
|
11
11
|
import { injectable } from 'inversify';
|
|
12
|
+
import YAML from 'yaml';
|
|
13
|
+
import { Logger } from '../Logger';
|
|
14
|
+
import axios, { AxiosResponse } from 'axios';
|
|
12
15
|
|
|
13
16
|
@injectable()
|
|
14
17
|
export class GitUtil {
|
|
@@ -20,6 +23,21 @@ export class GitUtil {
|
|
|
20
23
|
* @return project name
|
|
21
24
|
*/
|
|
22
25
|
static getProjectNameFromGitUrl(url: string): string {
|
|
23
|
-
|
|
26
|
+
Logger.debug(`${this.constructor.name}.${this.getProjectNameFromGitUrl.name} - ${url}`);
|
|
27
|
+
const projectName: string = url.split(/[\/.]/).filter((e: string) => e !== '' && e !== 'git').reverse()[0];
|
|
28
|
+
Logger.debug(`${this.constructor.name}.${this.getProjectNameFromGitUrl.name} - ${projectName}`);
|
|
29
|
+
return projectName;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Method extracts a git url for DevWorkspace configuration from meta.yaml file;
|
|
33
|
+
* @param linkToMetaYaml raw url to git repository where meta.yaml is;
|
|
34
|
+
* @return git link which uses in DevWorkspaceConfigurationHelper as DevfileUrl parameter
|
|
35
|
+
*/
|
|
36
|
+
static async getProjectGitLinkFromLinkToMetaYaml(linkToMetaYaml: string): Promise<string> {
|
|
37
|
+
Logger.debug(`${this.constructor.name}.${this.getProjectGitLinkFromLinkToMetaYaml.name} - ${linkToMetaYaml}`);
|
|
38
|
+
const response: AxiosResponse = await axios.get(linkToMetaYaml);
|
|
39
|
+
const metaYamlContent: any = YAML.parse(response.data);
|
|
40
|
+
Logger.debug(`${this.constructor.name}.${this.getProjectGitLinkFromLinkToMetaYaml.name} - ${metaYamlContent.links.v2}`);
|
|
41
|
+
return metaYamlContent.links.v2;
|
|
24
42
|
}
|
|
25
43
|
}
|
|
@@ -22,11 +22,11 @@ export class ApiUrlResolver {
|
|
|
22
22
|
|
|
23
23
|
constructor(@inject(CLASSES.CheApiRequestHandler) private readonly processRequestHandler: CheApiRequestHandler) {}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
async getWorkspaceApiUrl(workspaceName: string): Promise<string> {
|
|
26
26
|
return `${await this.getWorkspacesApiUrl()}/${workspaceName}`;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
async getWorkspacesApiUrl(): Promise<string> {
|
|
30
30
|
const namespace: string = await this.obtainUserNamespace();
|
|
31
31
|
return `${ApiUrlResolver.DASHBOARD_API_URL}/${namespace}/devworkspaces`;
|
|
32
32
|
}
|
|
@@ -32,7 +32,7 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil {
|
|
|
32
32
|
@inject(CLASSES.ApiUrlResolver) private readonly apiUrlResolver: ApiUrlResolver
|
|
33
33
|
) { }
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
async waitWorkspaceStatus(workspaceName: string, expectedWorkspaceStatus: WorkspaceStatus): Promise<void> {
|
|
36
36
|
Logger.debug('TestWorkspaceUtil.waitWorkspaceStatus');
|
|
37
37
|
|
|
38
38
|
let workspaceStatus: string = '';
|
|
@@ -60,7 +60,7 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
async stopWorkspaceByName(workspaceName: string): Promise<void> {
|
|
64
64
|
Logger.debug('TestWorkspaceUtil.stopWorkspaceByName');
|
|
65
65
|
|
|
66
66
|
const stopWorkspaceApiUrl: string = await this.apiUrlResolver.getWorkspaceApiUrl(workspaceName);
|
|
@@ -81,7 +81,7 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// delete a workspace without stopping phase (similar with force deleting)
|
|
84
|
-
|
|
84
|
+
async deleteWorkspaceByName(workspaceName: string): Promise<void> {
|
|
85
85
|
Logger.debug(`TestWorkspaceUtil.deleteWorkspaceByName ${workspaceName}` );
|
|
86
86
|
|
|
87
87
|
const deleteWorkspaceApiUrl: string = await this.apiUrlResolver.getWorkspaceApiUrl(workspaceName);
|
|
@@ -120,7 +120,7 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// stop workspace before deleting with checking stopping phase
|
|
123
|
-
|
|
123
|
+
async stopAndDeleteWorkspaceByName(workspaceName: string): Promise<void> {
|
|
124
124
|
Logger.debug('TestWorkspaceUtil.stopAndDeleteWorkspaceByName');
|
|
125
125
|
|
|
126
126
|
await this.stopWorkspaceByName(workspaceName);
|
|
@@ -128,7 +128,7 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
// stop all run workspaces in the namespace
|
|
131
|
-
|
|
131
|
+
async stopAllRunningWorkspaces(namespace: string): Promise<void> {
|
|
132
132
|
Logger.debug('TestWorkspaceUtil.stopAllRunProjects');
|
|
133
133
|
let response: AxiosResponse = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspacesApiUrl());
|
|
134
134
|
for (let i: number = 0; i < response.data.items.length; i++) {
|
|
@@ -138,7 +138,7 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
// stop all run workspaces, check statuses and remove the workspaces
|
|
141
|
-
|
|
141
|
+
async stopAndDeleteAllRunningWorkspaces(namespace: string): Promise<void> {
|
|
142
142
|
Logger.debug('TestWorkspaceUtil.stopAndDeleteAllRunProjects');
|
|
143
143
|
let response: AxiosResponse = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspacesApiUrl());
|
|
144
144
|
await this.stopAllRunningWorkspaces(namespace);
|
|
@@ -150,7 +150,7 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil {
|
|
|
150
150
|
|
|
151
151
|
// stop all run workspaces without stopping and waiting for of 'Stopped' phase
|
|
152
152
|
// similar with 'force' deleting
|
|
153
|
-
|
|
153
|
+
async deleteAllWorkspaces(namespace: string): Promise<void> {
|
|
154
154
|
Logger.debug('TestWorkspaceUtil.deleteAllRunProjects');
|
|
155
155
|
let response: AxiosResponse = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspacesApiUrl());
|
|
156
156
|
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const KubernetesCommandLineToolsExecutor_1 = require("../../utils/KubernetesCommandLineToolsExecutor");
|
|
4
|
-
const chai_1 = require("chai");
|
|
5
|
-
const GitUtil_1 = require("../../utils/vsc/GitUtil");
|
|
6
|
-
const TestConstants_1 = require("../../constants/TestConstants");
|
|
7
|
-
const gitRepository = 'https://github.com/crw-qe/web-nodejs-sample';
|
|
8
|
-
suite(`Test cloning of repo "${gitRepository}" into empty workspace.`, async function () {
|
|
9
|
-
// works only for root user
|
|
10
|
-
const namespace = TestConstants_1.TestConstants.TS_API_TEST_NAMESPACE ? TestConstants_1.TestConstants.TS_API_TEST_NAMESPACE : undefined;
|
|
11
|
-
const workspaceName = 'empty-' + Math.floor(Math.random() * 1000);
|
|
12
|
-
const clonedProjectName = GitUtil_1.GitUtil.getProjectNameFromGitUrl(gitRepository);
|
|
13
|
-
let containerWorkDir = '';
|
|
14
|
-
const kubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor_1.KubernetesCommandLineToolsExecutor(workspaceName, namespace);
|
|
15
|
-
const containerTerminal = new KubernetesCommandLineToolsExecutor_1.KubernetesCommandLineToolsExecutor.ContainerTerminal(kubernetesCommandLineToolsExecutor);
|
|
16
|
-
const emptyYaml = 'apiVersion: workspace.devfile.io/v1alpha2\n' +
|
|
17
|
-
'kind: DevWorkspace\n' +
|
|
18
|
-
'metadata:\n' +
|
|
19
|
-
` name: ${workspaceName}\n` +
|
|
20
|
-
'spec:\n' +
|
|
21
|
-
' started: true\n' +
|
|
22
|
-
' template:\n' +
|
|
23
|
-
' components:\n' +
|
|
24
|
-
' - container:\n' +
|
|
25
|
-
` image: ${TestConstants_1.TestConstants.TS_API_TEST_UDI_IMAGE}\n` +
|
|
26
|
-
' name: universal-developer-image\n' +
|
|
27
|
-
' contributions:\n' +
|
|
28
|
-
' - name: che-code\n' +
|
|
29
|
-
` uri: ${TestConstants_1.TestConstants.TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI}\n` +
|
|
30
|
-
' components:\n' +
|
|
31
|
-
' - name: che-code-runtime-description\n' +
|
|
32
|
-
' container:\n' +
|
|
33
|
-
' env:\n' +
|
|
34
|
-
' - name: CODE_HOST\n' +
|
|
35
|
-
' value: 0.0.0.0';
|
|
36
|
-
suiteSetup('Create empty workspace with OC client', function () {
|
|
37
|
-
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
38
|
-
kubernetesCommandLineToolsExecutor.applyAndWaitDevWorkspace(emptyYaml);
|
|
39
|
-
});
|
|
40
|
-
suiteTeardown('Delete workspace', function () {
|
|
41
|
-
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
|
|
42
|
-
});
|
|
43
|
-
suite('Clone public repo without previous setup', function () {
|
|
44
|
-
suiteTeardown('Delete cloned project', function () {
|
|
45
|
-
containerTerminal.removeFolder(`${clonedProjectName}`);
|
|
46
|
-
});
|
|
47
|
-
test('Check if public repo can be cloned', function () {
|
|
48
|
-
containerWorkDir = containerTerminal.pwd().stdout.replace('\n', '');
|
|
49
|
-
const cloneOutput = containerTerminal.gitClone(gitRepository);
|
|
50
|
-
chai_1.expect(cloneOutput.stdout + cloneOutput.stderr).includes('Cloning');
|
|
51
|
-
});
|
|
52
|
-
test('Check if project was created', function () {
|
|
53
|
-
chai_1.expect(containerTerminal.ls().stdout).includes(clonedProjectName);
|
|
54
|
-
});
|
|
55
|
-
test('Check if files were imported ', function () {
|
|
56
|
-
chai_1.expect(containerTerminal.ls(`${containerWorkDir}/${clonedProjectName}`).stdout).includes(TestConstants_1.TestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
//# sourceMappingURL=CloneGitRepoAPI.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CloneGitRepoAPI.spec.js","sourceRoot":"","sources":["../../../specs/api/CloneGitRepoAPI.spec.ts"],"names":[],"mappings":";;AAAA,uGAAoG;AACpG,+BAA8B;AAE9B,qDAAkD;AAClD,iEAA8D;AAG9D,MAAM,aAAa,GAAW,6CAA6C,CAAC;AAE5E,KAAK,CAAC,yBAAyB,aAAa,yBAAyB,EAAE,KAAK;IACxE,2BAA2B;IAC3B,MAAM,SAAS,GAAW,6BAAa,CAAC,qBAAqB,CAAC,CAAC,CAAC,6BAAa,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,CAAC;IAChH,MAAM,aAAa,GAAW,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1E,MAAM,iBAAiB,GAAW,iBAAO,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;IAClF,IAAI,gBAAgB,GAAW,EAAE,CAAC;IAElC,MAAM,kCAAkC,GAAuC,IAAI,uEAAkC,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAChJ,MAAM,iBAAiB,GAAyD,IAAI,uEAAkC,CAAC,iBAAiB,CAAC,kCAAkC,CAAC,CAAC;IAE7K,MAAM,SAAS,GACX,6CAA6C;QAC7C,sBAAsB;QACtB,aAAa;QACb,WAAW,aAAa,IAAI;QAC5B,SAAS;QACT,mBAAmB;QACnB,eAAe;QACf,mBAAmB;QACnB,sBAAsB;QACtB,oBAAoB,6BAAa,CAAC,qBAAqB,IAAI;QAC3D,2CAA2C;QAC3C,oBAAoB;QACpB,wBAAwB;QACxB,cAAc,6BAAa,CAAC,uCAAuC,IAAI;QACvE,qBAAqB;QACrB,gDAAgD;QAChD,wBAAwB;QACxB,oBAAoB;QACpB,mCAAmC;QACnC,gCAAgC,CAAC;IAErC,UAAU,CAAC,uCAAuC,EAAE;QAChD,kCAAkC,CAAC,UAAU,EAAE,CAAC;QAChD,kCAAkC,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,aAAa,CAAC,kBAAkB,EAAE;QAC9B,kCAAkC,CAAC,kBAAkB,EAAE,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,0CAA0C,EAAE;QAC9C,aAAa,CAAC,uBAAuB,EAAE;YACnC,iBAAiB,CAAC,YAAY,CAAC,GAAG,iBAAiB,EAAE,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,oCAAoC,EAAE;YACvC,gBAAgB,GAAG,iBAAiB,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACpE,MAAM,WAAW,GAAgB,iBAAiB,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;YAC3E,aAAM,CAAC,WAAW,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,8BAA8B,EAAE;YACjC,aAAM,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,+BAA+B,EAAE;YAClC,aAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,GAAG,gBAAgB,IAAI,iBAAiB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,6BAAa,CAAC,kCAAkC,CAAC,CAAC;QAC/I,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
|
|
2
|
-
import { expect } from 'chai';
|
|
3
|
-
import { ShellString } from 'shelljs';
|
|
4
|
-
import { GitUtil } from '../../utils/vsc/GitUtil';
|
|
5
|
-
import { TestConstants } from '../../constants/TestConstants';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const gitRepository: string = 'https://github.com/crw-qe/web-nodejs-sample';
|
|
9
|
-
|
|
10
|
-
suite(`Test cloning of repo "${gitRepository}" into empty workspace.`, async function (): Promise<void> {
|
|
11
|
-
// works only for root user
|
|
12
|
-
const namespace: string = TestConstants.TS_API_TEST_NAMESPACE ? TestConstants.TS_API_TEST_NAMESPACE : undefined;
|
|
13
|
-
const workspaceName: string = 'empty-' + Math.floor(Math.random() * 1000);
|
|
14
|
-
const clonedProjectName: string = GitUtil.getProjectNameFromGitUrl(gitRepository);
|
|
15
|
-
let containerWorkDir: string = '';
|
|
16
|
-
|
|
17
|
-
const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = new KubernetesCommandLineToolsExecutor(workspaceName, namespace);
|
|
18
|
-
const containerTerminal: KubernetesCommandLineToolsExecutor.ContainerTerminal = new KubernetesCommandLineToolsExecutor.ContainerTerminal(kubernetesCommandLineToolsExecutor);
|
|
19
|
-
|
|
20
|
-
const emptyYaml: string =
|
|
21
|
-
'apiVersion: workspace.devfile.io/v1alpha2\n' +
|
|
22
|
-
'kind: DevWorkspace\n' +
|
|
23
|
-
'metadata:\n' +
|
|
24
|
-
` name: ${workspaceName}\n` +
|
|
25
|
-
'spec:\n' +
|
|
26
|
-
' started: true\n' +
|
|
27
|
-
' template:\n' +
|
|
28
|
-
' components:\n' +
|
|
29
|
-
' - container:\n' +
|
|
30
|
-
` image: ${TestConstants.TS_API_TEST_UDI_IMAGE}\n` +
|
|
31
|
-
' name: universal-developer-image\n' +
|
|
32
|
-
' contributions:\n' +
|
|
33
|
-
' - name: che-code\n' +
|
|
34
|
-
` uri: ${TestConstants.TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI}\n` +
|
|
35
|
-
' components:\n' +
|
|
36
|
-
' - name: che-code-runtime-description\n' +
|
|
37
|
-
' container:\n' +
|
|
38
|
-
' env:\n' +
|
|
39
|
-
' - name: CODE_HOST\n' +
|
|
40
|
-
' value: 0.0.0.0';
|
|
41
|
-
|
|
42
|
-
suiteSetup('Create empty workspace with OC client', function (): void {
|
|
43
|
-
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
44
|
-
kubernetesCommandLineToolsExecutor.applyAndWaitDevWorkspace(emptyYaml);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
suiteTeardown('Delete workspace', function (): void {
|
|
48
|
-
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
suite('Clone public repo without previous setup', function (): void {
|
|
52
|
-
suiteTeardown('Delete cloned project', function (): void {
|
|
53
|
-
containerTerminal.removeFolder(`${clonedProjectName}`);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test('Check if public repo can be cloned', function (): void {
|
|
57
|
-
containerWorkDir = containerTerminal.pwd().stdout.replace('\n', '');
|
|
58
|
-
const cloneOutput: ShellString = containerTerminal.gitClone(gitRepository);
|
|
59
|
-
expect(cloneOutput.stdout + cloneOutput.stderr).includes('Cloning');
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test('Check if project was created', function (): void {
|
|
63
|
-
expect(containerTerminal.ls().stdout).includes(clonedProjectName);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test('Check if files were imported ', function (): void {
|
|
67
|
-
expect(containerTerminal.ls(`${containerWorkDir}/${clonedProjectName}`).stdout).includes(TestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
|