Rendered at 12:53:06 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
sunshowers 1 days ago [-]
Thanks for posting about this! I'm the main author of nextest, and it represents my best foot forward for how Rust testing should be done. Happy to answer questions though I might be a bit intermittent.
landr0id 1 days ago [-]
Big fan of nextest and this is my first time seeing this site. I'll be real I feel a bit ridiculous commenting this but you might want to consider rephrasing this:
>Treat tests as cattle, not pets. Detect and terminate slow tests.
Not sure saying, "hey, treat your tests as an animal you can kill at will" paints the right image.
trollbridge 1 days ago [-]
This is from the Kubernetes saying of "treat servers like cattle, not pets". Of course, some people like me keep cattle as pets, but then again I also name my servers, even the virtual or containerised ones.
sunshowers 1 days ago [-]
Yeah that was indeed the inspiration (though I'm pretty sure it predates Kubernetes!) but the juxtaposition with "terminate" is unfortunate.
wojciii 1 days ago [-]
I liked the way it was phrased. You can't make everybody happy. :)
seanhunter 1 days ago [-]
It’s a horrible saying in that context also.
embedding-shape 1 days ago [-]
I mean, I like animals too, but in context it does make sense. The context was to treat them as "obtainable yet ultimately killable entities you keep as a group, not individuals", which cattle pretty much is. Unless you consider keeping cattle as draft animals, but I think that stopped being the main purpose a long time ago.
It got the point across, at a time where most people basically acquired servers, kept them until they died, and he was trying to push a development workflow where you constantly close("kill")/bring up new servers.
entrope 24 hours ago [-]
IMO, "make your servers fungible" is a better way to express the intent: slightly shorter, no metaphors, although "fungible" is a less common word. Maybe that's just me. (Edited to add: "make your tests fungible" has I think the wrong connotation; I think the original wording on the blog is about test executions -- and "make your test executions fungible" does seem like a good goal, similar to ACID guarantees for database transactions.)
embedding-shape 23 hours ago [-]
Before that, I used to call them "ephemeral", and of course half the people asked what "ephemeral" means, probably "fungible" would be met with similar question, unless the crowd is cryptocurrency-adjacent, that term seems understood there.
jen20 24 hours ago [-]
That (unpleasant) saying predates Kubernetes by at least half a decade.
sunshowers 1 days ago [-]
That's fair! I'll find a way to rephrase it.
edit: Updated to "Detect and handle slow tests". Thanks again!
mhluongo 1 days ago [-]
It resonated with me!
moi2388 1 hours ago [-]
Jesus Christ do we seriously need to limit our speech and get rid of perfectly good analogies for every special little snowflake?
27183 22 hours ago [-]
"Treat tests as annuals not perennials"
"Treat tests as workers not management"
Zababa 1 days ago [-]
Fungible/non fungible is a good alternative, and maybe the technically correct word. But I think in that case it doesn't apply and the change the author did is better.
gdcbe 1 days ago [-]
Thank you very much for developing nextest. It is what allows our projects like rama [1] to run thousands and thousands of tests in a blink of an eye! Keep it up!
Can you run tests serially in the (horrible) case when tests need to build on one another?
How are you querying for the tests? Is that just built into rust's test stuff?
Would it be possible to fork the test process? It'd be pretty interesting if you could spawn a test process, and then fork it for each test to save both on memory and any static state stored within the test.
sunshowers 22 hours ago [-]
> Can you run tests serially in the (horrible) case when tests need to build on one another?
> How are you querying for the tests? Is that just built into rust's test stuff?
Just running --list against test binaries.
> Would it be possible to fork the test process? It'd be pretty interesting if you could spawn a test process, and then fork it for each test to save both on memory and any static state stored within the test.
This is possible in principle, but nextest doesn't really inject itself into tests like that (injection can cause reliability issues in practice, and a big focus of nextest is reliability). Forking is also not possible in multithreaded programs.
coding-wizard 1 days ago [-]
Hey, I love nextest. But, perhaps because of the one-process per test approach, endpoint security solutions like CrowdStrike Falcon or Palo Alto Cortex tend to make computers hang whenever tests kick-in. I would love if you were able to introduce a workaround, because none of those companies will fix their stuff. I am guessing a possible mitigation would be to have stagger the first invocation of any large test binary, but I haven't had a chance to dig deep into this issue.
sunshowers 21 hours ago [-]
Nextest does run tests in lexicographic (binary, test name) order by default, so first executions tend to be staggered. Unfortunately this is a known problem that is much larger than nextest, and it is why Windows introduced Dev Drive with a mode to disable AV/EDR on those drives entirely.
I wish I had a better answer here — it is frustrating how poorly behaved the EDR stuff tends to be. Maybe I should try and network a bit to get in touch with the people working on this stuff. (Planning to be at DEF CON this year, so come find me if you work on this stuff and will be there!)
arw0n 24 hours ago [-]
Wouldn't running the tests in a container solve that issue? Or is that another thing that gets flagged?
mrec 1 days ago [-]
Have there been any discussions about upstreaming this into cargo proper? Are there any significant downsides to nextest compared to its predecessor?
sunshowers 1 days ago [-]
The How it works [1] and Why process-per-test? [2] pages should answer your questions.
Super happy user here! It's an excellent piece of engineering.
We're running a fork that supports a "sidecar" server for running multiple integration tests against. So if any tests that need the server are included, it spawns the server, runs the integration tests, and then shuts it down. By re-using the same server we speed up our runs tremendously.
watch it running 32.5k unit tests without breaking a sweat!
sunshowers 1 days ago [-]
Thanks! BTW you might enjoy setting CARGO_TERM_COLOR=always in your environment :) dtolnay/rust-toolchain does this automatically but it looks like you aren't using that action.
mohsen1 1 days ago [-]
Thanks! Any pro tips for sharding? I landed on single job because couldn't get cache to work properly for shards to be fast enough to worth it
sunshowers 22 hours ago [-]
I think in practice you're right that GitHub Actions' caching slowness can end up dominating performance. I don't have any great tips other than to measure.
evntdrvn 22 hours ago [-]
I've basically abandoned GA's caching for most things because measurements ended up showing things were slower with caching than without :woozy:
mollerhoj 16 hours ago [-]
the execution model of cargo-nextest makes my test suite extremely slow to run - Most of my tests rely on postgres. Since cargo-nextest uses a separate process per test, there is no efficient way to share the connection pool.
patates 1 days ago [-]
I somehow tried to make sense of the name as a superlative form of "next". Perhaps next-test would have been fine?
sunshowers 1 days ago [-]
That is indeed the pun =)
patates 1 days ago [-]
Oh, sorry then, thanks for the clarification :)
mightyham 1 days ago [-]
Coming from the DC area, this comment reminds me of how the metro payment system "Smartrip" was recently renamed to "Smart Trip".
jstrong 1 days ago [-]
seems like `cargo nextest run` just runs `--lib` tests by default? however, `cargo test` is not so slow if you do `cargo test --lib`. how do I get nextest to execute the doc tests, too?
sunshowers 22 hours ago [-]
The benchmarks are against non-doctest cargo test runs. (But you should measure against your own project, of course!) Unfortunately Cargo doesn't provide enough information for nextest to run doctests reliably with.
Yes, for a long while – I believe it's fairly widely used (and it's absolutely excellent!)
gdcbe 1 days ago [-]
Yes we use it for rama [1]. You can check its justfile and CI workflow file how we use it. Those run thousands and thousands of tests thx to nextest and what feels like instantly (once compiled).
Large projects build with rama use it as well. But those are proprietary from partners so sadly cannot share those.
>Treat tests as cattle, not pets. Detect and terminate slow tests.
Not sure saying, "hey, treat your tests as an animal you can kill at will" paints the right image.
It got the point across, at a time where most people basically acquired servers, kept them until they died, and he was trying to push a development workflow where you constantly close("kill")/bring up new servers.
edit: Updated to "Detect and handle slow tests". Thanks again!
"Treat tests as workers not management"
[1] https://ramaproxy.org
Can you run tests serially in the (horrible) case when tests need to build on one another?
How are you querying for the tests? Is that just built into rust's test stuff?
Would it be possible to fork the test process? It'd be pretty interesting if you could spawn a test process, and then fork it for each test to save both on memory and any static state stored within the test.
Yes: https://nexte.st/docs/configuration/test-groups/ (edit: though tests that build on each other is a bit harder — test groups are meant for when tests need access to a shared resource)
> How are you querying for the tests? Is that just built into rust's test stuff?
Just running --list against test binaries.
> Would it be possible to fork the test process? It'd be pretty interesting if you could spawn a test process, and then fork it for each test to save both on memory and any static state stored within the test.
This is possible in principle, but nextest doesn't really inject itself into tests like that (injection can cause reliability issues in practice, and a big focus of nextest is reliability). Forking is also not possible in multithreaded programs.
I wish I had a better answer here — it is frustrating how poorly behaved the EDR stuff tends to be. Maybe I should try and network a bit to get in touch with the people working on this stuff. (Planning to be at DEF CON this year, so come find me if you work on this stuff and will be there!)
[1] https://nexte.st/docs/design/how-it-works/
[2] https://nexte.st/docs/design/why-process-per-test/
It answered 90% of the questions I had at the monent. Thank you!
[1] https://nexte.st/docs/design/how-it-works/
We're running a fork that supports a "sidecar" server for running multiple integration tests against. So if any tests that need the server are included, it spawns the server, runs the integration tests, and then shuts it down. By re-using the same server we speed up our runs tremendously.
Discussion thread on gh: https://github.com/nextest-rs/nextest/discussions/3330
https://github.com/tsz-org/tsz/actions/runs/29002057457/job/...
watch it running 32.5k unit tests without breaking a sweat!
edit: Thanks, will try!
Large projects build with rama use it as well. But those are proprietary from partners so sadly cannot share those.
[1]: https://github.com/plabayo/rama