Add diagnostics OTEL capability contract tests (#92045) · openclaw/openclaw@7f49f87
efpiva
·
2026-06-14
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -699,6 +699,38 @@ describe("loadPluginManifestRegistry", () => {
|
699 | 699 | expect(registry.plugins[0]?.trustedOfficialInstall).toBe(true); |
700 | 700 | }); |
701 | 701 | |
| 702 | +it("marks official diagnostics-otel config paths trusted when the install record matches", () => { |
| 703 | +const dir = makeTempDir(); |
| 704 | +writeManifest(dir, { id: "diagnostics-otel", configSchema: { type: "object" } }); |
| 705 | + |
| 706 | +const registry = loadPluginManifestRegistry({ |
| 707 | +installRecords: { |
| 708 | +"diagnostics-otel": { |
| 709 | +source: "npm", |
| 710 | +spec: "@openclaw/diagnostics-otel", |
| 711 | +installPath: dir, |
| 712 | +resolvedName: "@openclaw/diagnostics-otel", |
| 713 | +resolvedVersion: "2026.5.18", |
| 714 | +resolvedSpec: "@openclaw/diagnostics-otel@2026.5.18", |
| 715 | +}, |
| 716 | +}, |
| 717 | +candidates: [ |
| 718 | +createPluginCandidate({ |
| 719 | +idHint: "diagnostics-otel", |
| 720 | +rootDir: dir, |
| 721 | +packageName: "@openclaw/diagnostics-otel", |
| 722 | +origin: "config", |
| 723 | +}), |
| 724 | +], |
| 725 | +}); |
| 726 | + |
| 727 | +expect(registry.plugins).toHaveLength(1); |
| 728 | +expectRecordFields(registry.plugins[0], "plugin", { |
| 729 | +origin: "config", |
| 730 | +trustedOfficialInstall: true, |
| 731 | +}); |
| 732 | +}); |
| 733 | + |
702 | 734 | it("preserves trusted official installs when a config path selects the installed package", () => { |
703 | 735 | const dir = makeTempDir(); |
704 | 736 | writeManifest(dir, { id: "diagnostics-prometheus", configSchema: { type: "object" } }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -369,6 +369,23 @@ describe("startPluginServices", () => {
|
369 | 369 | expect(prometheusContexts[0]?.internalDiagnostics?.onEvent).toBeTypeOf("function"); |
370 | 370 | expect(prometheusContexts[0]?.internalDiagnostics?.emit).toBeTypeOf("function"); |
371 | 371 | |
| 372 | +const officialDiagnosticsOtelContexts: OpenClawPluginServiceContext[] = []; |
| 373 | +const officialDiagnosticsOtelService = createTrackingService("diagnostics-otel", { |
| 374 | +contexts: officialDiagnosticsOtelContexts, |
| 375 | +}); |
| 376 | +await startPluginServices({ |
| 377 | +registry: createRegistry( |
| 378 | +[officialDiagnosticsOtelService], |
| 379 | +"diagnostics-otel", |
| 380 | +"config", |
| 381 | +true, |
| 382 | +), |
| 383 | +config: createServiceConfig(), |
| 384 | +}); |
| 385 | + |
| 386 | +expect(officialDiagnosticsOtelContexts[0]?.internalDiagnostics?.onEvent).toBeTypeOf("function"); |
| 387 | +expect(officialDiagnosticsOtelContexts[0]?.internalDiagnostics?.emit).toBeTypeOf("function"); |
| 388 | + |
372 | 389 | const officialInstallContexts: OpenClawPluginServiceContext[] = []; |
373 | 390 | const officialInstallService = createTrackingService("diagnostics-prometheus", { |
374 | 391 | contexts: officialInstallContexts, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。