Ensure that tools_download_duration_ms is int (#1513)

This commit is contained in:
Angela P Wen 2023-01-27 01:03:57 -08:00 committed by GitHub
parent b2e16761f3
commit 4664f39699
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 16 deletions

12
lib/codeql.test.js generated
View file

@ -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);
});