test(diagnostics-otel): update mocks for OpenTelemetry v2.x API
Update test mocks to match the new OpenTelemetry v2.x API: - Replace Resource class with resourceFromAttributes function - Replace SemanticResourceAttributes with ATTR_SERVICE_NAME - Update LoggerProvider mock to accept processors in constructor This fixes the test failures that were blocking CI checks. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
df26d4a164
commit
8d35b044c1
@ -65,7 +65,9 @@ vi.mock("@opentelemetry/exporter-logs-otlp-http", () => ({
|
||||
vi.mock("@opentelemetry/sdk-logs", () => ({
|
||||
BatchLogRecordProcessor: class {},
|
||||
LoggerProvider: class {
|
||||
addLogRecordProcessor = vi.fn();
|
||||
constructor(_options?: unknown) {
|
||||
// v2.x: processors are passed in constructor
|
||||
}
|
||||
getLogger = vi.fn(() => ({
|
||||
emit: logEmit,
|
||||
}));
|
||||
@ -83,16 +85,13 @@ vi.mock("@opentelemetry/sdk-trace-base", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("@opentelemetry/resources", () => ({
|
||||
Resource: class {
|
||||
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||
constructor(_value?: unknown) {}
|
||||
},
|
||||
resourceFromAttributes: vi.fn((attributes?: unknown) => ({
|
||||
attributes,
|
||||
})),
|
||||
}));
|
||||
|
||||
vi.mock("@opentelemetry/semantic-conventions", () => ({
|
||||
SemanticResourceAttributes: {
|
||||
SERVICE_NAME: "service.name",
|
||||
},
|
||||
ATTR_SERVICE_NAME: "service.name",
|
||||
}));
|
||||
|
||||
vi.mock("openclaw/plugin-sdk", async () => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user