Skip to content

Conversation

@habrahamsson-skanetrafiken
Copy link
Contributor

@habrahamsson-skanetrafiken habrahamsson-skanetrafiken commented Sep 25, 2025

Summary

This is a first refactor of the RealtimeTestEnvironment after discussion with @t2gran and @leonardehrenfried. There will be more upcoming changes.

The purpose is to make the RealtimeTestEnvironment into a more general framework for setting up and testing transit entities.

It only touches tests and should be a pure refactor.

  • Separate gtfs-rt and siri specific methods in their own classes.
  • Rename RealtimeTestEnvironment to TransitTestEnvironment
  • Reduce dependencies on TimetableRepositoryForTest.
  • Encapsulate date and timezone in the test environment
  • Create a thin helper class TripOnDateDataFetcher to simplify fetching data from the TransitModel.
  • The default feed id is not configurable in the TransitTestEnvironment. The reason is that having a static method for creating test ids will greatly simplify converting existing tests to this new framework.

Issue

#6887

Bumping the serialization version id

No

@habrahamsson-skanetrafiken habrahamsson-skanetrafiken requested a review from a team as a code owner September 25, 2025 11:04
@habrahamsson-skanetrafiken habrahamsson-skanetrafiken added the +Skip Changelog This is not a relevant change for a product owner since last release. label Sep 25, 2025
@habrahamsson-skanetrafiken habrahamsson-skanetrafiken changed the title Test encapsulate service date Make the RealtimeTestEnvironment into TransitTestEnvironment Sep 25, 2025
@codecov
Copy link

codecov bot commented Sep 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.17%. Comparing base (8d33b0e) to head (9bd7180).
⚠️ Report is 375 commits behind head on dev-2.x.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6899      +/-   ##
=============================================
+ Coverage      72.10%   72.17%   +0.06%     
- Complexity     19654    19833     +179     
=============================================
  Files           2123     2155      +32     
  Lines          79410    80044     +634     
  Branches        8049     8082      +33     
=============================================
+ Hits           57257    57770     +513     
- Misses         19316    19425     +109     
- Partials        2837     2849      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@leonardehrenfried
Copy link
Member

leonardehrenfried commented Sep 25, 2025

This will probably conflict with #6894

@leonardehrenfried
Copy link
Member

#6894 has been merged so you will have to resolve the conflicts.

The service dates are now part of TripInput, not the environment so it's configurable.

Copy link
Member

@t2gran t2gran left a comment

Choose a reason for hiding this comment

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

This is not a full review, only touching a few architectural issues - when these are resolved I will look at the rest of the code.

Copy link
Member

@leonardehrenfried leonardehrenfried left a comment

Choose a reason for hiding this comment

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

I've picked up on a few things.

I know that we have different opinions on string constants, so I'm happy to go along with your way of doing things.

Copy link
Member

@leonardehrenfried leonardehrenfried left a comment

Choose a reason for hiding this comment

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

I'm not sure the how easily we can move away from TimetableRepositoryForTest if we don't return builders.

@habrahamsson-skanetrafiken habrahamsson-skanetrafiken changed the title Make the RealtimeTestEnvironment into TransitTestEnvironment Repurpose the RealtimeTestEnvironment into a TransitTestEnvironment Oct 16, 2025
Copy link
Member

@leonardehrenfried leonardehrenfried left a comment

Choose a reason for hiding this comment

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

I will give you permission to merge this in my absence even if you have to make changes.

@habrahamsson-skanetrafiken habrahamsson-skanetrafiken merged commit adfa6a7 into opentripplanner:dev-2.x Oct 21, 2025
8 checks passed
@habrahamsson-skanetrafiken habrahamsson-skanetrafiken deleted the test-encapsulate-service-date branch October 21, 2025 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

+Skip Changelog This is not a relevant change for a product owner since last release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants