Skip to content

Commit

Permalink
fix: missed await
Browse files Browse the repository at this point in the history
Signed-off-by: mdolhalo <[email protected]>
  • Loading branch information
mdolhalo committed Oct 30, 2023
1 parent 8c8ca99 commit 492fe05
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class WorkspaceDetails {

await this.clickOnOpenButton(timeout);
await this.testProjectAndFileCheCode.waitWorkspaceReadinessForCheCodeEditor();
this.testWorkspaceUtil.waitWorkspaceStatus(workspaceName, WorkspaceStatus.STARTING);
await this.testWorkspaceUtil.waitWorkspaceStatus(workspaceName, WorkspaceStatus.STARTING);
}

async waitTabsPresence(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
Expand Down
24 changes: 12 additions & 12 deletions tests/e2e/specs/MochaHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,29 +114,29 @@ exports.mochaHooks = {
}
},
// stop and remove running workspace
function deleteWorkspaceOnFailedTest(this: Mocha.Context): void {
async function deleteWorkspaceOnFailedTest(this: Mocha.Context): Promise<void> {
if (this.currentTest?.state === 'failed') {
if (BASE_TEST_CONSTANTS.DELETE_WORKSPACE_ON_FAILED_TEST) {
Logger.info('Property DELETE_WORKSPACE_ON_FAILED_TEST is true - trying to stop and delete running workspace with API.');
const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
testWorkspaceUtil.stopAndDeleteWorkspaceByName(latestWorkspace);
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(latestWorkspace);
}
}
}
],
afterAll: [
// stop and remove running workspace
function deleteAllWorkspacesOnFinish(): void {
if (BASE_TEST_CONSTANTS.DELETE_ALL_WORKSPACES_ON_RUN_FINISH) {
Logger.info(
'Property DELETE_WORKSPACE_ON_FAILED_TEST is true - trying to stop and delete all running workspace after test run with API.'
);
const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
try {
testWorkspaceUtil.stopAndDeleteAllRunningWorkspaces();
} catch (e) {
Logger.trace('Running workspaces not found');
async function deleteAllWorkspacesOnFinish(): Promise<void> {
try {
if (BASE_TEST_CONSTANTS.DELETE_ALL_WORKSPACES_ON_RUN_FINISH) {
Logger.info(
'Property DELETE_WORKSPACE_ON_FAILED_TEST is true - trying to stop and delete all running workspace after test run with API.'
);
const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
await testWorkspaceUtil.stopAndDeleteAllRunningWorkspaces();
}
} catch (e) {
Logger.trace('Running workspaces not found');
}
},
async function stopTheDriver(): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/dashboard-samples/EmptyWorkspace.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ suite(`${stackName} test ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function ():
await browserTabsUtil.closeAllTabsExceptCurrent();
});

suiteTeardown('Stop and delete the workspace by API', function (): void {
testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
suiteTeardown('Stop and delete the workspace by API', async function (): Promise<void> {
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
});

suiteTeardown('Unregister running workspace', function (): void {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/dashboard-samples/Quarkus.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ suite(`The ${stackName} userstory ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, func
await browserTabsUtil.closeAllTabsExceptCurrent();
});

suiteTeardown('Stop and delete the workspace by API', function (): void {
testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
suiteTeardown('Stop and delete the workspace by API', async function (): Promise<void> {
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
});

suiteTeardown('Unregister running workspace', function (): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ for (const sample of samples) {
await browserTabsUtil.closeAllTabsExceptCurrent();
});

suiteTeardown('Stop and delete the workspace by API', function (): void {
testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
suiteTeardown('Stop and delete the workspace by API', async function (): Promise<void> {
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
});

suiteTeardown('Unregister running workspace', function (): void {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/factory/Factory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ suite(
await browserTabsUtil.closeAllTabsExceptCurrent();
});

suiteTeardown('Stop and delete the workspace by API', function (): void {
testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
suiteTeardown('Stop and delete the workspace by API', async function (): Promise<void> {
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
});

suiteTeardown('Unregister running workspace', function (): void {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ suite(
await browserTabsUtil.closeAllTabsExceptCurrent();
});

suiteTeardown('Stop and delete the workspace by API', function (): void {
testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
suiteTeardown('Stop and delete the workspace by API', async function (): Promise<void> {
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
});
}

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ suite(
await browserTabsUtil.closeAllTabsExceptCurrent();
});

suiteTeardown('Stop and delete the workspace by API', function (): void {
testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
suiteTeardown('Stop and delete the workspace by API', async function (): Promise<void> {
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
});

suiteTeardown('Unregister running workspace', function (): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ suite(`"Start workspace with existed workspace name" test ${BASE_TEST_CONSTANTS.
await browserTabsUtil.closeAllTabsExceptCurrent();
});

suiteTeardown(`Stop and delete all created ${stackName} workspaces by API`, function (): void {
testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
testWorkspaceUtil.stopAndDeleteWorkspaceByName(existedWorkspaceName);
suiteTeardown(`Stop and delete all created ${stackName} workspaces by API`, async function (): Promise<void> {
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(existedWorkspaceName);
});

suiteTeardown('Unregister running workspace', function (): void {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/miscellaneous/KubedockPodmanTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ suite(
await browserTabsUtil.closeAllTabsExceptCurrent();
});

suiteTeardown('Stop and delete the workspace by API', function (): void {
testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
suiteTeardown('Stop and delete the workspace by API', async function (): Promise<void> {
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
});

suiteTeardown('Unregister running workspace', function (): void {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/miscellaneous/WorkspaceIdleTimeout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ suite('"Check workspace idle timeout" test', function (): void {
await browserTabsUtil.closeAllTabsExceptCurrent();
});

suiteTeardown('Stop and delete the workspace by API', function (): void {
testWorkspaceUtil.deleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
suiteTeardown('Stop and delete the workspace by API', async function (): Promise<void> {
await testWorkspaceUtil.deleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
});

suiteTeardown('Unregister running workspace', function (): void {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/miscellaneous/WorkspaceWithParent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ suite(`Workspace using a parent test suite ${BASE_TEST_CONSTANTS.TEST_ENVIRONMEN
suiteTeardown('Stop and delete the workspace by API', async function (): Promise<void> {
await dashboard.openDashboard();
await browserTabsUtil.closeAllTabsExceptCurrent();
testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(WorkspaceHandlingTests.getWorkspaceName());
});

suiteTeardown('Unregister running workspace', function (): void {
Expand Down
14 changes: 7 additions & 7 deletions tests/e2e/utils/workspace/ITestWorkspaceUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@
import { WorkspaceStatus } from './WorkspaceStatus';

export interface ITestWorkspaceUtil {
waitWorkspaceStatus(workspaceName: string, expectedWorkspaceStatus: WorkspaceStatus): void;
waitWorkspaceStatus(workspaceName: string, expectedWorkspaceStatus: WorkspaceStatus): Promise<void>;

stopWorkspaceByName(workspaceName: string): void;
stopWorkspaceByName(workspaceName: string): Promise<void>;

/**
* delete a workspace without stopping phase (similar with force deleting)
*/
deleteWorkspaceByName(workspaceName: string): void;
deleteWorkspaceByName(workspaceName: string): Promise<void>;

/**
* stop workspace before deleting with checking stopping phase
*/
stopAndDeleteWorkspaceByName(workspaceName: string): void;
stopAndDeleteWorkspaceByName(workspaceName: string): Promise<void>;

/**
* stop all run workspaces in the namespace
*/
stopAllRunningWorkspaces(): void;
stopAllRunningWorkspaces(): Promise<void>;

/**
* stop all run workspaces, check statused and remove the workspaces
*/
stopAndDeleteAllRunningWorkspaces(): void;
stopAndDeleteAllRunningWorkspaces(): Promise<void>;

/**
* stop all run workspaces without stopping and waiting for of 'Stopped' phase
* Similar with 'force' deleting
*/
deleteAllWorkspaces(): void;
deleteAllWorkspaces(): Promise<void>;
}

0 comments on commit 492fe05

Please sign in to comment.