Skip to content

Commit

Permalink
Merge branch 'develop' into fix-elb-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
maghirardelli authored Dec 20, 2021
2 parents 492bea4 + f222f06 commit 1e11b13
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ describe('Launch a workspace', () => {
_.forEach(workspaceNames, workspaceName => {
checkWorkspaceAvailable(workspaceName);
});
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(3000);
terminateWorkspaces();
});

// Do RStudio create first as we need to test when this becomes available as well
it('should launch a new RStudio Server workspace correctly', () => {
// eslint-disable-next-line cypress/no-unnecessary-waiting
const workspaces = Cypress.env('workspaces');
const rstudioServer = workspaces.rstudioServer;
const workspaceName = launchWorkspace(rstudioServer, 'RStudio-Server');
Expand Down
2 changes: 2 additions & 0 deletions main/end-to-end-tests/cypress/support/workspace-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ function terminateWorkspaces() {
cy.get('.modals')
.contains('Terminate')
.click();
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(3000);
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Launch and terminate RStudio instance', () => {
let adminSession;

beforeEach(async () => {
await terminateAllRStudioWorkspacesInCompletedState();
await terminateAllRStudioWorkspaces();
await checkAllRstudioWorkspaceIsTerminated();
});

Expand Down Expand Up @@ -67,18 +67,18 @@ describe('Launch and terminate RStudio instance', () => {
}
}

async function terminateAllRStudioWorkspacesInCompletedState() {
async function terminateAllRStudioWorkspaces() {
const response = await adminSession.resources.workspaceServiceCatalogs.get();
const rstudioEnvTypeId = setup.defaults.envTypes.rstudio.envTypeId;
const workspacesInAvailableState = response.filter(workspace => {
return workspace.envTypeId === rstudioEnvTypeId && workspace.status === 'COMPLETED';
const nonTerminatedWorkspaces = response.filter(workspace => {
return workspace.envTypeId === rstudioEnvTypeId && ['COMPLETED', 'STOPPED'].includes(workspace.status);
});
console.log('COMPLETED (Available) workspaces', workspacesInAvailableState);
for (let i = 0; i < workspacesInAvailableState.length; i += 1) {
console.log(`Terminating ${workspacesInAvailableState[i].id}`);
console.log('Non Terminated workspaces', nonTerminatedWorkspaces);
for (let i = 0; i < nonTerminatedWorkspaces.length; i += 1) {
console.log(`Terminating ${nonTerminatedWorkspaces[i].id}`);
// eslint-disable-next-line no-await-in-loop
await adminSession.resources.workspaceServiceCatalogs
.workspaceServiceCatalog(workspacesInAvailableState[i].id)
.workspaceServiceCatalog(nonTerminatedWorkspaces[i].id)
.delete();
}
}
Expand Down

0 comments on commit 1e11b13

Please sign in to comment.