mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-03-28 13:13:08 +00:00
refactor: streamline test suite — 33 fewer files, 11.9x faster (#670)
* refactor: streamline test suite - cut 33 files, enable parallel execution (11.9x speedup) Remove duplicate, low-value, and fragmented test files while preserving all meaningful coverage. Enable parallel test execution and remove the entire benchmark infrastructure. Key changes: - Consolidate workflow-validator tests (13 files -> 3) - Consolidate config-validator tests (9 files -> 3) - Consolidate telemetry tests (11 files -> 6) - Merge AI validator tests (2 files -> 1) - Remove example/demo test files, mock-testing files, and already-skipped tests - Remove benchmark infrastructure (10 files, CI workflow, 4 npm scripts) - Enable parallel test execution (remove singleThread: true) - Remove retry:2 that was masking flaky tests - Slim CI publish-results job Results: 224 -> 191 test files, 4690 -> 4303 tests, 121K -> 106K lines Local runtime: 319s -> 27s (11.9x speedup) Conceived by Romuald Członkowski - www.aiadvisors.pl/en Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: absorb config-validator satellite tests into consolidated file The previous commit deleted 4 config-validator satellite files. This properly merges their unique tests into the consolidated config-validator.test.ts, recovering 89 tests that were dropped during the bulk deletion. Deduplicates 5 tests that existed in both the satellite files and the security test file. Conceived by Romuald Członkowski - www.aiadvisors.pl/en Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: delete missed benchmark-pr.yml workflow, fix flaky session test - Remove benchmark-pr.yml that referenced deleted benchmark:ci script - Fix session-persistence round-trip test using timestamps closer to now to avoid edge cases exposed by removing retry:2 Conceived by Romuald Członkowski - www.aiadvisors.pl/en Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: rebuild FTS5 index after database rebuild to prevent stale rowid refs The FTS5 content-synced index could retain phantom rowid references from previous rebuild cycles, causing 'missing row N from content table' errors on MATCH queries. - Add explicit FTS5 rebuild command in rebuild script after all nodes saved - Add FTS5 rebuild in test beforeAll as defense-in-depth - Rebuild nodes.db with consistent FTS5 index Conceived by Romuald Członkowski - www.aiadvisors.pl/en Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use recent timestamps in all session persistence tests Session round-trip tests used timestamps 5-10 minutes in the past which could fail under CI load when combined with session timeout validation. Use timestamps 30 seconds in the past for all valid-session test data. Conceived by Romuald Członkowski - www.aiadvisors.pl/en Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
07bd1d4cc2
commit
de2abaf89d
@@ -27,10 +27,10 @@ describe('SingleSessionHTTPServer - Session Persistence', () => {
|
||||
|
||||
// Use current timestamps to avoid expiration
|
||||
const now = new Date();
|
||||
const createdAt1 = new Date(now.getTime() - 10 * 60 * 1000); // 10 minutes ago
|
||||
const lastAccess1 = new Date(now.getTime() - 5 * 60 * 1000); // 5 minutes ago
|
||||
const createdAt2 = new Date(now.getTime() - 15 * 60 * 1000); // 15 minutes ago
|
||||
const lastAccess2 = new Date(now.getTime() - 3 * 60 * 1000); // 3 minutes ago
|
||||
const createdAt1 = new Date(now.getTime() - 2 * 60 * 1000); // 2 minutes ago
|
||||
const lastAccess1 = new Date(now.getTime() - 30 * 1000); // 30 seconds ago
|
||||
const createdAt2 = new Date(now.getTime() - 3 * 60 * 1000); // 3 minutes ago
|
||||
const lastAccess2 = new Date(now.getTime() - 20 * 1000); // 20 seconds ago
|
||||
|
||||
// Access private properties for testing
|
||||
const serverAny = server as any;
|
||||
@@ -101,8 +101,8 @@ describe('SingleSessionHTTPServer - Session Persistence', () => {
|
||||
|
||||
// Create an active session (accessed recently)
|
||||
serverAny.sessionMetadata['active-session'] = {
|
||||
createdAt: new Date(now - 10 * 60 * 1000), // 10 minutes ago
|
||||
lastAccess: new Date(now - 5 * 60 * 1000) // 5 minutes ago
|
||||
createdAt: new Date(now - 2 * 60 * 1000), // 2 minutes ago
|
||||
lastAccess: new Date(now - 30 * 1000) // 30 seconds ago
|
||||
};
|
||||
serverAny.sessionContexts['active-session'] = {
|
||||
n8nApiUrl: 'https://active.example.com',
|
||||
@@ -257,8 +257,8 @@ describe('SingleSessionHTTPServer - Session Persistence', () => {
|
||||
{
|
||||
sessionId: 'active-session',
|
||||
metadata: {
|
||||
createdAt: new Date(now - 10 * 60 * 1000).toISOString(),
|
||||
lastAccess: new Date(now - 5 * 60 * 1000).toISOString()
|
||||
createdAt: new Date(now - 2 * 60 * 1000).toISOString(),
|
||||
lastAccess: new Date(now - 30 * 1000).toISOString()
|
||||
},
|
||||
context: {
|
||||
n8nApiUrl: 'https://active.example.com',
|
||||
@@ -465,8 +465,8 @@ describe('SingleSessionHTTPServer - Session Persistence', () => {
|
||||
it('should parse ISO 8601 timestamps correctly', () => {
|
||||
// Use current timestamps to avoid expiration
|
||||
const now = new Date();
|
||||
const createdAtDate = new Date(now.getTime() - 10 * 60 * 1000); // 10 minutes ago
|
||||
const lastAccessDate = new Date(now.getTime() - 5 * 60 * 1000); // 5 minutes ago
|
||||
const createdAtDate = new Date(now.getTime() - 2 * 60 * 1000); // 2 minutes ago
|
||||
const lastAccessDate = new Date(now.getTime() - 30 * 1000); // 30 seconds ago
|
||||
const createdAt = createdAtDate.toISOString();
|
||||
const lastAccess = lastAccessDate.toISOString();
|
||||
|
||||
@@ -500,8 +500,8 @@ describe('SingleSessionHTTPServer - Session Persistence', () => {
|
||||
// Create sessions with current timestamps
|
||||
const serverAny = server as any;
|
||||
const now = new Date();
|
||||
const createdAt = new Date(now.getTime() - 10 * 60 * 1000); // 10 minutes ago
|
||||
const lastAccess = new Date(now.getTime() - 5 * 60 * 1000); // 5 minutes ago
|
||||
const createdAt = new Date(now.getTime() - 60 * 1000); // 1 minute ago
|
||||
const lastAccess = new Date(now.getTime() - 30 * 1000); // 30 seconds ago
|
||||
|
||||
serverAny.sessionMetadata['session-1'] = {
|
||||
createdAt,
|
||||
|
||||
Reference in New Issue
Block a user