Lucas_Werkmeister_WMDE added a comment.

  Okay, CentralAuth sets up its database in 
`UnitTestsHookHandler::onUnitTestsAfterDatabaseSetup()`, but that hook is only 
run by `MediaWikiIntegrationTestCase::setupTestDB()`. `ApiFormatReferenceTest` 
and `QuerySearchEntitiesTest` are nominally unit tests, not integration tests, 
so the database doesn’t get set up, but then CentralAuth still runs as if it’s 
in an integration test.
  
  I think the correct solution here is to declare those tests as integration 
tests. Trying to run a whole API module as only a unit test feels like a fool’s 
errand to me, at least at the moment. Perhaps a few years down the line, 
MediaWiki will be disciplined enough about dependency injection that API 
modules won’t interact with global state or the real wiki configuration, but 
until then, this should have its own database.
  
  But this also highlights something that was brought up in the Gerrit 
discussion 
<https://gerrit.wikimedia.org/r/c/mediawiki/core/+/741970/60#message-ccab7271a66a2d9dcb29fd5643c4213290434c3b>:
  
  > Per Kosta on IRC, there's a chance the speed up is itself suspicious and 
possibly indicating we missed something, e.g. some kind of protection layer or 
reset.
  
  I think that’s exactly what’s happening – these unit tests, and presumably 
many others like them, previously enjoyed the protection layer of having a 
separate database set up for them, and now they don’t. I think we’re now 
running anything that claims to be a unit test against the real database of the 
wiki, and if it happens to hit a code path that isn’t ready for unit tests, so 
to speak (like this CentralAuth hook), then who knows what happens. IMHO this 
needs to be fixed – I don’t think it was sufficiently communicated that all 
extension unit tests would now be less “sandboxed”, so to speak.

TASK DETAIL
  https://phabricator.wikimedia.org/T310255

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: Jakob_WMDE, Lucas_Werkmeister_WMDE, kostajh, Krinkle, Aklapper, 
Physikerwelt, Fernandobacasegua34, Astuthiodit_1, 786, Suran38, Biggs657, 
karapayneWMDE, Invadibot, Lalamarie69, Zabe, maantietaja, Juan90264, 
Alter-paule, Beast1978, ItamarWMDE, Un1tY, Akuckartz, Hook696, CptViraj, 
Majavah, Kent7301, joker88john, DannyS712, wildly_boy, CucyNoiD, Nandana, 
Gaboe420, lucamauri, Giuliamocci, Cpaulf30, Lahi, Gq86, Af420, Bsandipan, 
GoranSMilovanovic, Maosef, QZanden, LawExplorer, Lewizho99, Maathavan, 
Debenben, _jensen, rosalieper, Neuronton, Scott_WUaS, Izno, Wong128hk, 
thcipriani, Wikidata-bugs, Snowolf, aude, fredw, Pkra, scfc, Jdforrester-WMF, 
Mbch331, Jay8g, hashar
_______________________________________________
Wikidata-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to