Remove deprecated functionality
This commit is contained in:
parent
96fa24c6ba
commit
1d5eed8d40
18 changed files with 30 additions and 247 deletions
|
|
@ -7,12 +7,7 @@ import * as yaml from "js-yaml";
|
|||
import * as sinon from "sinon";
|
||||
|
||||
import * as api from "./api-client";
|
||||
import {
|
||||
CODEQL_VERSION_GHES_PACK_DOWNLOAD,
|
||||
getCachedCodeQL,
|
||||
PackDownloadOutput,
|
||||
setCodeQL,
|
||||
} from "./codeql";
|
||||
import { getCachedCodeQL, PackDownloadOutput, setCodeQL } from "./codeql";
|
||||
import * as configUtils from "./config-utils";
|
||||
import { Feature } from "./feature-flags";
|
||||
import { Language } from "./languages";
|
||||
|
|
@ -2217,20 +2212,20 @@ test(
|
|||
"0.0.1",
|
||||
);
|
||||
// Test that ML-powered queries ~0.3.0 are run on all platforms running `security-extended` on
|
||||
// CodeQL CLI 2.9.4+.
|
||||
// CodeQL CLI 2.10.5+.
|
||||
test(
|
||||
mlPoweredQueriesMacro,
|
||||
"2.9.4",
|
||||
"2.10.5",
|
||||
true,
|
||||
undefined,
|
||||
"security-extended",
|
||||
"~0.3.0",
|
||||
);
|
||||
// Test that ML-powered queries ~0.3.0 are run on all platforms running `security-and-quality` on
|
||||
// CodeQL CLI 2.9.4+.
|
||||
// CodeQL CLI 2.10.5+.
|
||||
test(
|
||||
mlPoweredQueriesMacro,
|
||||
"2.9.4",
|
||||
"2.10.5",
|
||||
true,
|
||||
undefined,
|
||||
"security-and-quality",
|
||||
|
|
@ -2554,48 +2549,6 @@ test("downloadPacks-with-registries", async (t) => {
|
|||
});
|
||||
});
|
||||
|
||||
test("downloadPacks-with-registries fails on 2.10.3", async (t) => {
|
||||
// same thing, but this time include a registries block and
|
||||
// associated env vars
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
process.env.GITHUB_TOKEN = "not-a-token";
|
||||
process.env.CODEQL_REGISTRIES_AUTH = "not-a-registries-auth";
|
||||
const logger = getRunnerLogger(true);
|
||||
|
||||
const registriesInput = yaml.dump([
|
||||
{
|
||||
url: "http://ghcr.io",
|
||||
packages: ["codeql/*", "codeql-testing/*"],
|
||||
token: "not-a-token",
|
||||
},
|
||||
{
|
||||
url: "https://containers.GHEHOSTNAME1/v2/",
|
||||
packages: "semmle/*",
|
||||
token: "still-not-a-token",
|
||||
},
|
||||
]);
|
||||
|
||||
const codeQL = setCodeQL({
|
||||
getVersion: () => Promise.resolve("2.10.3"),
|
||||
});
|
||||
await t.throwsAsync(
|
||||
async () => {
|
||||
return await configUtils.downloadPacks(
|
||||
codeQL,
|
||||
[Language.javascript, Language.java, Language.python],
|
||||
{},
|
||||
sampleApiDetails,
|
||||
registriesInput,
|
||||
tmpDir,
|
||||
logger,
|
||||
);
|
||||
},
|
||||
{ instanceOf: Error },
|
||||
"'registries' input is not supported on CodeQL versions less than 2.10.4.",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("downloadPacks-with-registries fails with invalid registries block", async (t) => {
|
||||
// same thing, but this time include a registries block and
|
||||
// associated env vars
|
||||
|
|
@ -2638,51 +2591,12 @@ test("downloadPacks-with-registries fails with invalid registries block", async
|
|||
});
|
||||
});
|
||||
|
||||
// the happy path for generateRegistries is already tested in downloadPacks.
|
||||
// these following tests are for the error cases and when nothing is generated.
|
||||
test("no generateRegistries when CLI is too old", async (t) => {
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
const registriesInput = yaml.dump([
|
||||
{
|
||||
// no slash
|
||||
url: "http://ghcr.io",
|
||||
packages: ["codeql/*", "codeql-testing/*"],
|
||||
token: "not-a-token",
|
||||
},
|
||||
]);
|
||||
const codeQL = setCodeQL({
|
||||
// Accepted CLI versions are 2.10.4 or higher
|
||||
getVersion: () => Promise.resolve("2.10.3"),
|
||||
});
|
||||
const logger = getRunnerLogger(true);
|
||||
await t.throwsAsync(
|
||||
async () =>
|
||||
await configUtils.generateRegistries(
|
||||
registriesInput,
|
||||
codeQL,
|
||||
tmpDir,
|
||||
logger,
|
||||
),
|
||||
undefined,
|
||||
"'registries' input is not supported on CodeQL versions less than 2.10.4.",
|
||||
);
|
||||
});
|
||||
});
|
||||
test("no generateRegistries when registries is undefined", async (t) => {
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
const registriesInput = undefined;
|
||||
const codeQL = setCodeQL({
|
||||
// Accepted CLI versions are 2.10.4 or higher
|
||||
getVersion: () => Promise.resolve(CODEQL_VERSION_GHES_PACK_DOWNLOAD),
|
||||
});
|
||||
const logger = getRunnerLogger(true);
|
||||
const { registriesAuthTokens, qlconfigFile } =
|
||||
await configUtils.generateRegistries(
|
||||
registriesInput,
|
||||
codeQL,
|
||||
tmpDir,
|
||||
logger,
|
||||
);
|
||||
await configUtils.generateRegistries(registriesInput, tmpDir, logger);
|
||||
|
||||
t.is(registriesAuthTokens, undefined);
|
||||
t.is(qlconfigFile, undefined);
|
||||
|
|
@ -2699,18 +2613,9 @@ test("generateRegistries prefers original CODEQL_REGISTRIES_AUTH", async (t) =>
|
|||
token: "not-a-token",
|
||||
},
|
||||
]);
|
||||
const codeQL = setCodeQL({
|
||||
// Accepted CLI versions are 2.10.4 or higher
|
||||
getVersion: () => Promise.resolve(CODEQL_VERSION_GHES_PACK_DOWNLOAD),
|
||||
});
|
||||
const logger = getRunnerLogger(true);
|
||||
const { registriesAuthTokens, qlconfigFile } =
|
||||
await configUtils.generateRegistries(
|
||||
registriesInput,
|
||||
codeQL,
|
||||
tmpDir,
|
||||
logger,
|
||||
);
|
||||
await configUtils.generateRegistries(registriesInput, tmpDir, logger);
|
||||
|
||||
t.is(registriesAuthTokens, "original");
|
||||
t.is(qlconfigFile, path.join(tmpDir, "qlconfig.yml"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue