Commit 2a3bc2f4 authored by Aryan Noshirvani's avatar Aryan Noshirvani

Fix CI-only failure in test_music_upload_success

Passed locally (Python 3.12, full ffmpeg with libmp3lame) but 500'd in
CI (python:3.10-slim + apt --no-install-recommends ffmpeg, which lacks
mp3 encoding support on Debian - lame isn't in main due to licensing).
The test was generating its MP3 fixture via pydub -> ffmpeg encoding at
test time; swapped that for a small pre-committed real MP3 file instead.
mutagen only needs to *read* a valid MP3 to tag it, which has no such
encoder dependency, so this sidesteps the environment gap entirely
rather than trying to get CI's ffmpeg build to match local.
Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
parent fe838b82
Pipeline #991 failed with stage
in 6 minutes and 36 seconds
...@@ -3,14 +3,17 @@ import os ...@@ -3,14 +3,17 @@ import os
from src.api.routers import music as music_router from src.api.routers import music as music_router
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), "fixtures")
def _real_tiny_mp3_bytes(): def _real_tiny_mp3_bytes():
from pydub.generators import Sine # A pre-committed real MP3, not generated via pydub/ffmpeg at test time: CI's minimal
tone = Sine(440).to_audio_segment(duration=300).apply_gain(-6) # ffmpeg install (python:3.10-slim + apt --no-install-recommends) may not have libmp3lame
buf = io.BytesIO() # encoding support, which made this test 500 in CI while passing locally where ffmpeg
tone.export(buf, format="mp3", bitrate="64k") # has full codec support. mutagen only needs to *read* a valid MP3, which has no such
buf.seek(0) # dependency, so a fixture file sidesteps the encoder gap entirely.
return buf.read() with open(os.path.join(FIXTURES_DIR, "tiny.mp3"), "rb") as f:
return f.read()
async def _fake_identify_hit(path): async def _fake_identify_hit(path):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment