Use new test config for testings currently writing to the config
This commit is contained in:
@@ -35,7 +35,6 @@ export class Setting {
|
|||||||
}
|
}
|
||||||
return workspace.getConfiguration(this.parent.qualifiedName).update(this.name, value, target);
|
return workspace.getConfiguration(this.parent.qualifiedName).update(this.name, value, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ROOT_SETTING = new Setting('codeQL');
|
const ROOT_SETTING = new Setting('codeQL');
|
||||||
@@ -338,17 +337,13 @@ export function getRemoteRepositoryLists(): Record<string, string[]> | undefined
|
|||||||
return REMOTE_REPO_LISTS.getValue<Record<string, string[]>>() || undefined;
|
return REMOTE_REPO_LISTS.getValue<Record<string, string[]>>() || undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setRemoteRepositoryLists(lists: Record<string, string[]> | undefined) {
|
|
||||||
await REMOTE_REPO_LISTS.updateValue(lists, ConfigurationTarget.Global);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Path to a file that contains lists of GitHub repositories that you want to query remotely via
|
* Path to a file that contains lists of GitHub repositories that you want to query remotely via
|
||||||
* the "Run Variant Analysis" command.
|
* the "Run Variant Analysis" command.
|
||||||
* Note: This command is only available for internal users.
|
* Note: This command is only available for internal users.
|
||||||
*
|
*
|
||||||
* This setting should be a path to a JSON file that contains a JSON object where each key is a
|
* This setting should be a path to a JSON file that contains a JSON object where each key is a
|
||||||
* user-specified name (string), and the value is an array of GitHub repositories
|
* user-specified name (string), and the value is an array of GitHub repositories
|
||||||
* (of the form `<owner>/<repo>`).
|
* (of the form `<owner>/<repo>`).
|
||||||
*/
|
*/
|
||||||
const REPO_LISTS_PATH = new Setting('repositoryListsPath', REMOTE_QUERIES_SETTING);
|
const REPO_LISTS_PATH = new Setting('repositoryListsPath', REMOTE_QUERIES_SETTING);
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import * as fs from 'fs-extra';
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
import { fail } from 'assert';
|
import { fail } from 'assert';
|
||||||
import { commands, ConfigurationTarget, extensions, workspace } from 'vscode';
|
import { commands, extensions, workspace } from 'vscode';
|
||||||
import { CodeQLExtensionInterface } from '../../extension';
|
import { CodeQLExtensionInterface } from '../../extension';
|
||||||
import { DatabaseManager } from '../../databases';
|
import { DatabaseManager } from '../../databases';
|
||||||
|
import { testConfig } from '../test-config';
|
||||||
|
|
||||||
// This file contains helpers shared between actual tests.
|
// This file contains helpers shared between actual tests.
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ export default function(mocha: Mocha) {
|
|||||||
// Set the CLI version here before activation to ensure we don't accidentally try to download a cli
|
// Set the CLI version here before activation to ensure we don't accidentally try to download a cli
|
||||||
(mocha.options as any).globalSetup.push(
|
(mocha.options as any).globalSetup.push(
|
||||||
async () => {
|
async () => {
|
||||||
await workspace.getConfiguration().update('codeQL.cli.executablePath', process.env.CLI_PATH, ConfigurationTarget.Global);
|
await testConfig.cliExecutablePath.setInitialTestValue(process.env.CLI_PATH);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { QlPack, runRemoteQuery } from '../../../remote-queries/run-remote-query
|
|||||||
import { Credentials } from '../../../authentication';
|
import { Credentials } from '../../../authentication';
|
||||||
import { CliVersionConstraint, CodeQLCliServer } from '../../../cli';
|
import { CliVersionConstraint, CodeQLCliServer } from '../../../cli';
|
||||||
import { CodeQLExtensionInterface } from '../../../extension';
|
import { CodeQLExtensionInterface } from '../../../extension';
|
||||||
import { setRemoteControllerRepo, setRemoteRepositoryLists } from '../../../config';
|
|
||||||
import * as config from '../../../config';
|
import * as config from '../../../config';
|
||||||
import { UserCancellationException } from '../../../commandRunner';
|
import { UserCancellationException } from '../../../commandRunner';
|
||||||
import * as ghApiClient from '../../../remote-queries/gh-api/gh-api-client';
|
import * as ghApiClient from '../../../remote-queries/gh-api/gh-api-client';
|
||||||
@@ -24,6 +23,7 @@ import { createMockApiResponse } from '../../factories/remote-queries/gh-api/var
|
|||||||
import { createMockExtensionContext } from '../../no-workspace';
|
import { createMockExtensionContext } from '../../no-workspace';
|
||||||
import { VariantAnalysisManager } from '../../../remote-queries/variant-analysis-manager';
|
import { VariantAnalysisManager } from '../../../remote-queries/variant-analysis-manager';
|
||||||
import { OutputChannelLogger } from '../../../logging';
|
import { OutputChannelLogger } from '../../../logging';
|
||||||
|
import { testConfig } from '../../test-config';
|
||||||
|
|
||||||
describe('Remote queries', function() {
|
describe('Remote queries', function() {
|
||||||
const baseDir = path.join(__dirname, '../../../../src/vscode-tests/cli-integration');
|
const baseDir = path.join(__dirname, '../../../../src/vscode-tests/cli-integration');
|
||||||
@@ -83,8 +83,8 @@ describe('Remote queries', function() {
|
|||||||
getRepositoryFromNwoStub = sandbox.stub(ghApiClient, 'getRepositoryFromNwo').resolves(dummyRepository);
|
getRepositoryFromNwoStub = sandbox.stub(ghApiClient, 'getRepositoryFromNwo').resolves(dummyRepository);
|
||||||
|
|
||||||
// always run in the vscode-codeql repo
|
// always run in the vscode-codeql repo
|
||||||
await setRemoteControllerRepo('github/vscode-codeql');
|
await testConfig.remoteControllerRepo.set('github/vscode-codeql');
|
||||||
await setRemoteRepositoryLists({ 'vscode-codeql': ['github/vscode-codeql'] });
|
await testConfig.remoteRepoLists.set({ 'vscode-codeql': ['github/vscode-codeql'] });
|
||||||
|
|
||||||
liveResultsStub = sandbox.stub(config, 'isVariantAnalysisLiveResultsEnabled').returns(false);
|
liveResultsStub = sandbox.stub(config, 'isVariantAnalysisLiveResultsEnabled').returns(false);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user