Request meta endpoint at the start of execution

This commit is contained in:
Robert 2020-11-26 17:54:34 +00:00
parent 8d18e347a7
commit 81a21bfa1e
46 changed files with 348 additions and 259 deletions

View file

@ -20,6 +20,8 @@ const sampleApiDetails = {
url: "https://github.example.com",
};
const ghesVersion = { type: "dotcom" } as util.GHESVersion;
// Returns the filepath of the newly-created file
function createConfigFile(inputFileContents: string, tmpDir: string): string {
const configFilePath = path.join(tmpDir, "input");
@ -81,8 +83,8 @@ test("load empty config", async (t) => {
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
logger
);
@ -96,8 +98,8 @@ test("load empty config", async (t) => {
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
logger
)
);
@ -133,8 +135,8 @@ test("loading config saves config", async (t) => {
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
logger
);
@ -159,8 +161,8 @@ test("load input outside of workspace", async (t) => {
tmpDir,
getCachedCodeQL(),
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
throw new Error("initConfig did not throw error");
@ -192,8 +194,8 @@ test("load non-local input with invalid repo syntax", async (t) => {
tmpDir,
getCachedCodeQL(),
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
throw new Error("initConfig did not throw error");
@ -226,8 +228,8 @@ test("load non-existent input", async (t) => {
tmpDir,
getCachedCodeQL(),
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
throw new Error("initConfig did not throw error");
@ -296,6 +298,7 @@ test("load non-empty input", async (t) => {
tempDir: tmpDir,
toolCacheDir: tmpDir,
codeQLCmd: codeQL.getPath(),
ghesVersion,
};
const languages = "javascript";
@ -310,8 +313,8 @@ test("load non-empty input", async (t) => {
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@ -371,8 +374,8 @@ test("Default queries are used", async (t) => {
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@ -440,8 +443,8 @@ test("Queries can be specified in config file", async (t) => {
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@ -503,8 +506,8 @@ test("Queries from config file can be overridden in workflow file", async (t) =>
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@ -564,8 +567,8 @@ test("Queries in workflow file can be used in tandem with the 'disable default q
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@ -615,8 +618,8 @@ test("Multiple queries can be specified in workflow file, no config file require
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@ -684,8 +687,8 @@ test("Queries in workflow file can be added to the set of queries without overri
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
@ -746,8 +749,8 @@ test("Invalid queries in workflow file handled correctly", async (t) => {
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
t.fail("initConfig did not throw error");
@ -808,8 +811,8 @@ test("API client used when reading remote config", async (t) => {
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
t.assert(spyGetContents.called);
@ -832,8 +835,8 @@ test("Remote config handles the case where a directory is provided", async (t) =
tmpDir,
getCachedCodeQL(),
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
throw new Error("initConfig did not throw error");
@ -864,8 +867,8 @@ test("Invalid format of remote config handled correctly", async (t) => {
tmpDir,
getCachedCodeQL(),
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
throw new Error("initConfig did not throw error");
@ -892,8 +895,8 @@ test("No detected languages", async (t) => {
tmpDir,
getCachedCodeQL(),
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
throw new Error("initConfig did not throw error");
@ -917,8 +920,8 @@ test("Unknown languages", async (t) => {
tmpDir,
getCachedCodeQL(),
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
throw new Error("initConfig did not throw error");
@ -963,8 +966,8 @@ function doInvalidInputTest(
tmpDir,
codeQL,
tmpDir,
ghesVersion,
sampleApiDetails,
"runner",
getRunnerLogger(true)
);
throw new Error("initConfig did not throw error");