@eclipse-che/che-e2e 7.68.0-dev-52d73d3 → 7.68.0-dev-8aa6599
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 +4 -1
- package/dist/constants/DevfilesRegistryConstants.js +32 -0
- package/dist/constants/DevfilesRegistryConstants.js.map +1 -0
- package/dist/constants/TestConstants.js +3 -1
- 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/CloneGitRepoAPI.spec.js +2 -1
- package/dist/specs/api/CloneGitRepoAPI.spec.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 +41 -0
- package/dist/specs/api/DevfileAcceptanceTestAPI.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 +52 -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/CloneGitRepoAPI.spec.ts +2 -1
- package/specs/api/ContainerOverridesAPI.spec.ts +5 -4
- package/specs/api/DevfileAcceptanceTestAPI.spec.ts +50 -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 +57 -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/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
|
|