From 08e6c5d09efb2c294dca2adc40e880cdc2d8ca74 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Wed, 4 Oct 2017 21:20:41 +0200 Subject: [PATCH] disable updates in smoketests --- src/vs/platform/environment/common/environment.ts | 2 ++ src/vs/platform/environment/node/argv.ts | 3 ++- src/vs/platform/environment/node/environmentService.ts | 2 ++ src/vs/platform/update/electron-main/updateService.ts | 8 +++++++- test/smoke/src/spectron/application.ts | 5 ++++- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts index dad4ea1cc5f2a..2dd0c004b8746 100644 --- a/src/vs/platform/environment/common/environment.ts +++ b/src/vs/platform/environment/common/environment.ts @@ -44,6 +44,7 @@ export interface ParsedArgs { 'disable-telemetry'?: boolean; 'export-default-configuration'?: string; 'install-source'?: string; + 'disable-updates'?: string; } export const IEnvironmentService = createDecorator('environmentService'); @@ -106,4 +107,5 @@ export interface IEnvironmentService { nodeCachedDataDir: string; installSource: string; + disableUpdates: boolean; } diff --git a/src/vs/platform/environment/node/argv.ts b/src/vs/platform/environment/node/argv.ts index 2396982a61fa0..b82511d8c71a2 100644 --- a/src/vs/platform/environment/node/argv.ts +++ b/src/vs/platform/environment/node/argv.ts @@ -50,7 +50,8 @@ const options: minimist.Opts = { 'nolazy', 'skip-getting-started', 'sticky-quickopen', - 'disable-telemetry' + 'disable-telemetry', + 'disable-updates' ], alias: { add: 'a', diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts index 0270370c755dc..f5637497e53ea 100644 --- a/src/vs/platform/environment/node/environmentService.ts +++ b/src/vs/platform/environment/node/environmentService.ts @@ -125,6 +125,8 @@ export class EnvironmentService implements IEnvironmentService { @memoize get nodeCachedDataDir(): string { return this.isBuilt ? path.join(this.userDataPath, 'CachedData', product.commit || new Array(41).join('0')) : undefined; } + get disableUpdates(): boolean { return !!this._args['disable-updates']; } + readonly machineUUID: string; readonly installSource: string; diff --git a/src/vs/platform/update/electron-main/updateService.ts b/src/vs/platform/update/electron-main/updateService.ts index 70571cda7ab6a..2dbdbbf6d1ce1 100644 --- a/src/vs/platform/update/electron-main/updateService.ts +++ b/src/vs/platform/update/electron-main/updateService.ts @@ -22,6 +22,7 @@ import product from 'vs/platform/node/product'; import { TPromise } from 'vs/base/common/winjs.base'; import { IUpdateService, State, IAutoUpdater, IUpdate, IRawUpdate } from 'vs/platform/update/common/update'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { IEnvironmentService } from 'vs/platform/environment/common/environment'; export class UpdateService implements IUpdateService { @@ -87,7 +88,8 @@ export class UpdateService implements IUpdateService { @IRequestService requestService: IRequestService, @ILifecycleService private lifecycleService: ILifecycleService, @IConfigurationService private configurationService: IConfigurationService, - @ITelemetryService private telemetryService: ITelemetryService + @ITelemetryService private telemetryService: ITelemetryService, + @IEnvironmentService private environmentService: IEnvironmentService ) { if (process.platform === 'win32') { this.raw = new Win32AutoUpdaterImpl(requestService); @@ -99,6 +101,10 @@ export class UpdateService implements IUpdateService { return; } + if (this.environmentService.disableUpdates) { + return; + } + const channel = this.getUpdateChannel(); const feedUrl = this.getUpdateFeedUrl(channel); diff --git a/test/smoke/src/spectron/application.ts b/test/smoke/src/spectron/application.ts index 77ef6fd4207a5..72ebd5a1e7ca3 100644 --- a/test/smoke/src/spectron/application.ts +++ b/test/smoke/src/spectron/application.ts @@ -127,9 +127,12 @@ export class SpectronApplication { // Prevent Quick Open from closing when focus is stolen, this allows concurrent smoketest suite running args.push('--sticky-quickopen'); - // Disable telemetry for smoke tests + // Disable telemetry args.push('--disable-telemetry'); + // Disable updates + args.push('--disable-updates'); + // Ensure that running over custom extensions directory, rather than picking up the one that was used by a tester previously args.push(`--extensions-dir=${EXTENSIONS_DIR}`);