diff --git a/.github/workflows/pr-test.yaml b/.github/workflows/pr-test.yaml index 170d83c..5f44d9a 100644 --- a/.github/workflows/pr-test.yaml +++ b/.github/workflows/pr-test.yaml @@ -9,8 +9,21 @@ concurrency: cancel-in-progress: true jobs: - e2e-test: + test: runs-on: ubuntu-latest + strategy: + matrix: + test-group: + - name: "Agent Service" + command: "python services/AgentService/test_api.py" + - name: "PDF Service" + command: "python services/PDFService/test_api.py" + - name: "TTS Service" + command: "python services/TTSService/test_api.py" + - name: "Monologue E2E" + command: "python tests/test.py --monologue --target bofa-context.pdf --context citi-context.pdf" + - name: "Podcast E2E" + command: "python tests/test.py --target bofa-context.pdf --context citi-context.pdf" steps: - uses: actions/checkout@v4 @@ -32,10 +45,12 @@ jobs: - name: Install test dependencies run: | python -m pip install --upgrade pip - pip install -r tests/requirements-test.txt # Make sure this file exists with your test dependencies + pip install -r tests/requirements-test.txt - - name: Run monologue E2E tests - run: python tests/test.py --monologue --target bofa-context.pdf --context citi-context.pdf + - name: Pip install shared package + run: | + cd shared + pip install . - - name: Run podcast E2E tests - run: python tests/test.py --target bofa-context.pdf --context citi-context.pdf + - name: Run ${{ matrix.test-group.name }} tests + run: ${{ matrix.test-group.command }} diff --git a/services/AgentService/test_api.py b/services/AgentService/test_api.py index 705028a..300863a 100644 --- a/services/AgentService/test_api.py +++ b/services/AgentService/test_api.py @@ -4,6 +4,7 @@ import time from shared.api_types import TranscriptionRequest from shared.pdf_types import PDFMetadata +from datetime import datetime def test_transcribe_api(): @@ -13,35 +14,42 @@ def test_transcribe_api(): # Create a proper TranscriptionRequest pdf_metadata_1 = PDFMetadata( - filename="sample.pdf", markdown="Sample markdown content", summary="" + filename="sample.pdf", + type="target", + markdown="Sample markdown content", + summary="", + status="success", + created_at=datetime.utcnow(), ) pdf_metadata_2 = PDFMetadata( - filename="sample2.pdf", markdown="Sample markdown content 2", summary="" - ) - - pdf_metadata_3 = PDFMetadata( - filename="sample3.pdf", markdown="Sample markdown content 3", summary="" + filename="sample2.pdf", + type="context", + markdown="Sample markdown content 2", + summary="", + status="success", + created_at=datetime.utcnow(), ) request = TranscriptionRequest( # TranscriptionParams fields + userId="test-agent-service", name="Test Podcast", duration=2, # Duration in minutes + monologue=True, speaker_1_name="Host", - speaker_2_name="Guest", voice_mapping={ - "speaker-1": "iP95p4xoKVk53GoZ742B", # Example voice ID - "speaker-2": "9BWtsMINqrJLrRacOk9x", # Example voice ID + "speaker-1": "iP95p4xoKVk53GoZ742B", }, - guide="Sample focus instructions", # Optional + guide="Sample focus instructions", # TranscriptionRequest specific fields - pdf_metadata=[pdf_metadata_1, pdf_metadata_2, pdf_metadata_3], + pdf_metadata=[pdf_metadata_1, pdf_metadata_2], job_id="test-job-123", + vdb_task=False, ) # Send POST request - response = requests.post(TRANSCRIBE_URL, json=request.model_dump()) + response = requests.post(TRANSCRIBE_URL, json=request.model_dump(mode="json")) # Check if the request was successful assert ( diff --git a/services/PDFService/test_api.py b/services/PDFService/test_api.py index addea3a..a293aef 100644 --- a/services/PDFService/test_api.py +++ b/services/PDFService/test_api.py @@ -190,9 +190,11 @@ def test_health_endpoint(): def main(): """Main entry point for the test script""" - if len(sys.argv) < 2: - print("Usage: python test_api.py [path_to_pdf_file2 ...]") - sys.exit(1) + # Hardcode two sample files + sample_files = [ + "samples/bofa-context.pdf", + "samples/citi-context.pdf" + ] print("Running PDF Service API tests...") @@ -201,7 +203,7 @@ def main(): sys.exit(1) print("\nTest 2: Valid PDF conversion") - if not test_convert_pdf_endpoint(sys.argv[1:]): + if not test_convert_pdf_endpoint(sample_files): sys.exit(1) print("\nTest 3: Invalid file handling") diff --git a/services/TTSService/test_api.py b/services/TTSService/test_api.py index a00e98b..9a290a2 100644 --- a/services/TTSService/test_api.py +++ b/services/TTSService/test_api.py @@ -51,7 +51,7 @@ def test_tts_api(): try: # Load sample JSON data - with open("sample.json", "r") as f: + with open("services/TTSService/sample.json", "r") as f: data = json.load(f) # Add job_id if not present diff --git a/tests/requirements-test.txt b/tests/requirements-test.txt index 1ed21c7..340e51d 100644 --- a/tests/requirements-test.txt +++ b/tests/requirements-test.txt @@ -1,2 +1,4 @@ requests -websockets \ No newline at end of file +websockets +ujson +fastapi \ No newline at end of file