[QA] Resetting database to original state after tests
Juliusz Gonera
jgonera at wikimedia.org
Mon Mar 24 22:06:43 UTC 2014
On 03/05/2014 12:23 PM, Chris McMahon wrote:
>
> I have had a couple of (very preliminary) conversations with Rob
> Lanphier along these lines.
>
> Today we support (for some value of "support") two test environments:
> beta labs and test2wiki. What might be possible in the future is to
> support a set of test environments beyond just beta and test2wiki.
> (One example would be a test environment on bare metal, for
> performance-test reasons.)
>
> I think a beta-esque test env with a db that returns to a snapshot
> state at particular times would be really useful.
Sorry for not replying to this earlier. What I meant by environments was
more along the lines of modes that can be activated on demand in any MW
instance, be it on beta labs or on developer's local machine, similar to
what Rails, Django and other MVC frameworks have [1].
I'm not sure about the exact implementation, but just to illustrate my
point, we could do something like this:
if ( $wgEnv === 'test' ) {
// expose DB reset API
}
Then we could have a beta labs instance that would have $wgEnv = 'test'
where all the tests could run and reset the database using this API. We
could also ship mediawiki-vagrant with MW available on two different
ports, e.g. apart from 8080, we could have 127.0.0.1:8081 that would use
use $wgEnv = 'test' and point to a different MySQL database. In this
situation invoking bundle exec cucumber would run all the tests on a
separate database without messing up developer's dev database.
[1] http://guides.rubyonrails.org/testing.html#the-test-environment
--
Juliusz
More information about the QA
mailing list