Skip to content

Commit 7f49f87

Browse files
authored
Add diagnostics OTEL capability contract tests (#92045)
1 parent bd10e19 commit 7f49f87

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

src/plugins/manifest-registry.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,38 @@ describe("loadPluginManifestRegistry", () => {
699699
expect(registry.plugins[0]?.trustedOfficialInstall).toBe(true);
700700
});
701701

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+
702734
it("preserves trusted official installs when a config path selects the installed package", () => {
703735
const dir = makeTempDir();
704736
writeManifest(dir, { id: "diagnostics-prometheus", configSchema: { type: "object" } });

src/plugins/services.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,23 @@ describe("startPluginServices", () => {
369369
expect(prometheusContexts[0]?.internalDiagnostics?.onEvent).toBeTypeOf("function");
370370
expect(prometheusContexts[0]?.internalDiagnostics?.emit).toBeTypeOf("function");
371371

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+
372389
const officialInstallContexts: OpenClawPluginServiceContext[] = [];
373390
const officialInstallService = createTrackingService("diagnostics-prometheus", {
374391
contexts: officialInstallContexts,

0 commit comments

Comments
 (0)