Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dispose test instantiation service #187574

Merged
merged 2 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ class TestInstallGalleryExtensionTask extends InstallGalleryExtensionTask {
constructor(
extension: IGalleryExtension,
extensionDownloader: ExtensionsDownloader,
disposables: DisposableStore,
) {
const instantiationService = new TestInstantiationService();
const instantiationService = disposables.add(new TestInstantiationService());
const logService = instantiationService.stub(ILogService, new NullLogService());
const fileService = instantiationService.stub(IFileService, new FileService(logService));
const fileSystemProvider = new InMemoryFileSystemProvider();
Expand Down Expand Up @@ -131,7 +132,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
teardown(() => disposables.clear());

test('if verification is enabled by default, the task completes', async () => {
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: true }));
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: true }), disposables);

await testObject.run();

Expand All @@ -140,7 +141,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
});

test('if verification is enabled in stable, the task completes', async () => {
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: true, quality: 'stable' }));
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: true, quality: 'stable' }), disposables);

await testObject.run();

Expand All @@ -149,7 +150,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
});

test('if verification is disabled by setting set to false, the task skips verification', async () => {
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: false, verificationResult: 'error', didExecute: false }));
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: false, verificationResult: 'error', didExecute: false }), disposables);

await testObject.run();

Expand All @@ -158,7 +159,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
});

test('if verification is disabled because the module is not loaded, the task skips verification', async () => {
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: false, didExecute: false }));
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: false, didExecute: false }), disposables);

await testObject.run();

Expand All @@ -168,7 +169,7 @@ suite('InstallGalleryExtensionTask Tests', () => {

test('if verification fails to execute, the task completes', async () => {
const errorCode = 'ENOENT';
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: errorCode, didExecute: false }));
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: errorCode, didExecute: false }), disposables);

await testObject.run();

Expand All @@ -179,7 +180,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
test('if verification fails', async () => {
const errorCode = 'IntegrityCheckFailed';

const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: errorCode, didExecute: true }));
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: errorCode, didExecute: true }), disposables);

await testObject.run();

Expand All @@ -188,7 +189,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
});

test('if verification succeeds, the task completes', async () => {
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: true }));
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: true }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: true }), disposables);

await testObject.run();

Expand All @@ -197,7 +198,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
});

test('task completes for unsigned extension', async () => {
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: false }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: false }));
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: false }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: true, didExecute: false }), disposables);

await testObject.run();

Expand All @@ -206,7 +207,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
});

test('task completes for an unsigned extension even when signature verification throws error', async () => {
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: false }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: 'error', didExecute: true }));
const testObject = new TestInstallGalleryExtensionTask(aGalleryExtension('a', { isSigned: false }), anExtensionsDownloader({ isSignatureVerificationEnabled: true, verificationResult: 'error', didExecute: true }), disposables);

await testObject.run();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class UserDataSyncClient extends Disposable {

constructor(readonly testServer: UserDataSyncTestServer = new UserDataSyncTestServer()) {
super();
this.instantiationService = new TestInstantiationService();
this.instantiationService = this._register(new TestInstantiationService());
}

async setUp(empty: boolean = false): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
uninstallEvent = suiteDisposables.add(new Emitter<UninstallExtensionEvent>());
didUninstallEvent = suiteDisposables.add(new Emitter<DidUninstallExtensionEvent>());

instantiationService = new TestInstantiationService();
instantiationService = suiteDisposables.add(new TestInstantiationService());
instantiationService.stub(ITelemetryService, NullTelemetryService);
instantiationService.stub(ILogService, NullLogService);
instantiationService.stub(IProgressService, ProgressService);
Expand Down