|
1 | 1 | // Copyright (c) Microsoft Corporation. |
2 | 2 | // Licensed under the MIT license. |
3 | 3 | import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; |
4 | | -import { loadFilterConfig, loadOverrideConfig, loadOTelConfig } from '../../../src/lib/config-loader.js'; |
| 4 | +import { loadFilterConfig, loadOverrideConfig } from '../../../src/lib/config-loader.js'; |
5 | 5 | import { logger } from '../../../src/lib/logger.js'; |
6 | 6 | import * as fs from 'node:fs/promises'; |
7 | 7 | import * as path from 'node:path'; |
@@ -558,47 +558,4 @@ namedValues: |
558 | 558 | ); |
559 | 559 | }); |
560 | 560 | }); |
561 | | - |
562 | | - describe('loadOTelConfig', () => { |
563 | | - it('should load a valid OTel YAML file', async () => { |
564 | | - const content = ` |
565 | | -exporters: |
566 | | - otlp: |
567 | | - endpoint: "http://localhost:4317" |
568 | | -service: |
569 | | - pipelines: |
570 | | - traces: |
571 | | - exporters: [otlp] |
572 | | -`; |
573 | | - const filePath = path.join(tmpDir, 'otel.yaml'); |
574 | | - await fs.writeFile(filePath, content, 'utf-8'); |
575 | | - |
576 | | - const config = await loadOTelConfig(filePath); |
577 | | - expect(config).toBeDefined(); |
578 | | - expect(config!.exporters).toBeDefined(); |
579 | | - }); |
580 | | - |
581 | | - it('should return undefined for missing file', async () => { |
582 | | - const config = await loadOTelConfig(path.join(tmpDir, 'nonexistent.yaml')); |
583 | | - expect(config).toBeUndefined(); |
584 | | - }); |
585 | | - |
586 | | - it('should handle completely empty file', async () => { |
587 | | - const filePath = path.join(tmpDir, 'blank.yaml'); |
588 | | - await fs.writeFile(filePath, '', 'utf-8'); |
589 | | - |
590 | | - const config = await loadOTelConfig(filePath); |
591 | | - expect(config).toBeDefined(); |
592 | | - expect(config).toEqual({}); |
593 | | - }); |
594 | | - |
595 | | - it('should handle file with only whitespace', async () => { |
596 | | - const filePath = path.join(tmpDir, 'whitespace.yaml'); |
597 | | - await fs.writeFile(filePath, ' \n \n ', 'utf-8'); |
598 | | - |
599 | | - const config = await loadOTelConfig(filePath); |
600 | | - expect(config).toBeDefined(); |
601 | | - expect(config).toEqual({}); |
602 | | - }); |
603 | | - }); |
604 | 561 | }); |
0 commit comments