@eclipse-che/che-e2e 7.50.0-dev-25a3c8c → 7.50.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/dist/driver/CheReporter.js +3 -2
- package/dist/driver/CheReporter.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inversify.config.js +1 -1
- package/dist/inversify.config.js.map +1 -1
- package/dist/inversify.types.js +2 -3
- package/dist/inversify.types.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +2 -4
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.js +2 -4
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.js.map +1 -1
- package/dist/pageobjects/ide/ProjectTree.js +12 -6
- package/dist/pageobjects/ide/ProjectTree.js.map +1 -1
- package/dist/tests/devfiles/CSlashCPlusPlus.spec.js +3 -4
- package/dist/tests/devfiles/CSlashCPlusPlus.spec.js.map +1 -1
- package/dist/tests/devfiles/DevfileSmoke.spec.js +4 -5
- package/dist/tests/devfiles/DevfileSmoke.spec.js.map +1 -1
- package/dist/tests/devfiles/DotNetCore.spec.js +3 -4
- package/dist/tests/devfiles/DotNetCore.spec.js.map +1 -1
- package/dist/tests/devfiles/Go.spec.js +3 -4
- package/dist/tests/devfiles/Go.spec.js.map +1 -1
- package/dist/tests/devfiles/JavaMaven.spec.js +3 -4
- package/dist/tests/devfiles/JavaMaven.spec.js.map +1 -1
- package/dist/tests/devfiles/JavaSpringBoot.spec.js +3 -4
- package/dist/tests/devfiles/JavaSpringBoot.spec.js.map +1 -1
- package/dist/tests/devfiles/JavaVertx.spec.js +3 -4
- package/dist/tests/devfiles/JavaVertx.spec.js.map +1 -1
- package/dist/tests/devfiles/NodeJS.spec.js +3 -4
- package/dist/tests/devfiles/NodeJS.spec.js.map +1 -1
- package/dist/tests/devfiles/PHPSimple.spec.js +3 -4
- package/dist/tests/devfiles/PHPSimple.spec.js.map +1 -1
- package/dist/tests/devfiles/Python.spec.js +3 -4
- package/dist/tests/devfiles/Python.spec.js.map +1 -1
- package/dist/tests/devfiles/PythonDjango.spec.js +3 -4
- package/dist/tests/devfiles/PythonDjango.spec.js.map +1 -1
- package/dist/tests/devfiles/Quarkus.spec.js +3 -4
- package/dist/tests/devfiles/Quarkus.spec.js.map +1 -1
- package/dist/tests/devfiles/Scala.spec.js +3 -4
- package/dist/tests/devfiles/Scala.spec.js.map +1 -1
- package/dist/tests/e2e/FactoryUrl.spec.js +5 -10
- package/dist/tests/e2e/FactoryUrl.spec.js.map +1 -1
- package/dist/tests/e2e/GitPublishBranch.spec.js +3 -1
- package/dist/tests/e2e/GitPublishBranch.spec.js.map +1 -1
- package/dist/tests/e2e/GitSelfSignCert.spec.js +8 -1
- package/dist/tests/e2e/GitSelfSignCert.spec.js.map +1 -1
- package/dist/tests/e2e/GitSsh.spec.js +5 -2
- package/dist/tests/e2e/GitSsh.spec.js.map +1 -1
- package/dist/tests/e2e/OpenshiftConnector.spec.js +3 -1
- package/dist/tests/e2e/OpenshiftConnector.spec.js.map +1 -1
- package/dist/tests/e2e/factories/DirectUrlFactoryWithKeepDirectoryTest.spec.js +3 -7
- package/dist/tests/e2e/factories/DirectUrlFactoryWithKeepDirectoryTest.spec.js.map +1 -1
- package/dist/tests/e2e/factories/DirectUrlFactoryWithRootFolderTest.spec.js +3 -7
- package/dist/tests/e2e/factories/DirectUrlFactoryWithRootFolderTest.spec.js.map +1 -1
- package/dist/tests/e2e/factories/DirectUrlFactoryWithSpecificBranchTest.spec.js +3 -7
- package/dist/tests/e2e/factories/DirectUrlFactoryWithSpecificBranchTest.spec.js.map +1 -1
- package/dist/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.js +2 -0
- package/dist/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.js.map +1 -1
- package/dist/tests/e2e_happy_path/HappyPath.spec.js +13 -8
- package/dist/tests/e2e_happy_path/HappyPath.spec.js.map +1 -1
- package/dist/tests/intelij/IntelijOpenWorkspace.spec.js +2 -6
- package/dist/tests/intelij/IntelijOpenWorkspace.spec.js.map +1 -1
- package/dist/tests/load_test/LoadTest.spec.js +3 -6
- package/dist/tests/load_test/LoadTest.spec.js.map +1 -1
- package/dist/tests/login/LinkCheAndOcpUsers.spec.js +2 -2
- package/dist/tests/login/LinkCheAndOcpUsers.spec.js.map +1 -1
- package/dist/tests/plugins/GitHubPullRequestPlugin.spec.js +4 -9
- package/dist/tests/plugins/GitHubPullRequestPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/InstallPluginUsingUI.spec.js +4 -10
- package/dist/tests/plugins/InstallPluginUsingUI.spec.js.map +1 -1
- package/dist/tests/plugins/JavaPlugin.spec.js +4 -8
- package/dist/tests/plugins/JavaPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/PhpPlugin.spec.js +12 -10
- package/dist/tests/plugins/PhpPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/PythonPlugin.spec.js +4 -8
- package/dist/tests/plugins/PythonPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/TypescriptPlugin.spec.js +4 -8
- package/dist/tests/plugins/TypescriptPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/VscodeKubernetesPlugin.spec.js +3 -10
- package/dist/tests/plugins/VscodeKubernetesPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/VscodeShellcheckPlugin.spec.js +3 -10
- package/dist/tests/plugins/VscodeShellcheckPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/VscodeValePlugin.spec.js +3 -10
- package/dist/tests/plugins/VscodeValePlugin.spec.js.map +1 -1
- package/dist/tests/plugins/VscodeXmlPlugin.spec.js +15 -1
- package/dist/tests/plugins/VscodeXmlPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/VscodeYamlPlugin.spec.js +4 -8
- package/dist/tests/plugins/VscodeYamlPlugin.spec.js.map +1 -1
- package/dist/testsLibrary/CodeExecutionTests.js +14 -2
- package/dist/testsLibrary/CodeExecutionTests.js.map +1 -1
- package/dist/testsLibrary/WorkspaceHandlingTests.js +75 -10
- package/dist/testsLibrary/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/requestHandlers/CheApiRequestHandler.js.map +1 -1
- package/dist/utils/requestHandlers/headers/CheMultiuserAuthorizationHeaderHandler.js +17 -2
- package/dist/utils/requestHandlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
- package/dist/utils/workspace/ApiUrlResolver.js +41 -9
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/{IApiUrlResolver.js → ITestWorkspaceUtil.js} +1 -1
- package/dist/utils/workspace/ITestWorkspaceUtil.js.map +1 -0
- package/dist/utils/workspace/TestWorkspaceUtil.js +29 -31
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/dist/utils/workspace/WorkspaceStatus.js.map +1 -1
- package/driver/CheReporter.ts +4 -4
- package/index.ts +1 -1
- package/inversify.config.ts +4 -3
- package/inversify.types.ts +2 -3
- package/package.json +1 -1
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +3 -3
- package/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.ts +4 -4
- package/pageobjects/ide/ProjectTree.ts +13 -8
- package/tests/devfiles/CSlashCPlusPlus.spec.ts +3 -6
- package/tests/devfiles/DevfileSmoke.spec.ts +4 -7
- package/tests/devfiles/DotNetCore.spec.ts +3 -6
- package/tests/devfiles/Go.spec.ts +3 -4
- package/tests/devfiles/JavaMaven.spec.ts +3 -6
- package/tests/devfiles/JavaSpringBoot.spec.ts +3 -6
- package/tests/devfiles/JavaVertx.spec.ts +3 -6
- package/tests/devfiles/NodeJS.spec.ts +3 -6
- package/tests/devfiles/PHPSimple.spec.ts +3 -6
- package/tests/devfiles/Python.spec.ts +3 -6
- package/tests/devfiles/PythonDjango.spec.ts +3 -6
- package/tests/devfiles/Quarkus.spec.ts +3 -6
- package/tests/devfiles/Scala.spec.ts +3 -7
- package/tests/e2e/FactoryUrl.spec.ts +7 -11
- package/tests/e2e/GitPublishBranch.spec.ts +5 -3
- package/tests/e2e/GitSelfSignCert.spec.ts +68 -65
- package/tests/e2e/GitSsh.spec.ts +6 -3
- package/tests/e2e/OpenshiftConnector.spec.ts +4 -2
- package/tests/e2e/factories/DirectUrlFactoryWithKeepDirectoryTest.spec.ts +2 -5
- package/tests/e2e/factories/DirectUrlFactoryWithRootFolderTest.spec.ts +2 -5
- package/tests/e2e/factories/DirectUrlFactoryWithSpecificBranchTest.spec.ts +2 -5
- package/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.ts +2 -0
- package/tests/e2e_happy_path/HappyPath.spec.ts +13 -8
- package/tests/intelij/IntelijOpenWorkspace.spec.ts +2 -4
- package/tests/load_test/LoadTest.spec.ts +4 -4
- package/tests/login/LinkCheAndOcpUsers.spec.ts +4 -3
- package/tests/plugins/GitHubPullRequestPlugin.spec.ts +4 -7
- package/tests/plugins/InstallPluginUsingUI.spec.ts +4 -9
- package/tests/plugins/JavaPlugin.spec.ts +4 -6
- package/tests/plugins/PhpPlugin.spec.ts +3 -9
- package/tests/plugins/PythonPlugin.spec.ts +4 -6
- package/tests/plugins/TypescriptPlugin.spec.ts +4 -6
- package/tests/plugins/VscodeKubernetesPlugin.spec.ts +3 -9
- package/tests/plugins/VscodeShellcheckPlugin.spec.ts +3 -9
- package/tests/plugins/VscodeValePlugin.spec.ts +3 -9
- package/tests/plugins/VscodeXmlPlugin.spec.ts +17 -1
- package/tests/plugins/VscodeYamlPlugin.spec.ts +4 -7
- package/testsLibrary/CodeExecutionTests.ts +9 -1
- package/testsLibrary/WorkspaceHandlingTests.ts +72 -9
- package/utils/requestHandlers/CheApiRequestHandler.ts +1 -1
- package/utils/requestHandlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +17 -2
- package/utils/workspace/ApiUrlResolver.ts +34 -11
- package/utils/workspace/ITestWorkspaceUtil.ts +98 -0
- package/utils/workspace/TestWorkspaceUtil.ts +34 -34
- package/utils/workspace/WorkspaceStatus.ts +1 -1
- package/dist/utils/workspace/IApiUrlResolver.js.map +0 -1
- package/utils/workspace/IApiUrlResolver.ts +0 -15
|
@@ -8,38 +8,38 @@
|
|
|
8
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
|
|
11
|
+
import 'reflect-metadata';
|
|
11
12
|
import { che } from '@eclipse-che/api';
|
|
12
13
|
import { TestConstants } from '../../TestConstants';
|
|
13
14
|
import { injectable, inject } from 'inversify';
|
|
14
15
|
import { DriverHelper } from '../DriverHelper';
|
|
15
|
-
import { ApiUrlResolver } from './ApiUrlResolver';
|
|
16
|
-
import 'reflect-metadata';
|
|
17
16
|
import { WorkspaceStatus } from './WorkspaceStatus';
|
|
18
17
|
import { error } from 'selenium-webdriver';
|
|
19
18
|
import { CheApiRequestHandler } from '../requestHandlers/CheApiRequestHandler';
|
|
20
19
|
import { CLASSES } from '../../inversify.types';
|
|
21
20
|
import { Logger } from '../Logger';
|
|
22
21
|
import axios from 'axios';
|
|
22
|
+
import { ITestWorkspaceUtil } from './ITestWorkspaceUtil';
|
|
23
|
+
import { ApiUrlResolver } from './ApiUrlResolver';
|
|
23
24
|
|
|
24
25
|
@injectable()
|
|
25
|
-
export class TestWorkspaceUtil {
|
|
26
|
-
|
|
27
|
-
static readonly WORKSPACE_API_URL: string = 'dashboard/api/namespace';
|
|
26
|
+
export class TestWorkspaceUtil implements ITestWorkspaceUtil {
|
|
28
27
|
readonly attempts: number = TestConstants.TS_SELENIUM_WORKSPACE_STATUS_ATTEMPTS;
|
|
29
28
|
readonly polling: number = TestConstants.TS_SELENIUM_WORKSPACE_STATUS_POLLING;
|
|
29
|
+
|
|
30
30
|
constructor(
|
|
31
31
|
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
|
|
32
32
|
@inject(CLASSES.CheApiRequestHandler) private readonly processRequestHandler: CheApiRequestHandler,
|
|
33
33
|
@inject(CLASSES.ApiUrlResolver) private readonly apiUrlResolver: ApiUrlResolver
|
|
34
34
|
) { }
|
|
35
35
|
|
|
36
|
-
public async waitWorkspaceStatus(
|
|
36
|
+
public async waitWorkspaceStatus(workspaceName: string, expectedWorkspaceStatus: WorkspaceStatus) {
|
|
37
37
|
Logger.debug('TestWorkspaceUtil.waitWorkspaceStatus');
|
|
38
38
|
|
|
39
39
|
let workspaceStatus: string = '';
|
|
40
40
|
let expectedStatus: boolean = false;
|
|
41
41
|
for (let i = 0; i < this.attempts; i++) {
|
|
42
|
-
const response = await this.processRequestHandler.get(this.apiUrlResolver.getWorkspaceApiUrl(
|
|
42
|
+
const response = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspaceApiUrl(workspaceName));
|
|
43
43
|
|
|
44
44
|
if (response.status !== 200) {
|
|
45
45
|
throw new Error(`Can not get status of a workspace. Code: ${response.status} Data: ${response.data}`);
|
|
@@ -61,10 +61,10 @@ export class TestWorkspaceUtil {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
public async stopWorkspaceByName(
|
|
64
|
+
public async stopWorkspaceByName(workspaceName: string) {
|
|
65
65
|
Logger.debug('TestWorkspaceUtil.stopWorkspaceByName');
|
|
66
66
|
|
|
67
|
-
const stopWorkspaceApiUrl: string = this.apiUrlResolver.getWorkspaceApiUrl(
|
|
67
|
+
const stopWorkspaceApiUrl: string = await this.apiUrlResolver.getWorkspaceApiUrl(workspaceName);
|
|
68
68
|
let stopWorkspaceResponse;
|
|
69
69
|
|
|
70
70
|
try {
|
|
@@ -78,14 +78,14 @@ export class TestWorkspaceUtil {
|
|
|
78
78
|
throw new Error(`Cannot stop workspace. Code: ${stopWorkspaceResponse.status} Data: ${stopWorkspaceResponse.data}`);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
await this.waitWorkspaceStatus(
|
|
81
|
+
await this.waitWorkspaceStatus(workspaceName, WorkspaceStatus.STOPPED);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
// delete a worksapce without stopping phase (similar with force deleting)
|
|
85
|
-
public async deleteWorkspaceByName(
|
|
85
|
+
public async deleteWorkspaceByName(workspaceName: string) {
|
|
86
86
|
Logger.debug(`TestWorkspaceUtil.deleteWorkspaceByName ${workspaceName}` );
|
|
87
87
|
|
|
88
|
-
const deleteWorkspaceApiUrl: string = this.apiUrlResolver.getWorkspaceApiUrl(
|
|
88
|
+
const deleteWorkspaceApiUrl: string = await this.apiUrlResolver.getWorkspaceApiUrl(workspaceName);
|
|
89
89
|
let deleteWorkspaceResponse;
|
|
90
90
|
let deleteWorkspaceStatus: boolean = false;
|
|
91
91
|
try {
|
|
@@ -121,31 +121,31 @@ export class TestWorkspaceUtil {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
// stop workspace before deleting with checking stopping phase
|
|
124
|
-
public async stopAndDeleteWorkspaceByName(
|
|
124
|
+
public async stopAndDeleteWorkspaceByName(workspaceName: string) {
|
|
125
125
|
Logger.debug('TestWorkspaceUtil.stopAndDeleteWorkspaceByName');
|
|
126
126
|
|
|
127
|
-
await this.stopWorkspaceByName(
|
|
128
|
-
await this.deleteWorkspaceByName(
|
|
127
|
+
await this.stopWorkspaceByName(workspaceName);
|
|
128
|
+
await this.deleteWorkspaceByName(workspaceName);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
// stop all run workspaces in the namespace
|
|
132
132
|
public async stopAllRunningWorkspaces(namespace: string) {
|
|
133
133
|
Logger.debug('TestWorkspaceUtil.stopAllRunProjects');
|
|
134
|
-
let response = await this.processRequestHandler.get(this.apiUrlResolver.getWorkspacesApiUrl(
|
|
134
|
+
let response = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspacesApiUrl());
|
|
135
135
|
for (let i = 0; i < response.data.items.length; i++) {
|
|
136
136
|
Logger.info('The project is being stopped: ' + response.data.items[i].metadata.name);
|
|
137
|
-
await this.stopWorkspaceByName(
|
|
137
|
+
await this.stopWorkspaceByName(response.data.items[i].metadata.name);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
// stop all run workspaces, check statused and remove the workspaces
|
|
142
142
|
public async stopAndDeleteAllRunningWorkspaces(namespace: string) {
|
|
143
143
|
Logger.debug('TestWorkspaceUtil.stopAndDeleteAllRunProjects');
|
|
144
|
-
let response = await this.processRequestHandler.get(this.apiUrlResolver.getWorkspacesApiUrl(
|
|
144
|
+
let response = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspacesApiUrl());
|
|
145
145
|
await this.stopAllRunningWorkspaces(namespace);
|
|
146
146
|
for (let i = 0; i < response.data.items.length; i++) {
|
|
147
147
|
Logger.info('The project is being deleted: ' + response.data.items[i].metadata.name);
|
|
148
|
-
await this.deleteWorkspaceByName(
|
|
148
|
+
await this.deleteWorkspaceByName(response.data.items[i].metadata.name);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -153,11 +153,11 @@ export class TestWorkspaceUtil {
|
|
|
153
153
|
// similar with 'force' deleting
|
|
154
154
|
public async deleteAllWorkspaces(namespace: string) {
|
|
155
155
|
Logger.debug('TestWorkspaceUtil.deleteAllRunProjects');
|
|
156
|
-
let response = await this.processRequestHandler.get(this.apiUrlResolver.getWorkspacesApiUrl(
|
|
156
|
+
let response = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspacesApiUrl());
|
|
157
157
|
|
|
158
158
|
for (let i = 0; i < response.data.items.length; i++) {
|
|
159
159
|
Logger.info('The project is being deleted .......: ' + response.data.items[i].metadata.name);
|
|
160
|
-
await this.deleteWorkspaceByName(
|
|
160
|
+
await this.deleteWorkspaceByName(response.data.items[i].metadata.name);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -167,7 +167,7 @@ export class TestWorkspaceUtil {
|
|
|
167
167
|
public async waitPluginAdding(namespace: string, workspaceName: string, pluginName: string) {
|
|
168
168
|
Logger.debug('TestWorkspaceUtil.waitPluginAdding');
|
|
169
169
|
|
|
170
|
-
const workspaceStatusApiUrl: string = `${
|
|
170
|
+
const workspaceStatusApiUrl: string = `${await this.apiUrlResolver.getWorkspacesApiUrl()}/${namespace}:${workspaceName}`;
|
|
171
171
|
const attempts: number = TestConstants.TS_SELENIUM_PLUGIN_PRECENCE_ATTEMPTS;
|
|
172
172
|
const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
173
173
|
|
|
@@ -200,7 +200,7 @@ export class TestWorkspaceUtil {
|
|
|
200
200
|
public async getListOfWorkspaceId(): Promise<string[]> {
|
|
201
201
|
Logger.debug('TestWorkspaceUtil.getListOfWorkspaceId');
|
|
202
202
|
|
|
203
|
-
const getAllWorkspacesResponse = await this.processRequestHandler.get(
|
|
203
|
+
const getAllWorkspacesResponse = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspacesApiUrl());
|
|
204
204
|
|
|
205
205
|
interface IMyObj {
|
|
206
206
|
id: string;
|
|
@@ -224,7 +224,7 @@ export class TestWorkspaceUtil {
|
|
|
224
224
|
public async getIdOfRunningWorkspace(wsName: string): Promise<string> {
|
|
225
225
|
Logger.debug('TestWorkspaceUtil.getIdOfRunningWorkspace');
|
|
226
226
|
|
|
227
|
-
const getWorkspacesByNameResponse = await this.processRequestHandler.get(`${
|
|
227
|
+
const getWorkspacesByNameResponse = await this.processRequestHandler.get(`${await this.apiUrlResolver.getWorkspacesApiUrl()}/:${wsName}`);
|
|
228
228
|
return getWorkspacesByNameResponse.data.id;
|
|
229
229
|
|
|
230
230
|
}
|
|
@@ -236,7 +236,7 @@ export class TestWorkspaceUtil {
|
|
|
236
236
|
Logger.debug('TestWorkspaceUtil.getIdOfRunningWorkspaces');
|
|
237
237
|
|
|
238
238
|
try {
|
|
239
|
-
const getAllWorkspacesResponse = await this.processRequestHandler.get(
|
|
239
|
+
const getAllWorkspacesResponse = await this.processRequestHandler.get(await this.apiUrlResolver.getWorkspacesApiUrl());
|
|
240
240
|
|
|
241
241
|
interface IMyObj {
|
|
242
242
|
id: string;
|
|
@@ -254,7 +254,7 @@ export class TestWorkspaceUtil {
|
|
|
254
254
|
|
|
255
255
|
return idOfRunningWorkspace;
|
|
256
256
|
} catch (err) {
|
|
257
|
-
console.log(`Getting id of running workspaces failed. URL used: ${
|
|
257
|
+
console.log(`Getting id of running workspaces failed. URL used: ${await this.apiUrlResolver.getWorkspacesApiUrl()}`);
|
|
258
258
|
throw err;
|
|
259
259
|
}
|
|
260
260
|
}
|
|
@@ -265,7 +265,7 @@ export class TestWorkspaceUtil {
|
|
|
265
265
|
public async removeWorkspaceById(id: string) {
|
|
266
266
|
Logger.debug('TestWorkspaceUtil.removeWorkspaceById');
|
|
267
267
|
|
|
268
|
-
const workspaceIdUrl: string = `${
|
|
268
|
+
const workspaceIdUrl: string = `${await this.apiUrlResolver.getWorkspacesApiUrl()}/${id}`;
|
|
269
269
|
try {
|
|
270
270
|
const deleteWorkspaceResponse = await this.processRequestHandler.delete(workspaceIdUrl);
|
|
271
271
|
if (deleteWorkspaceResponse.status !== 204) {
|
|
@@ -283,7 +283,7 @@ export class TestWorkspaceUtil {
|
|
|
283
283
|
public async stopWorkspaceById(id: string) {
|
|
284
284
|
Logger.debug('TestWorkspaceUtil.stopWorkspaceById');
|
|
285
285
|
|
|
286
|
-
const stopWorkspaceApiUrl: string = `${
|
|
286
|
+
const stopWorkspaceApiUrl: string = `${await this.apiUrlResolver.getWorkspacesApiUrl()}/${id}`;
|
|
287
287
|
let stopWorkspaceResponse;
|
|
288
288
|
|
|
289
289
|
try {
|
|
@@ -338,16 +338,16 @@ export class TestWorkspaceUtil {
|
|
|
338
338
|
*/
|
|
339
339
|
public async cleanUpRunningWorkspace(workspaceName: string) {
|
|
340
340
|
if (workspaceName === undefined || workspaceName.length === 0) {
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
Logger.warn(`Could nod delete workspace because workspaceName is undefined or empty`);
|
|
342
|
+
return;
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
Logger.debug(`TestWorkspaceUtil.cleanUpRunningWorkspace ${workspaceName}`);
|
|
346
346
|
const workspaceID: string = await this.getIdOfRunningWorkspace(workspaceName);
|
|
347
347
|
|
|
348
348
|
if (workspaceID === undefined || workspaceID.length === 0) {
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
Logger.error(`Could nod delete workspace with name ${workspaceName} because workspaceID is undefined or empty`);
|
|
350
|
+
return;
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
Logger.trace(`TestWorkspaceUtil.cleanUpRunningWorkspace Stopping workspace:${workspaceName} with ID:${workspaceID}`);
|
|
@@ -363,7 +363,7 @@ export class TestWorkspaceUtil {
|
|
|
363
363
|
Logger.debug('TestWorkspaceUtil.createWsFromDevFile');
|
|
364
364
|
|
|
365
365
|
try {
|
|
366
|
-
await this.processRequestHandler.post(
|
|
366
|
+
await this.processRequestHandler.post(await this.apiUrlResolver.getWorkspacesApiUrl() + '/devfile', customTemplate);
|
|
367
367
|
} catch (error) {
|
|
368
368
|
console.error(error);
|
|
369
369
|
throw error;
|
|
@@ -393,7 +393,7 @@ export class TestWorkspaceUtil {
|
|
|
393
393
|
Logger.debug('TestWorkspaceUtil.startWorkspace');
|
|
394
394
|
|
|
395
395
|
try {
|
|
396
|
-
await this.processRequestHandler.post(`${
|
|
396
|
+
await this.processRequestHandler.post(`${await this.apiUrlResolver.getWorkspacesApiUrl()}/${workspaceId}/runtime`);
|
|
397
397
|
} catch (error) {
|
|
398
398
|
console.error(error);
|
|
399
399
|
throw error;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IApiUrlResolver.js","sourceRoot":"","sources":["../../../utils/workspace/IApiUrlResolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;wEAQwE"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*********************************************************************
|
|
2
|
-
* Copyright (c) 2019 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
|
-
export interface IApiUrlResolver {
|
|
12
|
-
getWorkspaceApiUrl(namespace: string, workspacename: string): string;
|
|
13
|
-
getWorkspacesApiUrl(namespace: string): string;
|
|
14
|
-
|
|
15
|
-
}
|