Open jonhoo opened 6 years ago
Just a note that you probably want to run tests against a real mariadb/mysql instance, to get real-world feedback from all of their quirks.
It would be cool to run a query against a real database, save the response, and then use a fake in-process database to run tests without spinning up a real database every time.
Doing this at the driver level means that all higher level libraries like diesel and sqlx can share the implementation.
Over the past couple of days, I've written up a library for emulating a MySQL server. It essentially implements the "other side" of the MySQL network protocol, and delegates handling of queries to a user-defined backend (also implemented in Rust). I found the
mysql
crate super helpful in working out its kinks, and I re-use code frommysql_common
wherever possible.The crate works fairly well at this point, and even self-tests by using this crate to connect to itself, and then running a bunch of queries (see tests starting from here). It occurred to me that this might also help test the
mysql
crate without relying on an externally-running MySQL DB. Feel free to close if you don't think it's a good idea.