2012-10-28

Start a MySQL instance to run Debian package build-time tests

I'm the maintainer of MySQL Connector/Python Debian package, and it's shipped with several unittests, but they require a MySQL instance to be run against, so up to know I wasn't able to run them at build-time.

But I want to change that, so I wanted to find a way to spawn a MySQL instance just for testing purposes. I've searched a lot, and then found a package solving the same problem: php5.

The package has a setup-mysql.sh script that takes care of starting/stopping the instances, and debian/rules file sets up instance parameters and then it starts the instance before the tests and then stops it after them.

It's a very interesting solution, so I thought of sharing + taking notes to self, just in case I need it in other situations.

2 comments:

Sandro Tosi said...

But of course MySQL Connector/Python tests suite is able to bootstrap a MySQL instance by itself :)

Dmitrijs said...

The correct answer is DEP-8 tests, as you want to run these not only when your package changes, but when mysql-server package changes.
http://dep.debian.net/deps/dep8/