@dionlarson/playwright-orchestrator-pg 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TestItem, Adapter, TestRunConfig, ResultTestParams, SaveTestRunParams } from '@playwright-orchestrator
|
|
1
|
+
import { TestItem, Adapter, TestRunConfig, ResultTestParams, SaveTestRunParams } from '@dionlarson/playwright-orchestrator-core';
|
|
2
2
|
import { CreateArgs } from './create-args.js';
|
|
3
3
|
import { TestRunReport } from '../../core/dist/types/reporter.js';
|
|
4
4
|
export declare class PostgreSQLAdapter extends Adapter {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Adapter, RunStatus, TestStatus, } from '@playwright-orchestrator
|
|
1
|
+
import { Adapter, RunStatus, TestStatus, } from '@dionlarson/playwright-orchestrator-core';
|
|
2
2
|
import pg from 'pg';
|
|
3
3
|
export class PostgreSQLAdapter extends Adapter {
|
|
4
4
|
configTable;
|
|
@@ -127,9 +127,12 @@ export class PostgreSQLAdapter extends Adapter {
|
|
|
127
127
|
CREATE INDEX IF NOT EXISTS test_info_id_idx ON ${this.testInfoHistoryTable}(test_info_id);`);
|
|
128
128
|
}
|
|
129
129
|
async startShard(runId) {
|
|
130
|
+
console.log(`[pg-adapter] startShard: connecting to pool...`);
|
|
130
131
|
const client = await this.pool.connect();
|
|
132
|
+
console.log(`[pg-adapter] startShard: connected, beginning transaction...`);
|
|
131
133
|
try {
|
|
132
134
|
await client.query('BEGIN');
|
|
135
|
+
console.log(`[pg-adapter] startShard: fetching run ${runId}...`);
|
|
133
136
|
let result = await client.query({
|
|
134
137
|
text: `
|
|
135
138
|
SELECT *
|
|
@@ -138,6 +141,7 @@ export class PostgreSQLAdapter extends Adapter {
|
|
|
138
141
|
FOR UPDATE`,
|
|
139
142
|
values: [runId],
|
|
140
143
|
});
|
|
144
|
+
console.log(`[pg-adapter] startShard: found ${result.rowCount} rows`);
|
|
141
145
|
if (result.rowCount === 0) {
|
|
142
146
|
throw new Error(`Run ${runId} not found`);
|
|
143
147
|
}
|
|
@@ -165,9 +169,11 @@ export class PostgreSQLAdapter extends Adapter {
|
|
|
165
169
|
});
|
|
166
170
|
}
|
|
167
171
|
await client.query('COMMIT');
|
|
172
|
+
console.log(`[pg-adapter] startShard: committed, returning config`);
|
|
168
173
|
return this.mapConfig(result.rows[0]);
|
|
169
174
|
}
|
|
170
175
|
catch (e) {
|
|
176
|
+
console.log(`[pg-adapter] startShard: error, rolling back: ${e}`);
|
|
171
177
|
await client.query('ROLLBACK');
|
|
172
178
|
throw e;
|
|
173
179
|
}
|