feat(platform): add ops capacity handoff

This commit is contained in:
lingniu
2026-07-04 20:37:20 +08:00
parent c0b99e9a3a
commit 87fa0f524c
2 changed files with 58 additions and 1 deletions

View File

@@ -3497,6 +3497,11 @@ test('renders notification rules as a standalone operations page', async () => {
test('renders ops quality as a standalone runtime health page', async () => {
window.history.replaceState(null, '', '/#/ops-quality');
const writeText = vi.fn(() => Promise.resolve());
Object.defineProperty(navigator, 'clipboard', {
configurable: true,
value: { writeText }
});
const fetchMock = vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
const path = String(input);
if (path.includes('/api/ops/health')) {
@@ -3579,6 +3584,14 @@ test('renders ops quality as a standalone runtime health page', async () => {
expect(screen.getAllByText('NATS 桥接待消费').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('桥接处置顺序')).toBeInTheDocument();
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('/api/ops/health'), undefined);
fireEvent.click(screen.getByRole('button', { name: '复制容量交接' }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【车辆数据中台运维容量交接】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('运行版本platform-ops-test'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('Kafka Lag42'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('NATS桥接consumer pending 1,482,047 / ack pending 4,000'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('存储状态TDengine 正常 / MySQL 异常'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('1. 先看 Kafka Lag 与 NATS ACK pending'));
});
test('copies notification text from quality priority queue', async () => {