Ensure that `tools_download_duration_ms` is int (#1513)
This commit is contained in:
Родитель
b2e16761f3
Коммит
4664f39699
|
@ -157,7 +157,7 @@ function mockApiDetails(apiDetails) {
|
|||
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
|
||||
t.is(result.toolsVersion, `0.0.0-${version}`);
|
||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
||||
t.is(typeof result.toolsDownloadDurationMs, "number");
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
}
|
||||
t.is(toolcache.findAllVersions("CodeQL").length, 2);
|
||||
});
|
||||
|
@ -177,7 +177,7 @@ function mockApiDetails(apiDetails) {
|
|||
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
||||
t.deepEqual(result.toolsVersion, "0.0.0-20200610");
|
||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
||||
t.not(result.toolsDownloadDurationMs, undefined);
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
});
|
||||
});
|
||||
const EXPLICITLY_REQUESTED_BUNDLE_TEST_CASES = [
|
||||
|
@ -212,7 +212,7 @@ for (const { cliVersion, expectedToolcacheVersion, } of EXPLICITLY_REQUESTED_BUN
|
|||
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
|
||||
t.deepEqual(result.toolsVersion, cliVersion);
|
||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
||||
t.not(result.toolsDownloadDurationMs, undefined);
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
|
|||
}, (0, logging_1.getRunnerLogger)(true), false);
|
||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
||||
t.is(typeof result.toolsDownloadDurationMs, "number");
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 2);
|
||||
});
|
||||
|
@ -322,7 +322,7 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
|
|||
const result = await codeql.setupCodeQL("latest", sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, false, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
||||
t.is(typeof result.toolsDownloadDurationMs, "number");
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 2);
|
||||
});
|
||||
|
@ -359,7 +359,7 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
|
|||
variant: util.GitHubVariant.GHAE,
|
||||
}, (0, logging_1.getRunnerLogger)(true), false);
|
||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
||||
t.is(typeof result.toolsDownloadDurationMs, "number");
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 1);
|
||||
});
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -426,7 +426,7 @@ async function downloadCodeQL(codeqlURL, maybeCliVersion, apiDetails, variant, t
|
|||
const finalHeaders = Object.assign({ "User-Agent": "CodeQL Action" }, headers);
|
||||
const toolsDownloadStart = perf_hooks_1.performance.now();
|
||||
const codeqlPath = await toolcache.downloadTool(codeqlURL, dest, undefined, finalHeaders);
|
||||
const toolsDownloadDurationMs = perf_hooks_1.performance.now() - toolsDownloadStart;
|
||||
const toolsDownloadDurationMs = Math.round(perf_hooks_1.performance.now() - toolsDownloadStart);
|
||||
logger.debug(`CodeQL bundle download to ${codeqlPath} complete.`);
|
||||
const codeqlExtracted = await toolcache.extractTar(codeqlPath);
|
||||
const bundleVersion = getBundleVersionFromUrl(codeqlURL);
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -208,7 +208,7 @@ test("downloads and caches explicitly requested bundles that aren't in the toolc
|
|||
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
|
||||
t.is(result.toolsVersion, `0.0.0-${version}`);
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
t.is(typeof result.toolsDownloadDurationMs, "number");
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
}
|
||||
|
||||
t.is(toolcache.findAllVersions("CodeQL").length, 2);
|
||||
|
@ -241,7 +241,7 @@ test("downloads an explicitly requested bundle even if a different version is ca
|
|||
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
||||
t.deepEqual(result.toolsVersion, "0.0.0-20200610");
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
t.not(result.toolsDownloadDurationMs, undefined);
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -293,7 +293,7 @@ for (const {
|
|||
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
|
||||
t.deepEqual(result.toolsVersion, cliVersion);
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
t.not(result.toolsDownloadDurationMs, undefined);
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
|
|||
);
|
||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
t.is(typeof result.toolsDownloadDurationMs, "number");
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 2);
|
||||
|
@ -461,7 +461,7 @@ test('downloads bundle if "latest" tools specified but not cached', async (t) =>
|
|||
);
|
||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
t.is(typeof result.toolsDownloadDurationMs, "number");
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 2);
|
||||
|
@ -527,7 +527,7 @@ test("download codeql bundle from github ae endpoint", async (t) => {
|
|||
);
|
||||
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
t.is(typeof result.toolsDownloadDurationMs, "number");
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 1);
|
||||
|
|
|
@ -568,7 +568,9 @@ export async function downloadCodeQL(
|
|||
undefined,
|
||||
finalHeaders
|
||||
);
|
||||
const toolsDownloadDurationMs = performance.now() - toolsDownloadStart;
|
||||
const toolsDownloadDurationMs = Math.round(
|
||||
performance.now() - toolsDownloadStart
|
||||
);
|
||||
|
||||
logger.debug(`CodeQL bundle download to ${codeqlPath} complete.`);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче