mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 03:20:11 +00:00
Fix code scanning findings
This commit is contained in:
parent
fda03c531b
commit
a8ee51fb99
16 changed files with 53 additions and 29 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { spawn } from 'node:child_process';
|
||||
import http from 'node:http';
|
||||
import https from 'node:https';
|
||||
|
||||
// Add signal handlers to debug unexpected termination
|
||||
const signals = ['SIGTERM', 'SIGINT', 'SIGHUP', 'SIGPIPE', 'SIGQUIT'];
|
||||
|
|
@ -60,10 +61,17 @@ const waitForHealth = async (healthURL, timeoutMs = 120_000) => {
|
|||
console.log(`[pretest] Waiting for ${healthURL} to become healthy...`);
|
||||
const startedAt = Date.now();
|
||||
let attempt = 0;
|
||||
const target = new URL(healthURL);
|
||||
const client = target.protocol === 'https:' ? https : http;
|
||||
const allowInsecureTLS = truthy(process.env.PULSE_E2E_INSECURE_TLS) && target.protocol === 'https:';
|
||||
const agent = allowInsecureTLS ? new https.Agent({ rejectUnauthorized: false }) : undefined;
|
||||
|
||||
const checkHealth = () => {
|
||||
return new Promise((resolve) => {
|
||||
const req = http.get(healthURL, (res) => {
|
||||
const req = client.get({
|
||||
...target,
|
||||
agent,
|
||||
}, (res) => {
|
||||
res.resume(); // Consume response data to free up memory
|
||||
resolve(res.statusCode >= 200 && res.statusCode < 300);
|
||||
});
|
||||
|
|
@ -91,11 +99,6 @@ const waitForHealth = async (healthURL, timeoutMs = 120_000) => {
|
|||
throw new Error(`Timed out waiting for ${healthURL} after ${attempt} attempts`);
|
||||
};
|
||||
|
||||
|
||||
if (truthy(process.env.PULSE_E2E_INSECURE_TLS)) {
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
||||
}
|
||||
|
||||
if (!shouldSkipPlaywrightInstall) {
|
||||
await run(npxCmd, ['playwright', 'install', 'chromium']);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue