Re-enable the queries cli test
* Requires that QL_PATH environment variable is set and points to a checkout of github/codeql * Adds the `quiet` flag to the cli. When set, this flag will prevent some modal dialogs from disrupting the flow. Currently, we only ensure that the upgrades dialog is avoided. * Update the main.yml workflow to checkout the codeql repo
This commit is contained in:
9
.github/workflows/main.yml
vendored
9
.github/workflows/main.yml
vendored
@@ -124,12 +124,11 @@ jobs:
|
|||||||
version: ['v2.2.6', 'v2.3.3', 'v2.4.0']
|
version: ['v2.2.6', 'v2.3.3', 'v2.4.0']
|
||||||
env:
|
env:
|
||||||
CLI_VERSION: ${{ matrix.version }}
|
CLI_VERSION: ${{ matrix.version }}
|
||||||
|
QL_PATH: '${{ github.workspace }}/codeql'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
@@ -147,6 +146,12 @@ jobs:
|
|||||||
npm run build
|
npm run build
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
- name: Checkout QL
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: github/codeql
|
||||||
|
path: codeql
|
||||||
|
|
||||||
- name: Run CLI tests (Linux)
|
- name: Run CLI tests (Linux)
|
||||||
working-directory: extensions/ql-vscode
|
working-directory: extensions/ql-vscode
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
|||||||
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -86,7 +86,7 @@
|
|||||||
"args": [
|
"args": [
|
||||||
"--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
|
"--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
|
||||||
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/cli-integration/index",
|
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/cli-integration/index",
|
||||||
"${workspaceRoot}/extensions/ql-vscode/test/data"
|
"${workspaceRoot}/extensions/ql-vscode/src/vscode-tests/cli-integration/data",
|
||||||
],
|
],
|
||||||
"stopOnEntry": false,
|
"stopOnEntry": false,
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
|
|||||||
@@ -144,10 +144,15 @@ export class CodeQLCliServer implements Disposable {
|
|||||||
/** Path to current codeQL executable, or undefined if not running yet. */
|
/** Path to current codeQL executable, or undefined if not running yet. */
|
||||||
codeQlPath: string | undefined;
|
codeQlPath: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When set to true, ignore some modal popups and assume user has clicked "yes".
|
||||||
|
*/
|
||||||
|
public quiet = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private distributionProvider: DistributionProvider,
|
private distributionProvider: DistributionProvider,
|
||||||
private cliConfig: CliConfig,
|
private cliConfig: CliConfig,
|
||||||
private logger: Logger,
|
private logger: Logger
|
||||||
) {
|
) {
|
||||||
this.commandQueue = [];
|
this.commandQueue = [];
|
||||||
this.commandInProcess = false;
|
this.commandInProcess = false;
|
||||||
|
|||||||
@@ -62,7 +62,12 @@ export class QueryServerClient extends DisposableObject {
|
|||||||
withProgressReporting: WithProgressReporting;
|
withProgressReporting: WithProgressReporting;
|
||||||
public activeQueryName: string | undefined;
|
public activeQueryName: string | undefined;
|
||||||
|
|
||||||
constructor(readonly config: QueryServerConfig, readonly cliServer: cli.CodeQLCliServer, readonly opts: ServerOpts, withProgressReporting: WithProgressReporting) {
|
constructor(
|
||||||
|
readonly config: QueryServerConfig,
|
||||||
|
readonly cliServer: cli.CodeQLCliServer,
|
||||||
|
readonly opts: ServerOpts,
|
||||||
|
withProgressReporting: WithProgressReporting
|
||||||
|
) {
|
||||||
super();
|
super();
|
||||||
// When the query server configuration changes, restart the query server.
|
// When the query server configuration changes, restart the query server.
|
||||||
if (config.onDidChangeConfiguration !== undefined) {
|
if (config.onDidChangeConfiguration !== undefined) {
|
||||||
|
|||||||
@@ -82,6 +82,13 @@ async function checkAndConfirmDatabaseUpgrade(
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.log(descriptionMessage);
|
logger.log(descriptionMessage);
|
||||||
|
|
||||||
|
|
||||||
|
// If the quiet flag is set, do the upgrade without a popup.
|
||||||
|
if (qs.cliServer.quiet) {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
// Ask the user to confirm the upgrade.
|
// Ask the user to confirm the upgrade.
|
||||||
|
|
||||||
const showLogItem: vscode.MessageItem = { title: 'No, Show Changes', isCloseAffordance: true };
|
const showLogItem: vscode.MessageItem = { title: 'No, Show Changes', isCloseAffordance: true };
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
name: integration-test-queries-javascript
|
name: integration-test-queries-javascript
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
|
libraryPathDependencies: codeql-javascript
|
||||||
|
|||||||
@@ -44,11 +44,12 @@ export default function(mocha: /*Mocha*/ any) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Set the CLI version here before activation to ensure we don't accidentally try to download a cli
|
||||||
async () => {
|
async () => {
|
||||||
// Set the CLI version here before activation to ensure we don't accidentally try to download a cli
|
|
||||||
await workspace.getConfiguration().update('codeQL.cli.executablePath', process.env.CLI_PATH, ConfigurationTarget.Global);
|
await workspace.getConfiguration().update('codeQL.cli.executablePath', process.env.CLI_PATH, ConfigurationTarget.Global);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Create the temp directory to be used as extension local storage.
|
||||||
() => {
|
() => {
|
||||||
const dir = tmp.dirSync();
|
const dir = tmp.dirSync();
|
||||||
storagePath = fs.realpathSync(dir.name);
|
storagePath = fs.realpathSync(dir.name);
|
||||||
@@ -61,7 +62,10 @@ export default function(mocha: /*Mocha*/ any) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
mocha.globalTeardown(() => {
|
mocha.globalTeardown([
|
||||||
removeStorage?.();
|
// ensure temp directory is cleaned up.
|
||||||
});
|
() => {
|
||||||
|
removeStorage?.();
|
||||||
|
}
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ import { QueryServerClient } from '../../queryserver-client';
|
|||||||
/**
|
/**
|
||||||
* Integration tests for queries
|
* Integration tests for queries
|
||||||
*/
|
*/
|
||||||
// TODO: Not currently able to run this because we do not have access to the javascript qlpack.
|
describe.only('Queries', function() {
|
||||||
// Need to download ql libraries separately.
|
|
||||||
xdescribe('Queries', function() {
|
|
||||||
this.timeout(20000);
|
this.timeout(20000);
|
||||||
|
|
||||||
let dbItem: DatabaseItem;
|
let dbItem: DatabaseItem;
|
||||||
@@ -40,6 +38,7 @@ xdescribe('Queries', function() {
|
|||||||
databaseManager = extension.databaseManager;
|
databaseManager = extension.databaseManager;
|
||||||
cli = extension.cliServer;
|
cli = extension.cliServer;
|
||||||
qs = extension.qs;
|
qs = extension.qs;
|
||||||
|
cli.quiet = true;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Extension not initialized. Make sure cli is downloaded and installed properly.');
|
throw new Error('Extension not initialized. Make sure cli is downloaded and installed properly.');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,13 +88,15 @@ async function main() {
|
|||||||
|
|
||||||
console.log(`Running integration tests in these directories: ${dirs}`);
|
console.log(`Running integration tests in these directories: ${dirs}`);
|
||||||
for (const dir of dirs) {
|
for (const dir of dirs) {
|
||||||
|
const launchArgs = getLaunchArgs(dir as TestDir);
|
||||||
console.log(`Next integration test dir: ${dir}`);
|
console.log(`Next integration test dir: ${dir}`);
|
||||||
|
console.log(`Launch args: ${launchArgs}`);
|
||||||
await runTestsWithRetryOnSegfault({
|
await runTestsWithRetryOnSegfault({
|
||||||
version: VSCODE_VERSION,
|
version: VSCODE_VERSION,
|
||||||
vscodeExecutablePath,
|
vscodeExecutablePath,
|
||||||
extensionDevelopmentPath,
|
extensionDevelopmentPath,
|
||||||
extensionTestsPath: path.resolve(__dirname, dir, 'index'),
|
extensionTestsPath: path.resolve(__dirname, dir, 'index'),
|
||||||
launchArgs: getLaunchArgs(dir as TestDir)
|
launchArgs
|
||||||
}, 3);
|
}, 3);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -120,7 +122,10 @@ function getLaunchArgs(dir: TestDir) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
case TestDir.CliIntegration:
|
case TestDir.CliIntegration:
|
||||||
break;
|
return [
|
||||||
|
path.resolve(__dirname, '../../test/data'),
|
||||||
|
process.env.QL_PATH!
|
||||||
|
];
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assertNever(dir);
|
assertNever(dir);
|
||||||
|
|||||||
Reference in New Issue
Block a user