mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 19:31:12 -05:00
Connect to Lovable Cloud
Implemented end-to-end fixes: - Added INSERT RLS policies for park_submissions, ride_submissions, company_submissions, ride_model_submissions, and photo_submissions (own submissions and moderator access) - Fixed process_approval_transaction to replace ride_type with category and updated references accordingly - Enhanced rate limiting in testRunner.ts with a 6s base delay and 12s adaptive delays after submission-heavy suites
This commit is contained in:
@@ -53,9 +53,9 @@ export class IntegrationTestRunner {
|
||||
private onProgress?: (result: TestResult) => void;
|
||||
private delayBetweenTests: number;
|
||||
|
||||
constructor(onProgress?: (result: TestResult) => void, delayBetweenTests: number = 5000) {
|
||||
constructor(onProgress?: (result: TestResult) => void, delayBetweenTests: number = 6000) {
|
||||
this.onProgress = onProgress;
|
||||
this.delayBetweenTests = delayBetweenTests; // Default 5 seconds to prevent rate limiting
|
||||
this.delayBetweenTests = delayBetweenTests; // Default 6 seconds to prevent rate limiting
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,6 +189,14 @@ export class IntegrationTestRunner {
|
||||
this.isRunning = true;
|
||||
this.shouldStop = false;
|
||||
|
||||
// Track submission-heavy suites for adaptive delays
|
||||
const submissionHeavySuites = [
|
||||
'Entity Submission & Validation',
|
||||
'Approval Pipeline',
|
||||
'Unit Conversion Tests',
|
||||
'Performance & Scalability'
|
||||
];
|
||||
|
||||
for (let i = 0; i < suites.length; i++) {
|
||||
await this.runSuite(suites[i]);
|
||||
|
||||
@@ -196,30 +204,39 @@ export class IntegrationTestRunner {
|
||||
break;
|
||||
}
|
||||
|
||||
// Add delay between suites to prevent rate limiting
|
||||
// Add delay between suites with adaptive timing
|
||||
if (i < suites.length - 1 && this.delayBetweenTests > 0) {
|
||||
const delaySeconds = this.delayBetweenTests / 1000;
|
||||
// Longer delay after submission-heavy suites
|
||||
const isHeavySuite = submissionHeavySuites.includes(suites[i].name);
|
||||
const delayMs = isHeavySuite
|
||||
? this.delayBetweenTests * 2 // 12s delay after heavy suites
|
||||
: this.delayBetweenTests; // 6s delay after others
|
||||
|
||||
const delaySeconds = delayMs / 1000;
|
||||
const delayResult: TestResult = {
|
||||
id: `suite-delay-${Date.now()}`,
|
||||
name: `⏳ Suite completion delay: ${delaySeconds}s`,
|
||||
name: `⏳ Suite completion delay: ${delaySeconds}s${isHeavySuite ? ' (submission-heavy)' : ''}`,
|
||||
suite: 'System',
|
||||
status: 'running',
|
||||
duration: 0,
|
||||
timestamp: new Date().toISOString(),
|
||||
details: { reason: 'Pausing between suites to prevent rate limiting' }
|
||||
details: {
|
||||
reason: 'Pausing between suites to prevent rate limiting',
|
||||
isSubmissionHeavy: isHeavySuite
|
||||
}
|
||||
};
|
||||
|
||||
if (this.onProgress) {
|
||||
this.onProgress(delayResult);
|
||||
}
|
||||
|
||||
await this.delay(this.delayBetweenTests);
|
||||
await this.delay(delayMs);
|
||||
|
||||
if (this.onProgress) {
|
||||
this.onProgress({
|
||||
...delayResult,
|
||||
status: 'skip',
|
||||
duration: this.delayBetweenTests,
|
||||
duration: delayMs,
|
||||
details: { reason: 'Suite delay completed' }
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user