From e43293e5242e74ac365cff737ec408d31a40ff21 Mon Sep 17 00:00:00 2001 From: Artem Zatsarynnyi Date: Tue, 3 May 2022 16:23:50 +0200 Subject: [PATCH 1/4] fix: prevent overwriting the DevWorkspace in-cluster object by a flattened Devfile Signed-off-by: Artem Zatsarynnyi --- plugins/workspace-plugin/src/workspace-projects-manager.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/workspace-plugin/src/workspace-projects-manager.ts b/plugins/workspace-plugin/src/workspace-projects-manager.ts index b0b41b0d0..714396b81 100644 --- a/plugins/workspace-plugin/src/workspace-projects-manager.ts +++ b/plugins/workspace-plugin/src/workspace-projects-manager.ts @@ -80,8 +80,11 @@ export class WorkspaceProjectsManager { } } - await this.watchWorkspaceProjects(); - await this.watchMultiRootProjects(); + // Quick fix for https://github.com/eclipse/che/issues/21244 + // Considering 99% of the workspaces are single-project, + // there is no need to update the Devfile automatically. + // await this.watchWorkspaceProjects(); + // await this.watchMultiRootProjects(); } async buildCloneCommands(projects: che.devfile.DevfileProject[]): Promise { From 5208feef6b4bd7e61f4fe4a6c24fc08f3c8ec1e5 Mon Sep 17 00:00:00 2001 From: Artem Zatsarynnyi Date: Tue, 3 May 2022 17:42:52 +0200 Subject: [PATCH 2/4] update tests Signed-off-by: Artem Zatsarynnyi --- .../tests/workspace-projects-manager.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/workspace-plugin/tests/workspace-projects-manager.spec.ts b/plugins/workspace-plugin/tests/workspace-projects-manager.spec.ts index 97e41cc09..233fb75b1 100644 --- a/plugins/workspace-plugin/tests/workspace-projects-manager.spec.ts +++ b/plugins/workspace-plugin/tests/workspace-projects-manager.spec.ts @@ -372,7 +372,7 @@ describe('Test Workspace Projects Manager', () => { await fireFileSystemChangedEvent(PROJECTS_ROOT, 'create', 'test-project-to-add'); - expect(addWorkspaceFolderMock).toBeCalledTimes(1); + expect(addWorkspaceFolderMock).toBeCalledTimes(0); expect(removeWorkspaceFolderMock).toBeCalledTimes(0); expect(onProjectChangedSpy).toBeCalledTimes(1); @@ -407,7 +407,7 @@ describe('Test Workspace Projects Manager', () => { await fireFileSystemChangedEvent(PROJECTS_ROOT, 'create', 'test-project-to-add'); - expect(addWorkspaceFolderMock).toBeCalledTimes(1); + expect(addWorkspaceFolderMock).toBeCalledTimes(0); expect(removeWorkspaceFolderMock).toBeCalledTimes(0); expect(onProjectChangedSpy).toBeCalledTimes(1); @@ -441,7 +441,7 @@ describe('Test Workspace Projects Manager', () => { await fireFileSystemChangedEvent(PROJECTS_ROOT, 'create', 'test-project-to-add'); expect(addWorkspaceFolderMock).toBeCalledTimes(0); - expect(removeWorkspaceFolderMock).toBeCalledTimes(1); + expect(removeWorkspaceFolderMock).toBeCalledTimes(0); expect(onProjectChangedSpy).toBeCalledTimes(0); expect(onProjectRemovedSpy).toBeCalledTimes(1); From 5b8d71d72a515042fd8f14a7e5e606f2a39611f7 Mon Sep 17 00:00:00 2001 From: Artem Zatsarynnyi Date: Tue, 3 May 2022 17:59:11 +0200 Subject: [PATCH 3/4] update tests Signed-off-by: Artem Zatsarynnyi --- .../tests/workspace-projects-manager.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/workspace-plugin/tests/workspace-projects-manager.spec.ts b/plugins/workspace-plugin/tests/workspace-projects-manager.spec.ts index 233fb75b1..4794c713f 100644 --- a/plugins/workspace-plugin/tests/workspace-projects-manager.spec.ts +++ b/plugins/workspace-plugin/tests/workspace-projects-manager.spec.ts @@ -375,7 +375,7 @@ describe('Test Workspace Projects Manager', () => { expect(addWorkspaceFolderMock).toBeCalledTimes(0); expect(removeWorkspaceFolderMock).toBeCalledTimes(0); - expect(onProjectChangedSpy).toBeCalledTimes(1); + expect(onProjectChangedSpy).toBeCalledTimes(0); expect(onProjectRemovedSpy).toBeCalledTimes(0); expect(updateProjectMock).toBeCalledTimes(1); @@ -410,7 +410,7 @@ describe('Test Workspace Projects Manager', () => { expect(addWorkspaceFolderMock).toBeCalledTimes(0); expect(removeWorkspaceFolderMock).toBeCalledTimes(0); - expect(onProjectChangedSpy).toBeCalledTimes(1); + expect(onProjectChangedSpy).toBeCalledTimes(0); expect(onProjectRemovedSpy).toBeCalledTimes(0); expect(updateProjectMock).toBeCalledTimes(0); @@ -444,10 +444,10 @@ describe('Test Workspace Projects Manager', () => { expect(removeWorkspaceFolderMock).toBeCalledTimes(0); expect(onProjectChangedSpy).toBeCalledTimes(0); - expect(onProjectRemovedSpy).toBeCalledTimes(1); + expect(onProjectRemovedSpy).toBeCalledTimes(0); expect(updateProjectMock).toBeCalledTimes(0); - expect(deleteProjectMock).toBeCalledTimes(1); + expect(deleteProjectMock).toBeCalledTimes(0); }); test('test rejecting in workspaceProjectsManager.onProjectChanged for non-git project', async () => { From 1bcd7b78ca20beb55d03c54270ab4629c2792430 Mon Sep 17 00:00:00 2001 From: Artem Zatsarynnyi Date: Tue, 3 May 2022 18:15:43 +0200 Subject: [PATCH 4/4] update tests Signed-off-by: Artem Zatsarynnyi --- .../workspace-plugin/tests/workspace-projects-manager.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/workspace-plugin/tests/workspace-projects-manager.spec.ts b/plugins/workspace-plugin/tests/workspace-projects-manager.spec.ts index 4794c713f..873c322ed 100644 --- a/plugins/workspace-plugin/tests/workspace-projects-manager.spec.ts +++ b/plugins/workspace-plugin/tests/workspace-projects-manager.spec.ts @@ -378,7 +378,7 @@ describe('Test Workspace Projects Manager', () => { expect(onProjectChangedSpy).toBeCalledTimes(0); expect(onProjectRemovedSpy).toBeCalledTimes(0); - expect(updateProjectMock).toBeCalledTimes(1); + expect(updateProjectMock).toBeCalledTimes(0); expect(deleteProjectMock).toBeCalledTimes(0); });