Merge pull request #3172 from github/koesie10/remove-legacy-messages
Remove legacy messages
This commit is contained in:
@@ -30,11 +30,11 @@ import { walkDirectory } from "../common/files";
|
|||||||
import { QueryMetadata, SortDirection } from "../common/interface-types";
|
import { QueryMetadata, SortDirection } from "../common/interface-types";
|
||||||
import { BaseLogger, Logger } from "../common/logging";
|
import { BaseLogger, Logger } from "../common/logging";
|
||||||
import { ProgressReporter } from "../common/logging/vscode";
|
import { ProgressReporter } from "../common/logging/vscode";
|
||||||
import { CompilationMessage } from "../query-server/legacy-messages";
|
|
||||||
import { sarifParser } from "../common/sarif-parser";
|
import { sarifParser } from "../common/sarif-parser";
|
||||||
import { App } from "../common/app";
|
import { App } from "../common/app";
|
||||||
import { QueryLanguage } from "../common/query-language";
|
import { QueryLanguage } from "../common/query-language";
|
||||||
import { LINE_ENDINGS, splitStreamAtSeparators } from "../common/split-stream";
|
import { LINE_ENDINGS, splitStreamAtSeparators } from "../common/split-stream";
|
||||||
|
import { Position } from "../query-server/new-messages";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The version of the SARIF format that we are using.
|
* The version of the SARIF format that we are using.
|
||||||
@@ -159,6 +159,24 @@ export type ResolvedQueries = string[];
|
|||||||
*/
|
*/
|
||||||
export type ResolvedTests = string[];
|
export type ResolvedTests = string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A compilation message for a test message (either an error or a warning)
|
||||||
|
*/
|
||||||
|
export interface CompilationMessage {
|
||||||
|
/**
|
||||||
|
* The text of the message
|
||||||
|
*/
|
||||||
|
message: string;
|
||||||
|
/**
|
||||||
|
* The source position associated with the message
|
||||||
|
*/
|
||||||
|
position: Position;
|
||||||
|
/**
|
||||||
|
* The severity of the message
|
||||||
|
*/
|
||||||
|
severity: number;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event fired by `codeql test run`.
|
* Event fired by `codeql test run`.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -125,12 +125,12 @@ export class CompareView extends AbstractWebview<
|
|||||||
// only run interpolation if the label is user-defined
|
// only run interpolation if the label is user-defined
|
||||||
// otherwise we will wind up with duplicated rows
|
// otherwise we will wind up with duplicated rows
|
||||||
name: this.labelProvider.getShortLabel(from),
|
name: this.labelProvider.getShortLabel(from),
|
||||||
status: from.completedQuery.statusString,
|
status: from.completedQuery.message,
|
||||||
time: from.startTime,
|
time: from.startTime,
|
||||||
},
|
},
|
||||||
toQuery: {
|
toQuery: {
|
||||||
name: this.labelProvider.getShortLabel(to),
|
name: this.labelProvider.getShortLabel(to),
|
||||||
status: to.completedQuery.statusString,
|
status: to.completedQuery.message,
|
||||||
time: to.startTime,
|
time: to.startTime,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -178,15 +178,6 @@ export class LocalQueryRun {
|
|||||||
const successful = results.resultType === QueryResultType.SUCCESS;
|
const successful = results.resultType === QueryResultType.SUCCESS;
|
||||||
return {
|
return {
|
||||||
query,
|
query,
|
||||||
result: {
|
|
||||||
evaluationTime: results.evaluationTime,
|
|
||||||
queryId: 0,
|
|
||||||
resultType: successful
|
|
||||||
? QueryResultType.SUCCESS
|
|
||||||
: QueryResultType.OTHER_ERROR,
|
|
||||||
runId: 0,
|
|
||||||
message,
|
|
||||||
},
|
|
||||||
message,
|
message,
|
||||||
successful,
|
successful,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -77,14 +77,14 @@ export class HistoryItemLabelProvider {
|
|||||||
private getLocalInterpolateReplacements(
|
private getLocalInterpolateReplacements(
|
||||||
item: LocalQueryInfo,
|
item: LocalQueryInfo,
|
||||||
): InterpolateReplacements {
|
): InterpolateReplacements {
|
||||||
const { resultCount = 0, statusString = "in progress" } =
|
const { resultCount = 0, message = "in progress" } =
|
||||||
item.completedQuery || {};
|
item.completedQuery || {};
|
||||||
return {
|
return {
|
||||||
t: item.startTime,
|
t: item.startTime,
|
||||||
q: item.getQueryName(),
|
q: item.getQueryName(),
|
||||||
d: item.databaseName,
|
d: item.databaseName,
|
||||||
r: `(${resultCount} results)`,
|
r: `(${resultCount} results)`,
|
||||||
s: statusString,
|
s: message,
|
||||||
f: item.getQueryFileName(),
|
f: item.getQueryFileName(),
|
||||||
l: this.getLanguageLabel(item),
|
l: this.getLanguageLabel(item),
|
||||||
"%": "%",
|
"%": "%",
|
||||||
|
|||||||
@@ -1058,7 +1058,7 @@ export class QueryHistoryManager extends DisposableObject {
|
|||||||
.map((item) => ({
|
.map((item) => ({
|
||||||
label: this.labelProvider.getLabel(item),
|
label: this.labelProvider.getLabel(item),
|
||||||
description: item.databaseName,
|
description: item.databaseName,
|
||||||
detail: item.completedQuery.statusString,
|
detail: item.completedQuery.message,
|
||||||
query: item,
|
query: item,
|
||||||
}));
|
}));
|
||||||
if (comparableQueryLabels.length < 1) {
|
if (comparableQueryLabels.length < 1) {
|
||||||
|
|||||||
@@ -46,14 +46,6 @@ function mapCompletedQueryToDto(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
query: mapQueryEvaluationInfoToDto(query.query),
|
query: mapQueryEvaluationInfoToDto(query.query),
|
||||||
result: {
|
|
||||||
runId: query.result.runId,
|
|
||||||
queryId: query.result.queryId,
|
|
||||||
resultType: query.result.resultType,
|
|
||||||
evaluationTime: query.result.evaluationTime,
|
|
||||||
message: query.result.message,
|
|
||||||
logFileLocation: query.result.logFileLocation,
|
|
||||||
},
|
|
||||||
logFileLocation: query.logFileLocation,
|
logFileLocation: query.logFileLocation,
|
||||||
successful: query.successful,
|
successful: query.successful,
|
||||||
message: query.message,
|
message: query.message,
|
||||||
|
|||||||
@@ -56,17 +56,9 @@ function mapCompletedQueryInfoToDomainModel(
|
|||||||
|
|
||||||
return new CompletedQueryInfo(
|
return new CompletedQueryInfo(
|
||||||
mapQueryEvaluationInfoToDomainModel(completedQuery.query),
|
mapQueryEvaluationInfoToDomainModel(completedQuery.query),
|
||||||
{
|
|
||||||
runId: completedQuery.result.runId,
|
|
||||||
queryId: completedQuery.result.queryId,
|
|
||||||
resultType: completedQuery.result.resultType,
|
|
||||||
evaluationTime: completedQuery.result.evaluationTime,
|
|
||||||
message: completedQuery.result.message,
|
|
||||||
logFileLocation: completedQuery.result.logFileLocation,
|
|
||||||
},
|
|
||||||
completedQuery.logFileLocation,
|
completedQuery.logFileLocation,
|
||||||
completedQuery.successful ?? completedQuery.sucessful,
|
completedQuery.successful ?? false,
|
||||||
completedQuery.message,
|
completedQuery.message ?? "",
|
||||||
sortState,
|
sortState,
|
||||||
completedQuery.resultCount,
|
completedQuery.resultCount,
|
||||||
sortedResults,
|
sortedResults,
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ export interface CompletedQueryInfoDto {
|
|||||||
|
|
||||||
// There once was a typo in the data model, which is why we need to support both
|
// There once was a typo in the data model, which is why we need to support both
|
||||||
sucessful?: boolean;
|
sucessful?: boolean;
|
||||||
result: EvaluationResultDto;
|
|
||||||
logFileLocation?: string;
|
logFileLocation?: string;
|
||||||
resultCount: number;
|
resultCount: number;
|
||||||
sortedResultsInfo: Record<string, SortedResultSetInfoDto>;
|
sortedResultsInfo: Record<string, SortedResultSetInfoDto>;
|
||||||
@@ -81,15 +80,6 @@ export enum SortDirectionDto {
|
|||||||
desc,
|
desc,
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EvaluationResultDto {
|
|
||||||
runId: number;
|
|
||||||
queryId: number;
|
|
||||||
resultType: number;
|
|
||||||
evaluationTime: number;
|
|
||||||
message?: string;
|
|
||||||
logFileLocation?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface QueryEvaluationInfoDto {
|
export interface QueryEvaluationInfoDto {
|
||||||
querySaveDir: string;
|
querySaveDir: string;
|
||||||
dbItemPath: string;
|
dbItemPath: string;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { CancellationTokenSource, env } from "vscode";
|
import { CancellationTokenSource, env } from "vscode";
|
||||||
|
|
||||||
import * as messages from "./query-server/messages-shared";
|
import * as messages from "./query-server/messages-shared";
|
||||||
import * as legacyMessages from "./query-server/legacy-messages";
|
|
||||||
import * as cli from "./codeql-cli/cli";
|
import * as cli from "./codeql-cli/cli";
|
||||||
import { pathExists } from "fs-extra";
|
import { pathExists } from "fs-extra";
|
||||||
import { basename } from "path";
|
import { basename } from "path";
|
||||||
@@ -23,7 +22,6 @@ import {
|
|||||||
QueryWithResults,
|
QueryWithResults,
|
||||||
} from "./run-queries-shared";
|
} from "./run-queries-shared";
|
||||||
import { sarifParser } from "./common/sarif-parser";
|
import { sarifParser } from "./common/sarif-parser";
|
||||||
import { formatLegacyMessage } from "./query-server/format-legacy-message";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* query-results.ts
|
* query-results.ts
|
||||||
@@ -54,14 +52,9 @@ export interface InitialQueryInfo {
|
|||||||
export class CompletedQueryInfo implements QueryWithResults {
|
export class CompletedQueryInfo implements QueryWithResults {
|
||||||
constructor(
|
constructor(
|
||||||
public readonly query: QueryEvaluationInfo,
|
public readonly query: QueryEvaluationInfo,
|
||||||
|
|
||||||
/**
|
|
||||||
* The legacy result. This is only set when loading from the query history.
|
|
||||||
*/
|
|
||||||
public readonly result: legacyMessages.EvaluationResult,
|
|
||||||
public readonly logFileLocation: string | undefined,
|
public readonly logFileLocation: string | undefined,
|
||||||
public readonly successful: boolean | undefined,
|
public readonly successful: boolean,
|
||||||
public readonly message: string | undefined,
|
public readonly message: string,
|
||||||
/**
|
/**
|
||||||
* How we're currently sorting alerts. This is not mere interface
|
* How we're currently sorting alerts. This is not mere interface
|
||||||
* state due to truncation; on re-sort, we want to read in the file
|
* state due to truncation; on re-sort, we want to read in the file
|
||||||
@@ -82,16 +75,6 @@ export class CompletedQueryInfo implements QueryWithResults {
|
|||||||
this.resultCount = value;
|
this.resultCount = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
get statusString(): string {
|
|
||||||
if (this.message) {
|
|
||||||
return this.message;
|
|
||||||
} else if (this.result) {
|
|
||||||
return formatLegacyMessage(this.result);
|
|
||||||
} else {
|
|
||||||
throw new Error("No status available");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getResultsPath(selectedTable: string, useSorted = true): string {
|
getResultsPath(selectedTable: string, useSorted = true): string {
|
||||||
if (!useSorted) {
|
if (!useSorted) {
|
||||||
return this.query.resultsPaths.resultsPath;
|
return this.query.resultsPaths.resultsPath;
|
||||||
@@ -291,7 +274,6 @@ export class LocalQueryInfo {
|
|||||||
completeThisQuery(info: QueryWithResults): void {
|
completeThisQuery(info: QueryWithResults): void {
|
||||||
this.completedQuery = new CompletedQueryInfo(
|
this.completedQuery = new CompletedQueryInfo(
|
||||||
info.query,
|
info.query,
|
||||||
info.result,
|
|
||||||
info.query.logPath,
|
info.query.logPath,
|
||||||
info.successful,
|
info.successful,
|
||||||
info.message,
|
info.message,
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
import * as legacyMessages from "./legacy-messages";
|
|
||||||
|
|
||||||
// Used for formatting the result of a legacy query which might still be in the
|
|
||||||
// user's query history.
|
|
||||||
export function formatLegacyMessage(result: legacyMessages.EvaluationResult) {
|
|
||||||
switch (result.resultType) {
|
|
||||||
case legacyMessages.QueryResultType.CANCELLATION:
|
|
||||||
return `cancelled after ${Math.round(
|
|
||||||
result.evaluationTime / 1000,
|
|
||||||
)} seconds`;
|
|
||||||
case legacyMessages.QueryResultType.OOM:
|
|
||||||
return "out of memory";
|
|
||||||
case legacyMessages.QueryResultType.SUCCESS:
|
|
||||||
return `finished in ${Math.round(result.evaluationTime / 1000)} seconds`;
|
|
||||||
case legacyMessages.QueryResultType.TIMEOUT:
|
|
||||||
return `timed out after ${Math.round(
|
|
||||||
result.evaluationTime / 1000,
|
|
||||||
)} seconds`;
|
|
||||||
case legacyMessages.QueryResultType.OTHER_ERROR:
|
|
||||||
default:
|
|
||||||
return result.message ? `failed: ${result.message}` : "failed";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
/**
|
|
||||||
* Types for messages exchanged during jsonrpc communication with the
|
|
||||||
* the CodeQL query server.
|
|
||||||
*
|
|
||||||
* This file only contains types for messages that are still in use by
|
|
||||||
* the extension. Communication with the query server happens through
|
|
||||||
* messages in new-messages.ts.
|
|
||||||
*
|
|
||||||
* A note about the namespaces below, which look like they are
|
|
||||||
* essentially enums, namely Severity and QueryResultType.
|
|
||||||
* By design, for the sake of extensibility, clients
|
|
||||||
* receiving messages of this protocol are supposed to accept any
|
|
||||||
* number for any of these types. We commit to the given meaning of
|
|
||||||
* the numbers listed in constants in the namespaces, and we commit to
|
|
||||||
* the fact that any unknown QueryResultType value counts as an error.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import * as shared from "./messages-shared";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A compilation message (either an error or a warning)
|
|
||||||
*/
|
|
||||||
export interface CompilationMessage {
|
|
||||||
/**
|
|
||||||
* The text of the message
|
|
||||||
*/
|
|
||||||
message: string;
|
|
||||||
/**
|
|
||||||
* The source position associated with the message
|
|
||||||
*/
|
|
||||||
position: Position;
|
|
||||||
/**
|
|
||||||
* The severity of the message
|
|
||||||
*/
|
|
||||||
severity: Severity;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Severity = number;
|
|
||||||
/**
|
|
||||||
* Severity of different messages. This namespace is intentionally not
|
|
||||||
* an enum, see "for the sake of extensibility" comment above.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
||||||
export namespace Severity {
|
|
||||||
/**
|
|
||||||
* The message is a compilation error.
|
|
||||||
*/
|
|
||||||
export const ERROR = 0;
|
|
||||||
/**
|
|
||||||
* The message is a compilation warning.
|
|
||||||
*/
|
|
||||||
export const WARNING = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The result of a single query
|
|
||||||
*/
|
|
||||||
export interface EvaluationResult {
|
|
||||||
/**
|
|
||||||
* The id of the run that this query was in
|
|
||||||
*/
|
|
||||||
runId: number;
|
|
||||||
/**
|
|
||||||
* The id of the query within the run
|
|
||||||
*/
|
|
||||||
queryId: number;
|
|
||||||
/**
|
|
||||||
* The type of the result. See QueryResultType for
|
|
||||||
* possible meanings. Any other result should be interpreted as an error.
|
|
||||||
*/
|
|
||||||
resultType: QueryResultType;
|
|
||||||
/**
|
|
||||||
* The wall clock time it took to evaluate the query.
|
|
||||||
* The time is from when we initially tried to evaluate the query
|
|
||||||
* to when we get the results. Hence with parallel evaluation the times may
|
|
||||||
* look odd.
|
|
||||||
*/
|
|
||||||
evaluationTime: number;
|
|
||||||
/**
|
|
||||||
* An error message if an error happened
|
|
||||||
*/
|
|
||||||
message?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Full path to file with all log messages emitted while this query was active, if one exists
|
|
||||||
*/
|
|
||||||
logFileLocation?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryResultType = number;
|
|
||||||
/**
|
|
||||||
* The result of running a query. This namespace is intentionally not
|
|
||||||
* an enum, see "for the sake of extensibility" comment above.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
||||||
export namespace QueryResultType {
|
|
||||||
/**
|
|
||||||
* The query ran successfully
|
|
||||||
*/
|
|
||||||
export const SUCCESS = 0;
|
|
||||||
/**
|
|
||||||
* The query failed due to an reason
|
|
||||||
* that isn't listed
|
|
||||||
*/
|
|
||||||
export const OTHER_ERROR = 1;
|
|
||||||
/**
|
|
||||||
* The query failed due to running out of
|
|
||||||
* memory
|
|
||||||
*/
|
|
||||||
export const OOM = 2;
|
|
||||||
/**
|
|
||||||
* The query failed due to exceeding the timeout
|
|
||||||
*/
|
|
||||||
export const TIMEOUT = 3;
|
|
||||||
/**
|
|
||||||
* The query failed because it was cancelled.
|
|
||||||
*/
|
|
||||||
export const CANCELLATION = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A position within a QL file.
|
|
||||||
*/
|
|
||||||
export type Position = shared.Position;
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import * as messages from "./query-server/messages-shared";
|
import * as messages from "./query-server/messages-shared";
|
||||||
import * as legacyMessages from "./query-server/legacy-messages";
|
|
||||||
import { DatabaseInfo, QueryMetadata } from "./common/interface-types";
|
import { DatabaseInfo, QueryMetadata } from "./common/interface-types";
|
||||||
import { join, parse, dirname, basename } from "path";
|
import { join, parse, dirname, basename } from "path";
|
||||||
import { Range, TextEditor, Uri, window, workspace } from "vscode";
|
import { Range, TextEditor, Uri, window, workspace } from "vscode";
|
||||||
@@ -367,10 +366,9 @@ export class QueryEvaluationInfo extends QueryOutputDir {
|
|||||||
|
|
||||||
export interface QueryWithResults {
|
export interface QueryWithResults {
|
||||||
readonly query: QueryEvaluationInfo;
|
readonly query: QueryEvaluationInfo;
|
||||||
readonly result: legacyMessages.EvaluationResult;
|
|
||||||
readonly logFileLocation?: string;
|
readonly logFileLocation?: string;
|
||||||
readonly successful?: boolean;
|
readonly successful: boolean;
|
||||||
readonly message?: string;
|
readonly message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
QueryWithResults,
|
QueryWithResults,
|
||||||
} from "../../../src/run-queries-shared";
|
} from "../../../src/run-queries-shared";
|
||||||
import { CancellationTokenSource } from "vscode";
|
import { CancellationTokenSource } from "vscode";
|
||||||
import { QueryResultType } from "../../../src/query-server/legacy-messages";
|
|
||||||
import { QueryMetadata } from "../../../src/common/interface-types";
|
import { QueryMetadata } from "../../../src/common/interface-types";
|
||||||
import { QueryLanguage } from "../../../src/common/query-language";
|
import { QueryLanguage } from "../../../src/common/query-language";
|
||||||
|
|
||||||
@@ -94,11 +93,8 @@ export function createMockQueryWithResults({
|
|||||||
metadata,
|
metadata,
|
||||||
} as unknown as QueryEvaluationInfo,
|
} as unknown as QueryEvaluationInfo,
|
||||||
successful: didRunSuccessfully,
|
successful: didRunSuccessfully,
|
||||||
result: {
|
message: didRunSuccessfully
|
||||||
evaluationTime: 1,
|
? "finished in 0 seconds"
|
||||||
queryId: 0,
|
: "compilation failed: unknown error",
|
||||||
runId: 0,
|
|
||||||
resultType: QueryResultType.SUCCESS,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
} from "vscode";
|
} from "vscode";
|
||||||
import * as CodeQLProtocol from "../../../../src/debugger/debug-protocol";
|
import * as CodeQLProtocol from "../../../../src/debugger/debug-protocol";
|
||||||
import { DisposableObject } from "../../../../src/common/disposable-object";
|
import { DisposableObject } from "../../../../src/common/disposable-object";
|
||||||
import { QueryResultType } from "../../../../src/query-server/legacy-messages";
|
import { QueryResultType } from "../../../../src/query-server/new-messages";
|
||||||
import { CoreCompletedQuery } from "../../../../src/query-server/query-runner";
|
import { CoreCompletedQuery } from "../../../../src/query-server/query-runner";
|
||||||
import { QueryOutputDir } from "../../../../src/run-queries-shared";
|
import { QueryOutputDir } from "../../../../src/run-queries-shared";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
import { DatabaseInfo } from "../../../../../src/common/interface-types";
|
import { DatabaseInfo } from "../../../../../src/common/interface-types";
|
||||||
import { CancellationTokenSource, Uri } from "vscode";
|
import { CancellationTokenSource, Uri } from "vscode";
|
||||||
import { tmpDir } from "../../../../../src/tmp-dir";
|
import { tmpDir } from "../../../../../src/tmp-dir";
|
||||||
import { QueryResultType } from "../../../../../src/query-server/legacy-messages";
|
|
||||||
import { VariantAnalysisHistoryItem } from "../../../../../src/query-history/variant-analysis-history-item";
|
import { VariantAnalysisHistoryItem } from "../../../../../src/query-history/variant-analysis-history-item";
|
||||||
import { QueryHistoryInfo } from "../../../../../src/query-history/query-history-info";
|
import { QueryHistoryInfo } from "../../../../../src/query-history/query-history-info";
|
||||||
import { createMockVariantAnalysisHistoryItem } from "../../../../factories/query-history/variant-analysis-history-item";
|
import { createMockVariantAnalysisHistoryItem } from "../../../../factories/query-history/variant-analysis-history-item";
|
||||||
@@ -274,12 +273,6 @@ describe("write and read", () => {
|
|||||||
query: queryEvalInfo,
|
query: queryEvalInfo,
|
||||||
successful: didRunSuccessfully,
|
successful: didRunSuccessfully,
|
||||||
message: "foo",
|
message: "foo",
|
||||||
result: {
|
|
||||||
evaluationTime: 1,
|
|
||||||
queryId: 0,
|
|
||||||
runId: 0,
|
|
||||||
resultType: QueryResultType.SUCCESS,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -25,13 +25,8 @@ import {
|
|||||||
import { CodeQLCliServer, SourceInfo } from "../../../src/codeql-cli/cli";
|
import { CodeQLCliServer, SourceInfo } from "../../../src/codeql-cli/cli";
|
||||||
import { CancellationTokenSource, Uri } from "vscode";
|
import { CancellationTokenSource, Uri } from "vscode";
|
||||||
import { tmpDir } from "../../../src/tmp-dir";
|
import { tmpDir } from "../../../src/tmp-dir";
|
||||||
import {
|
|
||||||
EvaluationResult,
|
|
||||||
QueryResultType,
|
|
||||||
} from "../../../src/query-server/legacy-messages";
|
|
||||||
import { sleep } from "../../../src/common/time";
|
import { sleep } from "../../../src/common/time";
|
||||||
import { mockedObject } from "../utils/mocking.helpers";
|
import { mockedObject } from "../utils/mocking.helpers";
|
||||||
import { formatLegacyMessage } from "../../../src/query-server/format-legacy-message";
|
|
||||||
|
|
||||||
describe("query-results", () => {
|
describe("query-results", () => {
|
||||||
let queryPath: string;
|
let queryPath: string;
|
||||||
@@ -106,33 +101,6 @@ describe("query-results", () => {
|
|||||||
expect(completedQuery.getResultsPath("zxa")).toBe("bxa");
|
expect(completedQuery.getResultsPath("zxa")).toBe("bxa");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should format the statusString", () => {
|
|
||||||
const evalResult: EvaluationResult = {
|
|
||||||
resultType: QueryResultType.OTHER_ERROR,
|
|
||||||
evaluationTime: 12340,
|
|
||||||
queryId: 3,
|
|
||||||
runId: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
evalResult.message = "Tremendously";
|
|
||||||
expect(formatLegacyMessage(evalResult)).toBe("failed: Tremendously");
|
|
||||||
|
|
||||||
evalResult.resultType = QueryResultType.OTHER_ERROR;
|
|
||||||
expect(formatLegacyMessage(evalResult)).toBe("failed: Tremendously");
|
|
||||||
|
|
||||||
evalResult.resultType = QueryResultType.CANCELLATION;
|
|
||||||
evalResult.evaluationTime = 2345;
|
|
||||||
expect(formatLegacyMessage(evalResult)).toBe("cancelled after 2 seconds");
|
|
||||||
|
|
||||||
evalResult.resultType = QueryResultType.OOM;
|
|
||||||
expect(formatLegacyMessage(evalResult)).toBe("out of memory");
|
|
||||||
|
|
||||||
evalResult.resultType = QueryResultType.SUCCESS;
|
|
||||||
expect(formatLegacyMessage(evalResult)).toBe("finished in 2 seconds");
|
|
||||||
|
|
||||||
evalResult.resultType = QueryResultType.TIMEOUT;
|
|
||||||
expect(formatLegacyMessage(evalResult)).toBe("timed out after 2 seconds");
|
|
||||||
});
|
|
||||||
it("should updateSortState", async () => {
|
it("should updateSortState", async () => {
|
||||||
// setup
|
// setup
|
||||||
const fqi = createMockFullQueryInfo(
|
const fqi = createMockFullQueryInfo(
|
||||||
@@ -471,12 +439,6 @@ describe("query-results", () => {
|
|||||||
query: queryEvalInfo,
|
query: queryEvalInfo,
|
||||||
successful: didRunSuccessfully,
|
successful: didRunSuccessfully,
|
||||||
message: "foo",
|
message: "foo",
|
||||||
result: {
|
|
||||||
evaluationTime: 1,
|
|
||||||
queryId: 0,
|
|
||||||
runId: 0,
|
|
||||||
resultType: QueryResultType.SUCCESS,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user