Best Practices for Network Tests during Nix-Build

Network test is not supported inside a nix-build except localhost.
How to use localhost and random port?
And is it better to use a network namespace?

This is an interesting question! I suspect the reason that no one tried an answer yet suggests that it is also a hard one. Could you elaborate what exactly you are trying to achieve, maybe with some sample code?

1 Like

If you’re trying to test network protocols and the like,try

What if you’re trying to leverage SQLx’s (Rust sql framework) compile-time verification?
Normally people spin up a PGDB in a docker container so as to allow this during compile-time (read: cargo build).