https://github.com/DataDog/dd-trace-cpp/blob/6dacac2922d08f4...
It's not secure, but I'm not worried about bad actors monitoring /tmp in my test container so they can make my tests fail anyway.
It would be nice if there were a "file paths that start with a null character belong to an ad hoc in memory file system specific to the process," or something. /tmp/tmp.eJaVgxtV0x/ is close enough.
Open to code golfing suggestions on the code linked above.
Good luck with that when you’re dealing with external APIs. And numerous systems such as Postgres, redis, Kafka.
Stil possible to boot a complete environment up with docker test containers, but then your doing an integration test.
In my experience they are useful but there is no replacements for fakes inside unit tests.
I do not mock stuff (with things like mock into). I use fake implementations and interfaces.
I don't consider the distinction between unit and integration tests useful. If the bug is in Postgress then I want to find that out, and I care if the test is technically an integration test, I care that my software doesn't work.
we use sqlite as our datatbase so it is simple enough for helpers to apply a schema to an in memory database and again the database can be used in tests.
i'he become against mocks in tests. A usefull tool, but rarely needed. You can make tests reliable and fast without them.