-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
editoast: PacedTrain: add simulation summary and simulation endpoints #11022
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## dev #11022 +/- ##
==========================================
+ Coverage 80.63% 81.10% +0.46%
==========================================
Files 1099 801 -298
Lines 112187 81000 -31187
Branches 745 747 +2
==========================================
- Hits 90460 65692 -24768
+ Misses 21684 15265 -6419
Partials 43 43
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1b17958
to
6d14fda
Compare
6d14fda
to
be809ed
Compare
03cc77d
to
422d56e
Compare
73ffba7
to
e44d339
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Left a few comments, but nothing really blocking apart the ones about tests
editoast/src/views/paced_train.rs
Outdated
) | ||
.as_str(), | ||
); | ||
app.fetch(request).assert_status(StatusCode::OK); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test isn't really testing anything really. If we break the simulation processing at some point, but still return OK, this test won't catch anything even though there is indeed a regression. Better assert on the output of the endpoint, or at least check for some properties on it if it's too lengthy. Otherwise you could use insta
for snapshot testing (it's already used in editoast to test the output of derive macros).
"ids": vec![paced_train_id], | ||
})); | ||
app.fetch(request).assert_status(StatusCode::OK); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error cases could be tested as well.
7c1cb3f
to
e1d6882
Compare
@@ -172,7 +172,7 @@ pub struct InfraIdQueryParam { | |||
|
|||
#[derive(Debug, Serialize, ToSchema)] | |||
#[serde(tag = "status", rename_all = "snake_case")] | |||
enum SimulationSummaryResult { | |||
pub enum SimulationSummaryResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to change the visibility? If I understand correctly, it's only used in submodules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also need it for tests.
@@ -1105,7 +1107,7 @@ mod tests { | |||
) | |||
} | |||
|
|||
fn mocked_core_pathfinding_sim_and_proj(train_id: i64) -> MockingClient { | |||
pub(in crate::views) fn mocked_core_pathfinding_sim_and_proj(train_id: i64) -> MockingClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of changing the visibility, how about moving this function inside src/views/mod.rs
and exposing it only for tests. Because if it's a function that is supposed to be used by 2 different submodules of views
, then it's now a utility of views
, not anymore a simple function of view::train_schedule
.
pub(in crate::views) fn mocked_core_pathfinding_sim_and_proj(train_id: i64) -> MockingClient { | |
#[cfg(test)] | |
pub fn mocked_core_pathfinding_sim_and_proj(train_id: i64) -> MockingClient { |
e1d6882
to
13b13bc
Compare
@@ -15,8 +15,10 @@ const config: ConfigFile = { | |||
'postInfraByInfraIdPathfinding', | |||
'postInfraByInfraIdPathfindingBlocks', | |||
'postInfraByInfraIdPathProperties', | |||
'postPacedTrainSimulationSummary', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'postPacedTrainSimulationSummary', |
@@ -15,8 +15,10 @@ const config: ConfigFile = { | |||
'postInfraByInfraIdPathfinding', | |||
'postInfraByInfraIdPathfindingBlocks', | |||
'postInfraByInfraIdPathProperties', | |||
'postPacedTrainSimulationSummary', | |||
'postTrainSchedule', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not (directly) related to your PR, this one doesn't exist anymore since this PR.
…rain Signed-off-by: Youness CHRIFI ALAOUI <[email protected]>
13b13bc
to
956a5d7
Compare
Add simulation summary and simulation endpoints for paced trains.
Part of https://github.com/osrd-project/osrd-confidential/issues/779