Skip to content

Commit ae2bd81

Browse files
committed
Use new test config for testings currently writing to the config
1 parent b9be9cf commit ae2bd81

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

extensions/ql-vscode/src/config.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export class Setting {
3535
}
3636
return workspace.getConfiguration(this.parent.qualifiedName).update(this.name, value, target);
3737
}
38-
3938
}
4039

4140
const ROOT_SETTING = new Setting('codeQL');
@@ -338,17 +337,13 @@ export function getRemoteRepositoryLists(): Record<string, string[]> | undefined
338337
return REMOTE_REPO_LISTS.getValue<Record<string, string[]>>() || undefined;
339338
}
340339

341-
export async function setRemoteRepositoryLists(lists: Record<string, string[]> | undefined) {
342-
await REMOTE_REPO_LISTS.updateValue(lists, ConfigurationTarget.Global);
343-
}
344-
345340
/**
346-
* Path to a file that contains lists of GitHub repositories that you want to query remotely via
341+
* Path to a file that contains lists of GitHub repositories that you want to query remotely via
347342
* the "Run Variant Analysis" command.
348343
* Note: This command is only available for internal users.
349-
*
344+
*
350345
* This setting should be a path to a JSON file that contains a JSON object where each key is a
351-
* user-specified name (string), and the value is an array of GitHub repositories
346+
* user-specified name (string), and the value is an array of GitHub repositories
352347
* (of the form `<owner>/<repo>`).
353348
*/
354349
const REPO_LISTS_PATH = new Setting('repositoryListsPath', REMOTE_QUERIES_SETTING);

extensions/ql-vscode/src/vscode-tests/cli-integration/global.helper.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import * as fs from 'fs-extra';
44
import fetch from 'node-fetch';
55

66
import { fail } from 'assert';
7-
import { commands, ConfigurationTarget, extensions, workspace } from 'vscode';
7+
import { commands, extensions, workspace } from 'vscode';
88
import { CodeQLExtensionInterface } from '../../extension';
99
import { DatabaseManager } from '../../databases';
10+
import { testConfig } from '../test-config';
1011

1112
// This file contains helpers shared between actual tests.
1213

@@ -58,7 +59,7 @@ export default function(mocha: Mocha) {
5859
// Set the CLI version here before activation to ensure we don't accidentally try to download a cli
5960
(mocha.options as any).globalSetup.push(
6061
async () => {
61-
await workspace.getConfiguration().update('codeQL.cli.executablePath', process.env.CLI_PATH, ConfigurationTarget.Global);
62+
await testConfig.cliExecutablePath.setInitialTestValue(process.env.CLI_PATH);
6263
}
6364
);
6465

extensions/ql-vscode/src/vscode-tests/cli-integration/remote-queries/run-remote-query.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { QlPack, runRemoteQuery } from '../../../remote-queries/run-remote-query
1010
import { Credentials } from '../../../authentication';
1111
import { CliVersionConstraint, CodeQLCliServer } from '../../../cli';
1212
import { CodeQLExtensionInterface } from '../../../extension';
13-
import { setRemoteControllerRepo, setRemoteRepositoryLists } from '../../../config';
1413
import * as config from '../../../config';
1514
import { UserCancellationException } from '../../../commandRunner';
1615
import * as ghApiClient from '../../../remote-queries/gh-api/gh-api-client';
@@ -24,6 +23,7 @@ import { createMockApiResponse } from '../../factories/remote-queries/gh-api/var
2423
import { createMockExtensionContext } from '../../no-workspace';
2524
import { VariantAnalysisManager } from '../../../remote-queries/variant-analysis-manager';
2625
import { OutputChannelLogger } from '../../../logging';
26+
import { testConfig } from '../../test-config';
2727

2828
describe('Remote queries', function() {
2929
const baseDir = path.join(__dirname, '../../../../src/vscode-tests/cli-integration');
@@ -83,8 +83,8 @@ describe('Remote queries', function() {
8383
getRepositoryFromNwoStub = sandbox.stub(ghApiClient, 'getRepositoryFromNwo').resolves(dummyRepository);
8484

8585
// always run in the vscode-codeql repo
86-
await setRemoteControllerRepo('github/vscode-codeql');
87-
await setRemoteRepositoryLists({ 'vscode-codeql': ['github/vscode-codeql'] });
86+
await testConfig.remoteControllerRepo.set('github/vscode-codeql');
87+
await testConfig.remoteRepoLists.set({ 'vscode-codeql': ['github/vscode-codeql'] });
8888

8989
liveResultsStub = sandbox.stub(config, 'isVariantAnalysisLiveResultsEnabled').returns(false);
9090
});

0 commit comments

Comments
 (0)