mirror of
https://github.com/n8n-io/n8n.git
synced 2026-08-29 01:39:24 +08:00
test: Pin system time for all workflow history compaction tests (#35916)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+10
-10
@@ -27,6 +27,16 @@ describe('WorkflowHistoryCompactionService', () => {
|
||||
},
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// Set the system to a time that isn't 3 AM to avoid hitting the "trim once a day" window
|
||||
const mockDate = new Date(2026, 10, 10, 1, 0, 0);
|
||||
vi.setSystemTime(mockDate);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
describe('init', () => {
|
||||
it('should start compacting on main instance that is the leader', () => {
|
||||
const compactingService = new WorkflowHistoryCompactionService(
|
||||
@@ -64,16 +74,6 @@ describe('WorkflowHistoryCompactionService', () => {
|
||||
});
|
||||
|
||||
describe('startCompacting', () => {
|
||||
beforeEach(() => {
|
||||
// Set the system to a time that isn't 3 AM to avoid hitting the "trim once a day" window
|
||||
const mockDate = new Date(2026, 10, 10, 1, 0, 0);
|
||||
vi.setSystemTime(mockDate);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('should start compacting if service is enabled and DB is migrated', () => {
|
||||
const compactingService = new WorkflowHistoryCompactionService(
|
||||
config,
|
||||
|
||||
Reference in New Issue
Block a user