mirror of
https://github.com/DeNNiiInc/Web-Page-Performance-Test.git
synced 2026-04-17 20:05:58 +00:00
Remove temporary test and debug files
This commit is contained in:
@@ -1,60 +0,0 @@
|
|||||||
const https = require('https');
|
|
||||||
|
|
||||||
const URL = 'https://web-page-performance-test.beyondcloud.technology/api/run-test';
|
|
||||||
const TEST_TARGET = 'https://example.com';
|
|
||||||
|
|
||||||
function startTest(id) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
console.log(`[${id}] Starting test...`);
|
|
||||||
const data = JSON.stringify({
|
|
||||||
url: TEST_TARGET,
|
|
||||||
isMobile: true
|
|
||||||
});
|
|
||||||
|
|
||||||
const req = https.request(URL, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Content-Length': data.length,
|
|
||||||
'x-user-uuid': `stress-test-${id}`
|
|
||||||
}
|
|
||||||
}, (res) => {
|
|
||||||
let body = '';
|
|
||||||
res.on('data', chunk => body += chunk);
|
|
||||||
res.on('end', () => {
|
|
||||||
if (res.statusCode === 200) {
|
|
||||||
console.log(`[${id}] Success! Status: ${res.statusCode}`);
|
|
||||||
resolve(true);
|
|
||||||
} else {
|
|
||||||
console.error(`[${id}] Failed! Status: ${res.statusCode}`);
|
|
||||||
// console.error(`[${id}] Body: ${body}`);
|
|
||||||
resolve(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
req.on('error', (e) => {
|
|
||||||
console.error(`[${id}] Error: ${e.message}`);
|
|
||||||
resolve(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
req.write(data);
|
|
||||||
req.end();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function run() {
|
|
||||||
console.log('Sending 2 concurrent requests...');
|
|
||||||
const results = await Promise.all([
|
|
||||||
startTest('A'),
|
|
||||||
startTest('B')
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (results.every(r => r)) {
|
|
||||||
console.log('PASS: Both tests succeeded.');
|
|
||||||
} else {
|
|
||||||
console.log('FAIL: At least one test failed.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
run();
|
|
||||||
18
test-db.js
18
test-db.js
@@ -1,18 +0,0 @@
|
|||||||
const db = require('./lib/db');
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
console.log('Testing DB connectivity...');
|
|
||||||
try {
|
|
||||||
const client = await db.pool.connect();
|
|
||||||
console.log('Successfully connected to PostgreSQL!');
|
|
||||||
client.release();
|
|
||||||
|
|
||||||
console.log('Initializing Schema...');
|
|
||||||
await db.initSchema();
|
|
||||||
console.log('Schema Check Complete.');
|
|
||||||
} catch (err) {
|
|
||||||
console.error('DB Connection Failed:', err);
|
|
||||||
} finally {
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
Reference in New Issue
Block a user