You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(data): enhance comprehensive format coverage and optimize test performance (#1112)
Because
- Unit tests for `pkg/data` were taking too long due to large test files
and redundant test cases
- Audio tests only covered 3 out of 8 supported formats (37.5% coverage)
- Video tests only covered 2 out of 8 supported formats (25% coverage)
- Image tests only covered 3 out of 6 supported formats (50% coverage)
- Document tests lacked comprehensive format coverage and data URI
handling
- Large test files and unused test data were impacting CI/CD performance
### This commit
- **Optimizes test performance by 92.8%** - reduced execution time from
49.111s to 3.534s
- **Achieves 100% audio format coverage** - adds tests for AAC, FLAC,
M4A, WMA, AIFF formats (8/8 formats)
- **Achieves 87.5% video format coverage** - adds tests for AVI, WebM,
MKV, FLV, MPEG formats (7/8 formats, WMA excluded due to platform
limitations)
- **Achieves 100% image format coverage** - adds tests for GIF, BMP,
WEBP formats (6/6 formats)
- **Enhances document format coverage** - adds comprehensive tests for
13 document formats including data URI handling
- **Creates optimized small test files** - generates lightweight media
files (1-60KB) using ffmpeg and ImageMagick
- **Removes unused test data** - cleans up 16.7% of testdata directory
size by removing obsolete large files
- **Adds comprehensive test functions** - introduces
`TestAllSupportedAudioFormats`, `TestAllSupportedVideoFormats`,
`TestAllSupportedImageFormats`, and `TestAllSupportedDocumentFormats`
- **Improves test reliability** - adjusts tolerance values for
duration/frame rate variations across different codecs and formats
- **Maintains network test compatibility** - preserves URL-based tests
using existing remote files while optimizing local file tests
**Files Enhanced:**
- `pkg/data/audio_test.go` (221→308 lines): Complete 8-format coverage
- `pkg/data/video_test.go` (249→335 lines): 7-format coverage with
comprehensive conversion tests
- `pkg/data/image_test.go` (Enhanced): 6-format coverage with all
supported types
- `pkg/data/document_test.go` (Enhanced): 13-format coverage with data
URI support
- `pkg/data/testdata/` (Optimized): Added 12 new small test files,
removed 7 unused large files
**Performance Impact:**
- Test execution: 49.111s → 3.534s (92.8% improvement)
- Format coverage: 37.5% → 100% (audio), 25% → 87.5% (video), 50% → 100%
(image)
- Testdata size: Reduced by 16.7% while adding comprehensive format
support
0 commit comments