refactor(server): deduplicate test helpers and grpc utilities#1708
Merged
johntmyers merged 1 commit intoJun 3, 2026
Merged
Conversation
Collaborator
|
/ok to test e98a25a |
Collaborator
Maintainer Approval NeededGator validation and PR monitoring are complete. Validation: small, concentrated Human maintainer approval or merge decision is now required. |
Remove three groups of copy-pasted code in openshell-server: 1. grpc/mod.rs had a private current_time_ms() wrapper identical to the one already exported from persistence/mod.rs. Remove the duplicate and update the three grpc sub-modules (policy, sandbox, service) to import directly from crate::persistence. 2. test_store() was repeated verbatim in seven #[cfg(test)] blocks. Promote a single canonical version to persistence/mod.rs (cfg-gated) and replace all copies with crate::persistence::test_store() calls or a thin Arc wrapper in supervisor_session. 3. grpc_client_mtls() and build_tls_root() were copy-pasted across edge_tunnel_auth.rs and multiplex_tls_integration.rs. Move both into the existing tests/common/mod.rs shared module and import from there.
e98a25a to
86c288b
Compare
Collaborator
|
/ok to test 86c288b |
johntmyers
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remove three groups of copy-pasted code from `openshell-server` with no behaviour change.
Related Issue
N/A — housekeeping.
Changes
Remove duplicate `current_time_ms()` wrapper in `grpc/mod.rs`. The same
one-liner was already exported from `persistence/mod.rs`. Update the three
grpc sub-modules (`policy`, `sandbox`, `service`) to import directly from
`crate::persistence` and drop the inline local use inside
`handle_create_sandbox_inner`.
Consolidate `test_store()` — verbatim in seven `#[cfg(test)]` blocks.
Promote a single canonical version to `persistence/mod.rs` (cfg-gated) and
replace all copies. `supervisor_session` retains a thin `Arc` wrapper
that calls through to the shared helper.
Move `grpc_client_mtls()` and `build_tls_root()` into the existing
`tests/common/mod.rs` shared module; remove the duplicates from
`edge_tunnel_auth.rs` and `multiplex_tls_integration.rs`. Clean up the
now-unused `RootCertStore` and `Channel` imports those files had.
Net: 14 files, -54 lines.
Testing
Checklist