Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions .github/workflows/pr-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
32 changes: 20 additions & 12 deletions services/AgentService/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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 (
Expand Down
10 changes: 6 additions & 4 deletions services/PDFService/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_file1> [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...")

Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion services/TTSService/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion tests/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
requests
websockets
websockets
ujson
fastapi