Migrate from Trillium [part 9B]: Rewrite test infrastructure + remove all trillium deps#2266
Conversation
4f82852 to
a49b10e
Compare
I think we may need to go the other direction instead. Currently when doing a workspace-wide build, the |
… all trillium deps Replace the entire trillium-based test harness with axum-native equivalents and remove every trillium dependency from the workspace. Are you ready for a PARTY? This one removes Trillium. Say goodnight. test-support/* rewrite: - TestRequest/TestResponse types using tower::ServiceExt::oneshot() - ClientLogs rewritten as axum middleware capturing request/response bodies - ApiMocks rewritten with host-based axum::Router dispatch - User injection via X-Integration-Testing-User header (was in the trillium conn state) src/ crate cleanup: - Delete handler::origin_router, handler::proxy, ErrorHandler, and the DivviupApi trillium Handler struct - Delete inject_integration_testing_user middleware (the header-based inject_test_header_user is sufficient) - Rewrote src/api_mocks/* tests/integration/*: - All response_json() calls are now synchronous (body eagerly consumed) Here we see the final destruction of the trillium alliance, and the end of its insignificant rebellion against our dependency tree. I've left some more cleanup for Part 10, including refactoring 'with_state' to 'with_user' in ~100 callsites, and the restoration of remaining HTTP metrics.
a49b10e to
6f37148
Compare
I intended to finangle this in Part 10, but there's no reason not to do it now and be rid of |
tgeoghegan
left a comment
There was a problem hiding this comment.
Might have more to say, but here's some comments to start.
| }; | ||
| use rand::random; | ||
| use uuid::Uuid; | ||
|
|
There was a problem hiding this comment.
nit: we should keep a blank line between the imports and this function
Replace the entire trillium-based test harness with axum-native equivalents and remove every trillium dependency from the workspace. Are you ready for a PARTY? This one removes Trillium. Say goodnight.
test-support/*rewrite:TestRequest/TestResponsetypes usingtower::ServiceExt::oneshot()ClientLogsrewritten as axum middleware capturing request/response bodiesApiMocksrewritten with host-basedaxum::RouterdispatchUserinjection by smooshing them intoparts.extensionswhich acts like thePermissionsActorwas cachedsrc/crate cleanup:handler::origin_router,handler::proxy,ErrorHandler, and theDivviupApitrillium Handler structinject_integration_testing_userandinject_test_header_usermiddlewaresrc/api_mocks/*tests/integration/*:response_json()calls are now synchronousHere we see the final destruction of the trillium alliance, and the end of its insignificant rebellion against our dependency tree.
I've left some more cleanup for Part 10, including refactoring 'with_state' to 'with_user' in ~100 callsites, and the restoration of remaining HTTP metrics.