Background
Raised during review of PR #116 by @leynos.
register_github_issue_routine in tests/support/routines.rs currently panics on database error via .expect("create_routine"). It should propagate errors to callers instead.
Required changes
1. Update the function signature in tests/support/routines.rs
Change the signature from:
pub async fn register_github_issue_routine(
db: &Arc<dyn Database>,
engine: &RoutineEngine,
) -> Routine
to:
pub async fn register_github_issue_routine(
db: &Arc<dyn Database>,
engine: &RoutineEngine,
) -> Result<Routine, Box<dyn std::error::Error>>
Replace:
db.create_routine(&routine).await.expect("create_routine");
with:
db.create_routine(&routine).await?;
and return Ok(routine) at the end.
2. Update all call-sites
Update all callers of register_github_issue_routine (e.g. in tests/e2e_traces/routine_system_event.rs) to propagate the error using ? or .expect() inside the #[tokio::test] function body. (.expect() is permitted inside #[test]-attributed functions.)
Acceptance criteria
register_github_issue_routine returns Result<Routine, Box<dyn std::error::Error>>.
- No
.expect("create_routine") remains inside the helper function body.
- All call-sites handle the
Result appropriately.
References
Background
Raised during review of PR #116 by @leynos.
register_github_issue_routineintests/support/routines.rscurrently panics on database error via.expect("create_routine"). It should propagate errors to callers instead.Required changes
1. Update the function signature in
tests/support/routines.rsChange the signature from:
to:
Replace:
with:
and return
Ok(routine)at the end.2. Update all call-sites
Update all callers of
register_github_issue_routine(e.g. intests/e2e_traces/routine_system_event.rs) to propagate the error using?or.expect()inside the#[tokio::test]function body. (.expect()is permitted inside#[test]-attributed functions.)Acceptance criteria
register_github_issue_routinereturnsResult<Routine, Box<dyn std::error::Error>>..expect("create_routine")remains inside the helper function body.Resultappropriately.References