Refactor test_build to work with wait_for, again.
Hi @eta! Here's my second attempt to revise test_build. This doesn't work yet, but I'm sharing it for now so you can let me know if you think I'm on the right track.
Per your suggestion last time, I've split up the function into separate tests, each with its own runtime. Because they can run in parallel, I'm no longer using global AtomicU64
s to hold timeouts: instead, I'm encoding the timeouts in the Ed25519 identity keys of the relays that the fake circuit builder is using. (It's not pretty, but I figure it's fine for a test.)
Right now, the first two tests are working pretty solid, but the second two tests are unreliable and ill-behaved. I think my problem is that I'm calling allow_one_advance()
in a single go, when in fact I need to call it after each waited-for thing is done, to get them all called in the right order.
I think I'm also going to need some synchronization between the mocked TimeoutRecorder
and the tests, so that the tests have a way to wait for a circuit timeout to actually finish.