Skip to content

Commit 5fef262

Browse files
committed
Add additional checkpoints to query server tests
Some of the query server tests are async, so multiple tests can be in progress at once.
1 parent 737fa11 commit 5fef262

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

extensions/ql-vscode/test/pure-tests/query-test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ describe('using the query server', function () {
8686
const codeQlPath = process.env["CODEQL_PATH"]!;
8787
let qs: qsClient.QueryServerClient;
8888
let cliServer: cli.CodeQLCliServer;
89+
const queryServerStarted = new Checkpoint<void>();
8990
after(() => {
9091
if (qs) {
9192
qs.dispose();
@@ -122,6 +123,7 @@ describe('using the query server', function () {
122123
task => task(consoleProgressReporter, token)
123124
);
124125
await qs.startQueryServer();
126+
queryServerStarted.resolve();
125127
});
126128

127129
// Note this does not work with arrow functions as the test case bodies:
@@ -132,8 +134,10 @@ describe('using the query server', function () {
132134
const queryName = path.basename(queryTestCase.queryPath);
133135
const compilationSucceeded = new Checkpoint<void>();
134136
const evaluationSucceeded = new Checkpoint<void>();
137+
const parsedResults = new Checkpoint<void>();
135138

136139
it(`should be able to compile query ${queryName}`, async function () {
140+
await queryServerStarted.done();
137141
expect(fs.existsSync(queryTestCase.queryPath)).to.be.true;
138142
try {
139143
const qlProgram: messages.QlProgram = {
@@ -209,6 +213,7 @@ describe('using the query server', function () {
209213
}
210214
actualResultSets[reader.schema.name] = actualRows;
211215
}
216+
parsedResults.resolve();
212217
} finally {
213218
if (fileReader) {
214219
fileReader.dispose();
@@ -217,6 +222,7 @@ describe('using the query server', function () {
217222
});
218223

219224
it(`should have correct results for query ${queryName}`, async function () {
225+
await parsedResults.done();
220226
expect(actualResultSets!).not.to.be.empty;
221227
expect(Object.keys(actualResultSets!).sort()).to.eql(Object.keys(queryTestCase.expectedResultSets).sort());
222228
for (const name in queryTestCase.expectedResultSets) {

0 commit comments

Comments
 (0)