mirror of
https://github.com/DeNNiiInc/Web-Page-Performance-Test.git
synced 2026-04-17 20:05:58 +00:00
Fix(runner): Restore missing DB insert query in rollback
This commit is contained in:
@@ -240,6 +240,28 @@ async function _executeTest(url, options) {
|
|||||||
const jsonPath = path.join(reportDir, `${testId}.json`);
|
const jsonPath = path.join(reportDir, `${testId}.json`);
|
||||||
fs.writeFileSync(jsonPath, JSON.stringify(summary, null, 2));
|
fs.writeFileSync(jsonPath, JSON.stringify(summary, null, 2));
|
||||||
|
|
||||||
|
// Prepare Database Insert
|
||||||
|
const insertQuery = `
|
||||||
|
INSERT INTO test_results (
|
||||||
|
test_id, user_uuid, user_ip, url, is_mobile,
|
||||||
|
scores, metrics, filmstrip, summary, suite_id, run_number, timestamp
|
||||||
|
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, NOW())
|
||||||
|
RETURNING id
|
||||||
|
`;
|
||||||
|
|
||||||
|
const values = [
|
||||||
|
testId,
|
||||||
|
options.userUuid || null,
|
||||||
|
options.userIp || null,
|
||||||
|
lhr.finalUrl,
|
||||||
|
isMobile,
|
||||||
|
summary.scores,
|
||||||
|
summary.metrics,
|
||||||
|
filmstripData,
|
||||||
|
summary,
|
||||||
|
options.suiteId || null,
|
||||||
|
options.runNumber || 1
|
||||||
|
];
|
||||||
try {
|
try {
|
||||||
const db = require('../lib/db');
|
const db = require('../lib/db');
|
||||||
await db.pool.query(insertQuery, values);
|
await db.pool.query(insertQuery, values);
|
||||||
|
|||||||
Reference in New Issue
Block a user