Execution: reclaim the directories of Ended Tickets after a retention

This commit is contained in:
2026-11-02 01:46:33 +08:00
parent b348d69beb
commit 3bee231da6
18 changed files with 326 additions and 18 deletions
+15 -4
View File
@@ -11,8 +11,8 @@ it('leads the overview with the pending Tickets, then problems, the last day and
await mount()
expect(tab(zh['tab.overview']).getAttribute('aria-selected')).toBe('true')
expect(all('[role="tab"]').map(tab => tab.textContent)).toEqual(['概览', '来源', '触发', '评估', '执行', '设置'])
expect(all('.dt-section-title').map(title => title.textContent)).toEqual(['待处理工单2', '系统问题2', '存活', '过去 24 小时详情 ›',
'执行器详情 ›'])
expect(all('.dt-section-title').map(title => title.textContent)).toEqual(['待处理工单2', '系统问题2', '存活', '工单目录',
'过去 24 小时详情 ›', '执行器详情 ›'])
expect(all('.dt-cards .dt-ticket-stage').map(item => item.textContent)).toEqual(['待回答', '待处理失败'])
expect(all('.dt-cards .dt-att-what').map(item => item.textContent)).toEqual(['飞书 来源异常', '评估未完成:这个文案好奇怪'])
// Actions sit below the title and Threads, apart from the stage, each with its icon.
@@ -22,9 +22,11 @@ it('leads the overview with the pending Tickets, then problems, the last day and
expect(text()).toContain('需要确认按钮颜色')
// Durations are formatted by the interface language, so the readout is asserted by label, and only the polling word verbatim.
expect(all('.dt-stat-label').map(label => label.textContent)).toEqual([zh.livenessUptime, zh.livenessLastPoll, zh.livenessPolling,
zh.workspaceHeld, zh.workspaceCandidates, zh.workspaceDirCount, zh.reclaimAfterDays,
zh.flowReceivedLabel, zh.flowFilteredLabel, zh.flowJudgedLabel, zh.flowAcceptedLabel, zh.executingLabel, zh.queuedLabel,
zh.idleLabel])
expect(all('.dt-stat-value').map(value => value.textContent).slice(3)).toEqual(['12', '2', '5', '1', '2 / 3', '0', '1'])
expect(all('.dt-stat-value').map(value => value.textContent).slice(7)).toEqual(['12', '2', '5', '1', '2 / 3', '0', '1'])
expect(all('.dt-stat-value').map(value => value.textContent)[3]).toBe('58.0 MB')
expect(all('.dt-stat-value').map(value => value.textContent).slice(0, 3)).toEqual([expect.stringContaining('小时'), expect
.stringContaining('秒'), zh.livenessPolling])
expect(all('.dt-chip').map(chip => chip.textContent)[0]).toBe('GitHub#42CI 失败1')
@@ -134,9 +136,10 @@ it('words a refused retry in the interface language by its code', async () => {
it('shows the overview in English', async () => {
await mount(en)
expect(all('.dt-section-title').map(title => title.textContent)).toEqual([`${en.pendingTickets}2`, `${en.problems}2`,
en.livenessTitle, `${en.lastDay}${en.details}`, `${en['term.executor']}${en.details}`])
en.livenessTitle, en.workspaceTitle, `${en.lastDay}${en.details}`, `${en['term.executor']}${en.details}`])
expect(all('.dt-cards .dt-ticket-stage').map(item => item.textContent)).toEqual([en['stage.answer'], en['stage.failed']])
expect(all('.dt-stat-label').map(label => label.textContent)).toEqual([en.livenessUptime, en.livenessLastPoll, en.livenessPolling,
en.workspaceHeld, en.workspaceCandidates, en.workspaceDirCount, en.reclaimAfterDays,
en.flowReceivedLabel, en.flowFilteredLabel, en.flowJudgedLabel, en.flowAcceptedLabel, en.executingLabel, en.queuedLabel, en.idleLabel])
})
@@ -174,3 +177,11 @@ it('says when a Source stopped polling, with how long its last round was and the
expect(line).toBe(zh.problemStalled.replace('{source}', 'GitHub').replace('{age}', duration(26 * 60_000, 'zh')))
expect(text()).toContain(zh.problemStalledHint)
})
it('reads out what the ended Tickets still hold, and that nothing is ever removed when the retention is zero', async () => {
server.workspace = { root: '/srv/work', afterDays: 0, directories: 3, candidates: 0, bytes: 0, lastScanAt: new Date().toISOString(),
unreadable: 0 }
await mount()
expect(text()).toContain(zh.workspaceKeepForever)
expect(all('.dt-stat-value').map(value => value.textContent)).toContain('0')
})