Hi again.
For the wikibase client components, we need unit tests for components that
access another wiki's database - e.g. a Wikipedia would need to access
Wikidata's DB to find out which data item is associated with which Wikipedia page.
The LoadBalancer class has some support for this, and I have integrated this in
DBAccessBase and ORMTable. This makes it easy enough to write classes that
access another wiki's database. But. How do I test these?
I would need to set up a second database (or at least, a Database object that
uses a different table prefix from the one used for the "normal" temporary
testing tables). The schema of that other database may differ from the the local
wiki's: it may contain some tables that don't exist locally, e.g. wb_changes on
the Wikibase repository. And, in case we are not using transient temp tables,
this extra database schema needs to be removed again once the tests are done.
Creating a set of tables using a different table prefix from the normal one
(which, under test, is "unittest_") seems doable. But this has to behave like a
foreign wiki with respect to the load balancer: if my extra db schema is called
"repowiki", emulating a database (and a wiki) called repowiki, but really just
using the table prefix "unittest_repowiki_" - how do I make sure I get the
appropriate LoadBalancer for wfGetLB( "repowiki "), and the correct connection
from $lb->getConnection( DB_MASTER, array(), "repowiki" )?
It seems like the solution is to implement an LBFactory and LoadBalancer class
to take care of this. But I'm unsure on the details. Also... how does the new LB
interact with the existing LB? Would it just repolace it, or wrap & delegate? Or
what?
Any ideas how to best do this?
-- daniel
--
Daniel Kinzler, Softwarearchitekt
Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e. V.