Skip to content

Conversation

@ARCoder181105
Copy link
Contributor

Description

Fixes a FOREIGN KEY constraint failed error in TestStopHandlerMultiAgencyScenario by adding the missing calendar/service entry that trips reference.

Problem

The test creates trips with ServiceID: "service1" but never creates the corresponding calendar entry in the database, causing the test to fail with:

FOREIGN KEY constraint failed
Error Trace: /internal/restapi/stop_handler_test.go:214

Solution

Added CreateCalendar call to create the service1 calendar entry before creating trips that reference it.

Changes

  • Added calendar creation in TestStopHandlerMultiAgencyScenario (line ~205)
  • Ensures foreign key constraint trips.service_idcalendar.id is satisfied

Testing

go test -v ./internal/restapi -run TestStopHandlerMultiAgencyScenario

✅ Test now passes

Related

Copy link
Member

@aaronbrethorst aaronbrethorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work, thanks for tracking this down and fixing it.

@aaronbrethorst aaronbrethorst merged commit c3385bd into OneBusAway:main Feb 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants