test: add E2E coverage for DUPLICATED real-time trips - #1298
Conversation
- Refactor buildTripsForRouteFixtureZip for fixture reuse. - Add createTestApiWithTripsForRouteAndRealtime to inject a DUPLICATED vehicle with a suffixed trip ID. - Add TestTripsForRouteHandler_DuplicatedRealtimeTrip to assert base trip resolution and schedule population end-to-end.
|
Warning Review limit reached
Next review available in: 37 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change adds end-to-end test coverage for ChangesDUPLICATED trip coverage
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/restapi/trips_for_route_handler_test.go`:
- Around line 226-228: Update the assertions in the schedule stop-time loop of
the trip-for-route handler test to verify the exact expected combined stop IDs,
rather than merely checking for an underscore. Assert both expected agency/stop
ID combinations in schedule order.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b5b59c93-0de7-4ad6-97ef-f672c7f13a47
📒 Files selected for processing (1)
internal/restapi/trips_for_route_handler_test.go
- Replace the loose substring containment check with a strict, ordered slice equality assertion. - Ensure the exact expected combined stop IDs are returned in the correct schedule order.
|



Description
This PR addresses end-to-end test coverage for the
DUPLICATEDreal-time trips path in thetrips-for-routehandler. It ensures that the handler correctly resolves base trips for duplicated vehicles using thestripNumericSuffixfallback and successfully populates the schedule and reference data.Changes Made
buildTripsForRouteFixtureZipto allow reusing the synthetic GTFS static dataset across multiple tests.createTestApiWithTripsForRouteAndRealtimeto spin up a mock GTFS-RT feed serving aDUPLICATEDvehicle with a suffixed trip ID (e.g.,tfr-trip.00060), matching the Java-OBA format.TestTripsForRouteHandler_DuplicatedRealtimeTripto verify that:tripId.references.tripswith all associated static data (route, headsign, block).Closes: #1297
Summary by CodeRabbit