提交 eec2a015 编写于 作者: S Sandeep Somavarapu

fix commented tests

上级 96903e33
...@@ -1443,17 +1443,17 @@ suite('WorkspaceConfigurationService - Remote Folder', () => { ...@@ -1443,17 +1443,17 @@ suite('WorkspaceConfigurationService - Remote Folder', () => {
'id': '_test', 'id': '_test',
'type': 'object', 'type': 'object',
'properties': { 'properties': {
'configurationService.folder.applicationSetting': { 'configurationService.remote.applicationSetting': {
'type': 'string', 'type': 'string',
'default': 'isSet', 'default': 'isSet',
scope: ConfigurationScope.APPLICATION scope: ConfigurationScope.APPLICATION
}, },
'configurationService.folder.machineSetting': { 'configurationService.remote.machineSetting': {
'type': 'string', 'type': 'string',
'default': 'isSet', 'default': 'isSet',
scope: ConfigurationScope.MACHINE scope: ConfigurationScope.MACHINE
}, },
'configurationService.folder.testSetting': { 'configurationService.remote.testSetting': {
'type': 'string', 'type': 'string',
'default': 'isSet', 'default': 'isSet',
scope: ConfigurationScope.RESOURCE scope: ConfigurationScope.RESOURCE
...@@ -1495,10 +1495,19 @@ suite('WorkspaceConfigurationService - Remote Folder', () => { ...@@ -1495,10 +1495,19 @@ suite('WorkspaceConfigurationService - Remote Folder', () => {
testObject.acquireInstantiationService(instantiationService); testObject.acquireInstantiationService(instantiationService);
} }
function registerRemtoeFileSystemProvider(): void { function registerRemoteFileSystemProvider(): void {
instantiationService.get(IFileService).registerProvider(Schemas.vscodeRemote, new RemoteFileSystemProvider(diskFileSystemProvider, remoteAuthority)); instantiationService.get(IFileService).registerProvider(Schemas.vscodeRemote, new RemoteFileSystemProvider(diskFileSystemProvider, remoteAuthority));
} }
function registerRemoteFileSystemProviderOnActivation(): void {
const disposable = instantiationService.get(IFileService).onWillActivateFileSystemProvider(e => {
if (e.scheme === Schemas.vscodeRemote) {
disposable.dispose();
e.join(Promise.resolve().then(() => registerRemoteFileSystemProvider()));
}
});
}
teardown(() => { teardown(() => {
if (testObject) { if (testObject) {
(<WorkspaceService>testObject).dispose(); (<WorkspaceService>testObject).dispose();
...@@ -1510,65 +1519,51 @@ suite('WorkspaceConfigurationService - Remote Folder', () => { ...@@ -1510,65 +1519,51 @@ suite('WorkspaceConfigurationService - Remote Folder', () => {
}); });
test('remote settings override globals', async () => { test('remote settings override globals', async () => {
fs.writeFileSync(remoteSettingsFile, '{ "configurationService.folder.machineSetting": "remoteValue" }'); fs.writeFileSync(remoteSettingsFile, '{ "configurationService.remote.machineSetting": "remoteValue" }');
registerRemtoeFileSystemProvider(); registerRemoteFileSystemProvider();
resolveRemoteEnvironment(); resolveRemoteEnvironment();
await initialize(); await initialize();
assert.equal(testObject.getValue('configurationService.folder.machineSetting'), 'remoteValue'); assert.equal(testObject.getValue('configurationService.remote.machineSetting'), 'remoteValue');
}); });
test('remote settings override globals after remote environment is resolved', async () => { test('remote settings override globals after remote provider is registered on activation', async () => {
fs.writeFileSync(remoteSettingsFile, '{ "configurationService.folder.machineSetting": "remoteValue" }'); fs.writeFileSync(remoteSettingsFile, '{ "configurationService.remote.machineSetting": "remoteValue" }');
registerRemtoeFileSystemProvider();
await initialize();
const promise = new Promise((c, e) => {
testObject.onDidChangeConfiguration(event => {
try {
assert.equal(event.source, ConfigurationTarget.USER);
assert.deepEqual(event.affectedKeys, ['configurationService.folder.machineSetting']);
assert.equal(testObject.getValue('configurationService.folder.machineSetting'), 'remoteValue');
c();
} catch (error) {
e(error);
}
});
});
resolveRemoteEnvironment(); resolveRemoteEnvironment();
return promise; registerRemoteFileSystemProviderOnActivation();
await initialize();
assert.equal(testObject.getValue('configurationService.remote.machineSetting'), 'remoteValue');
}); });
/* test('remote settings override globals after remote environment is resolved', async () => {
// comment this test as it is failing fs.writeFileSync(remoteSettingsFile, '{ "configurationService.remote.machineSetting": "remoteValue" }');
test('remote settings override globals after remote provider is registered', async () => { registerRemoteFileSystemProvider();
fs.writeFileSync(remoteSettingsFile, '{ "configurationService.folder.machineSetting": "remoteValue" }');
resolveRemoteEnvironment();
await initialize(); await initialize();
const promise = new Promise((c, e) => { const promise = new Promise((c, e) => {
testObject.onDidChangeConfiguration(event => { testObject.onDidChangeConfiguration(event => {
try { try {
assert.equal(event.source, ConfigurationTarget.USER); assert.equal(event.source, ConfigurationTarget.USER);
assert.deepEqual(event.affectedKeys, ['configurationService.folder.machineSetting']); assert.deepEqual(event.affectedKeys, ['configurationService.remote.machineSetting']);
assert.equal(testObject.getValue('configurationService.folder.machineSetting'), 'remoteValue'); assert.equal(testObject.getValue('configurationService.remote.machineSetting'), 'remoteValue');
c(); c();
} catch (error) { } catch (error) {
e(error); e(error);
} }
}); });
}); });
registerRemtoeFileSystemProvider(); resolveRemoteEnvironment();
return promise; return promise;
}); });
*/
test('remote settings override globals after remote provider is registered and remote environment is resolved', async () => { test('remote settings override globals after remote provider is registered on activation and remote environment is resolved', async () => {
fs.writeFileSync(remoteSettingsFile, '{ "configurationService.folder.machineSetting": "remoteValue" }'); fs.writeFileSync(remoteSettingsFile, '{ "configurationService.remote.machineSetting": "remoteValue" }');
registerRemoteFileSystemProviderOnActivation();
await initialize(); await initialize();
const promise = new Promise((c, e) => { const promise = new Promise((c, e) => {
testObject.onDidChangeConfiguration(event => { testObject.onDidChangeConfiguration(event => {
try { try {
assert.equal(event.source, ConfigurationTarget.USER); assert.equal(event.source, ConfigurationTarget.USER);
assert.deepEqual(event.affectedKeys, ['configurationService.folder.machineSetting']); assert.deepEqual(event.affectedKeys, ['configurationService.remote.machineSetting']);
assert.equal(testObject.getValue('configurationService.folder.machineSetting'), 'remoteValue'); assert.equal(testObject.getValue('configurationService.remote.machineSetting'), 'remoteValue');
c(); c();
} catch (error) { } catch (error) {
e(error); e(error);
...@@ -1576,28 +1571,27 @@ suite('WorkspaceConfigurationService - Remote Folder', () => { ...@@ -1576,28 +1571,27 @@ suite('WorkspaceConfigurationService - Remote Folder', () => {
}); });
}); });
resolveRemoteEnvironment(); resolveRemoteEnvironment();
registerRemtoeFileSystemProvider();
return promise; return promise;
}); });
test('update remote settings', async () => { test('update remote settings', async () => {
registerRemtoeFileSystemProvider(); registerRemoteFileSystemProvider();
resolveRemoteEnvironment(); resolveRemoteEnvironment();
await initialize(); await initialize();
assert.equal(testObject.getValue('configurationService.folder.machineSetting'), 'isSet'); assert.equal(testObject.getValue('configurationService.remote.machineSetting'), 'isSet');
const promise = new Promise((c, e) => { const promise = new Promise((c, e) => {
testObject.onDidChangeConfiguration(event => { testObject.onDidChangeConfiguration(event => {
try { try {
assert.equal(event.source, ConfigurationTarget.USER); assert.equal(event.source, ConfigurationTarget.USER);
assert.deepEqual(event.affectedKeys, ['configurationService.folder.machineSetting']); assert.deepEqual(event.affectedKeys, ['configurationService.remote.machineSetting']);
assert.equal(testObject.getValue('configurationService.folder.machineSetting'), 'remoteValue'); assert.equal(testObject.getValue('configurationService.remote.machineSetting'), 'remoteValue');
c(); c();
} catch (error) { } catch (error) {
e(error); e(error);
} }
}); });
}); });
fs.writeFileSync(remoteSettingsFile, '{ "configurationService.folder.machineSetting": "remoteValue" }'); fs.writeFileSync(remoteSettingsFile, '{ "configurationService.remote.machineSetting": "remoteValue" }');
return promise; return promise;
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册