mirror of
https://github.com/github/codeql-action.git
synced 2026-10-30 09:37:15 +00:00
Strengthen download status report tests
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -156,6 +156,7 @@ test.serial(
|
||||
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
|
||||
t.is(result.toolsVersion, `0.0.0-${version}`);
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
assertDownloadDurationInteger(t, result.toolsDownloadStatusReport);
|
||||
}
|
||||
|
||||
t.is(toolcache.findAllVersions("CodeQL").length, 2);
|
||||
@@ -191,9 +192,7 @@ test.serial(
|
||||
t.assert(toolcache.find("CodeQL", `2.15.0`));
|
||||
t.is(result.toolsVersion, `2.15.0`);
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
if (result.toolsDownloadStatusReport) {
|
||||
assertDownloadDurationInteger(t, result.toolsDownloadStatusReport);
|
||||
}
|
||||
assertDownloadDurationInteger(t, result.toolsDownloadStatusReport);
|
||||
});
|
||||
},
|
||||
);
|
||||
@@ -230,9 +229,7 @@ test.serial(
|
||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
||||
t.deepEqual(result.toolsVersion, "0.0.0-20200610");
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
if (result.toolsDownloadStatusReport) {
|
||||
assertDownloadDurationInteger(t, result.toolsDownloadStatusReport);
|
||||
}
|
||||
assertDownloadDurationInteger(t, result.toolsDownloadStatusReport);
|
||||
});
|
||||
},
|
||||
);
|
||||
@@ -282,11 +279,7 @@ for (const {
|
||||
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
|
||||
t.deepEqual(result.toolsVersion, expectedToolcacheVersion);
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
t.assert(
|
||||
Number.isInteger(
|
||||
result.toolsDownloadStatusReport?.downloadDurationMs,
|
||||
),
|
||||
);
|
||||
assertDownloadDurationInteger(t, result.toolsDownloadStatusReport);
|
||||
});
|
||||
},
|
||||
);
|
||||
@@ -417,9 +410,7 @@ test.serial(
|
||||
);
|
||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
if (result.toolsDownloadStatusReport) {
|
||||
assertDownloadDurationInteger(t, result.toolsDownloadStatusReport);
|
||||
}
|
||||
t.truthy(result.toolsDownloadStatusReport);
|
||||
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 2);
|
||||
@@ -458,9 +449,7 @@ test.serial(
|
||||
);
|
||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
if (result.toolsDownloadStatusReport) {
|
||||
assertDownloadDurationInteger(t, result.toolsDownloadStatusReport);
|
||||
}
|
||||
t.truthy(result.toolsDownloadStatusReport);
|
||||
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 2);
|
||||
@@ -502,9 +491,7 @@ test.serial(
|
||||
|
||||
t.is(result.toolsVersion, "0.0.0-20230203");
|
||||
t.is(result.toolsSource, ToolsSource.Download);
|
||||
if (result.toolsDownloadStatusReport) {
|
||||
assertDownloadDurationInteger(t, result.toolsDownloadStatusReport);
|
||||
}
|
||||
assertDownloadDurationInteger(t, result.toolsDownloadStatusReport);
|
||||
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 1);
|
||||
@@ -517,11 +504,9 @@ test.serial(
|
||||
|
||||
function assertDownloadDurationInteger(
|
||||
t: ExecutionContext<unknown>,
|
||||
statusReport: ToolsDownloadStatusReport,
|
||||
statusReport: ToolsDownloadStatusReport | undefined,
|
||||
) {
|
||||
if (statusReport.downloadDurationMs !== undefined) {
|
||||
t.assert(Number.isInteger(statusReport.downloadDurationMs));
|
||||
}
|
||||
t.assert(Number.isInteger(statusReport?.downloadDurationMs));
|
||||
}
|
||||
|
||||
test.serial("getExtraOptions works for explicit paths", (t) => {
|
||||
|
||||
Reference in New Issue
Block a user