Feature request: sidecar / server wrapper for client/server tests #3330
Replies: 3 comments 6 replies
-
|
Thanks. This is really interesting stuff. At Oxide we serialize seeds to disk instead and spin up services from the seed in every test. I would definitely be interested in taking some version of this, if you'd like to contribute it. Some notes:
Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
I see use cases inside Amazon that call for this as well. I'll see if any engineers can comment with more detail on their specific usage, but to summarize: We frequently have integration tests that rely on secondary servers running out-of-process that are somewhat heavyweight (slow to start up, might be java, might even be a remote server that is spun up dynamically). One case I know of is a full ~90 seconds to start up. The servers might be full-on mocks, or they might be somewhat stateful, but teams are generally willing to accept cross-test resource sharing rather than having a process-per-test. Currently teams use the setup scripts to spin these up. But, it is unfortunate because it makes all unit tests wait on the setup script even if they don't use the server. And then, waiting 90 seconds only to have a unit test fail that doesn't even use the server, feels bad :) I haven't looked through @jtwaleson 's fork in depth, but the model of running in a sidecar and lazily spinning it up on first invocation, seems like it would fit our usage well. I'll look at it more deeply, as well as our internal usage, to get a better idea of how well that maps over. Something else to consider (as later scope) might be some amount of cross-invocation lifecycle management that allows both spinning up and subsequently attaching to an existing process. I know that's a whole can of design worms and not strictly required for nextest to handle, but might be nice ^^ |
Beta Was this translation helpful? Give feedback.
-
|
At subspace, they start up a WASM runtime for some tests, or several nodes to simulate various blockchain Making server startup lazy would help other tests run faster, and also maybe help with memory issues or timeouts in constrained environments (or on busy CI). There's a bunch of bugs about this, for example:
Some of them could be due to race conditions, too, which might be easier to debug by delaying some server startups. Also, lazy logging startup could help make their tests run under |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Motivation
While running a test suite, I typically want to run a server process and a lot of integration tests against it. I want the tests to be super fast and parallel and also stress test the server.
Proposal
Have a "server-wrapper", it's bit like the existing wrapper feature. It just wraps multiple tests. When the first test that needs this "server wrapper" is executed, we spawn the server process and capture its stderr/stdout. Each integration test captures a copy of the server stderr/stdout, which is interleaved with other concurrent test, but at least the output is there.
I've implemented an MVP for my company last weekend (using AI coding) and we're running with this model now in CI. It speeds up our test suite a LOT and we benefit from most of the benefits of nextest (isolation model, better logs, timing, retries, more control of of test execution).
We can now run our full 150+ integration test suite in 40 seconds instead of 15 minutes if we'd do each test with its own server.
See the docs here:
https://github.com/comper-io/nextest/blob/main/site/src/docs/configuration/server-wrappers.md
Alternatives
It's nice for isolation if each integration test spawns up its own server, but that's slow and doesn't guard us against any concurrency bugs. In a way it's great if we can "stress test" the server like this.
Additional context
First of all, thanks a lot for nextest. It's super clean.
Our fork and implementation is here: https://github.com/comper-io/nextest
I'm perfectly fine to maintain our own fork of this, as it might not fit the project's goals. However, if it's interesting, we'd be happy to try and contribute a properly engineered version of this.
Beta Was this translation helpful? Give feedback.
All reactions