mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-10 22:03:18 +08:00
fix: add actionable DingTalk connection diagnostics
This commit is contained in:
parent
3010535409
commit
1b05fa8d32
18 changed files with 1038 additions and 299 deletions
|
|
@ -276,6 +276,7 @@ test('sender approval uses opaque request and sender keys while raw staff IDs st
|
|||
test('runtime activation failure retains the authorized bot for reconnect without exposing detail', async () => {
|
||||
let startCount = 0;
|
||||
const events = [];
|
||||
const logs = [];
|
||||
const credentials = credentialsFixture(events);
|
||||
const configs = configFixture([], events);
|
||||
const runtimes = runtimeFactory({ events, failStart: () => startCount++ === 0 });
|
||||
|
|
@ -284,7 +285,7 @@ test('runtime activation failure retains the authorized bot for reconnect withou
|
|||
credentials: credentials.provider,
|
||||
configStore: configs.store,
|
||||
createRuntime: runtimes.createRuntime,
|
||||
logger: { error() {}, warn() {} },
|
||||
logger: { error: (...args) => logs.push(args), warn() {} },
|
||||
clock: () => 1_000,
|
||||
});
|
||||
const begun = await controller.startProvisioning();
|
||||
|
|
@ -296,10 +297,15 @@ test('runtime activation failure retains the authorized bot for reconnect withou
|
|||
const status = controller.status();
|
||||
assert.deepEqual(status.totals, { configured: 1, connected: 0 });
|
||||
assert.equal(status.bots[0].state, 'error');
|
||||
assert.equal(status.bots[0].error.code, 'connection-failed');
|
||||
assert.equal(status.bots[0].error.code, 'stream-connect-failed');
|
||||
assert.match(status.bots[0].error.referenceId, /^DT-CONN-[A-F0-9]{8}$/);
|
||||
assert.match(status.bots[0].error.hint, /dsh web 日志/);
|
||||
assert.equal(logs.length, 1);
|
||||
assert.match(logs[0][0], new RegExp(status.bots[0].error.referenceId));
|
||||
assert.equal(logs[0][1].category, 'stream-connect-failed');
|
||||
assert.equal(events.some(([event]) => event === 'unset' || event === 'remove'), false);
|
||||
assert.doesNotMatch(
|
||||
JSON.stringify({ completed, status }),
|
||||
JSON.stringify({ completed, status, logs }),
|
||||
/private-secret|client-secret-private|device-code-private|secretRef/,
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue