DEV Community

Discussion on: Practical Rust Web Development - Testing

Collapse
 
werner profile image
Werner Echezuría

Well, I just had the regular problems about the borrow checker, that's why I figured it out I would need RefCell. However, I think the test run synchronously, did you use the to method or to_async route method?

Collapse
 
ghost profile image
Ghost

nope, just to(), but it was actually on unittest on Diesel only tasks, it's not about data races inside Rust but data races with the database is that makes sense, the unittests ran in parallel (that can be changed but would be slower) and as all tests used the same database, when 1 test cleared a table sometimes it did it just after another tests just created an entry for himself, other times 1 test tryied to create a user but other test had just created another one with the same name, etc. So I don't think is something relevant on runtime just on tests

Thread Thread
 
werner profile image
Werner Echezuría

Oh, ok, I understand, did you try to handle the parallelism to a continuous integration server? CircleCI is great with that.

Thread Thread
 
ghost profile image
Ghost

no really, I'm gonna check it out, even tho with the random username got solved but I like the idea of running my tests outside to get my weakling PC a rest