tests: reduce logging (#596)

remove logging of crawl logs by default for clearer output from tests, only log in case of error.
This commit is contained in:
Ilya Kreymer 2024-06-26 13:05:13 -07:00 committed by GitHub
parent 4495532606
commit a3396adba2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 17 additions and 12 deletions

View file

@ -208,6 +208,7 @@ export async function checkDiskUtilization(
params: Record<string, any>,
archiveDirSize: number,
dfOutput = null,
doLog = true,
) {
const diskUsage: Record<string, string> = await getDiskUsage(
collDir,
@ -217,9 +218,11 @@ export async function checkDiskUtilization(
// Check that disk usage isn't already above threshold
if (usedPercentage >= params.diskUtilization) {
if (doLog) {
logger.info(
`Disk utilization threshold reached ${usedPercentage}% > ${params.diskUtilization}%, stopping`,
);
}
return {
stop: true,
used: usedPercentage,
@ -246,9 +249,11 @@ export async function checkDiskUtilization(
);
if (projectedUsedPercentage >= params.diskUtilization) {
if (doLog) {
logger.info(
`Disk utilization projected to reach threshold ${projectedUsedPercentage}% > ${params.diskUtilization}%, stopping`,
);
}
return {
stop: true,
used: usedPercentage,

View file

@ -15,7 +15,7 @@ function runCrawl(name, config, commandExtra = "") {
{ input: configYaml, stdin: "inherit", encoding: "utf8" },
);
console.log(proc);
//console.log(proc);
} catch (error) {
console.log(error);
}

View file

@ -15,7 +15,7 @@ function runCrawl(name, config, commandExtra = "") {
{ input: configYaml, stdin: "inherit", encoding: "utf8" },
);
console.log(proc);
//console.log(proc);
} catch (error) {
console.log(error);
}

View file

@ -12,7 +12,7 @@ test("pass config file via stdin", async () => {
{ input: configYaml, stdin: "inherit", encoding: "utf8" },
);
console.log(proc);
//console.log(proc);
} catch (error) {
console.log(error);
}

View file

@ -11,8 +11,6 @@ test("set rollover to 500K and ensure individual WARCs rollover, including scree
let main = 0;
let screenshots = 0;
console.log(warcLists);
for (const name of warcLists) {
if (name.startsWith("rec-")) {
main++;

View file

@ -33,6 +33,7 @@ grpcfuse 1000000 285000 715000 28% /crawls`;
params,
5000 * 1024,
mockDfOutput,
false
);
expect(returnValue).toEqual({
stop: false,
@ -60,6 +61,7 @@ grpcfuse 100000 85000 15000 85% /crawls`;
params,
3000 * 1024,
mockDfOutput,
false
);
expect(returnValue).toEqual({
stop: true,

View file

@ -13,7 +13,7 @@ test("run crawl", async() => {
{ input: configYaml, stdin: "inherit", encoding: "utf8" },
);
console.log(proc);
//console.log(proc);
success = true;
} catch (error) {
console.log(error);