Page MenuHomePhabricator

Daylight savings unit test failures on Microsoft Windows
Closed, InvalidPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Use a computer with Microsoft Windows installed
  • Be in a timezone that is currently in daylight savings time
  • open a console
  • git clone mediawiki core
  • run unit tests (composer phpunit:unit)

What happens?:

  • 1 error, 8 failures on master branch

What should have happened instead?:

  • 0 error, 0 failures on master branch

Software version (skip for WMF-hosted wikis like Wikipedia):

  • master branch, latest

Other information (browser name/version, screenshots, etc.):

  • @TheDJ suggested I file this
  • list of tests that failed
    • MediaWiki\ParamValidator\TypeDef\UserDefTest::testValidate with data set "T232672: U+200E at position 0 for name" ('‎Emma', 'Emma')
    • Wikimedia\ParamValidator\TypeDef\ExpiryDefTest::testValidate with data set "Valid expiry" ('99990123123456', '9999-01-23T12:34:56Z')
    • Wikimedia\ParamValidator\TypeDef\ExpiryDefTest::testValidate with data set "Expiry less than max" ('20190701123456', '2019-07-01T12:34:56Z', array('6 months', true))
    • Wikimedia\ParamValidator\TypeDef\ExpiryDefTest::testValidate with data set "Expiry exceeds max" ('9999-01-23T12:34:56Z', '2019-12-05T19:50:42Z', array('6 months', true), array(), array(array('paramvalidator-badexpiry-duration-max', null)))
    • Wikimedia\ParamValidator\TypeDef\ExpiryDefTest::testValidate with data set "Relative expiry exceeds max" ('10 years', '2019-12-05T19:50:42Z', array('6 months', true), array(), array(array('paramvalidator-badexpiry-duration-max', null)))
    • Wikimedia\ParamValidator\TypeDef\ExpiryDefTest::testNormalizeExpiry - Failed asserting that two strings are identical.
    • Wikimedia\ParamValidator\TypeDef\ExpiryDefTest::testNormalizeUsingMaxExpiry - Failed asserting that two strings are identical.
    • WatchedItemUnitTest::testgetExpiryInDays - Failed asserting that 0 is identical to 1.
    • WatchedItemUnitTest::testgetExpiryInDaysText
Time: 56.13 seconds, Memory: 176.00 MB

There was 1 error:

1) MediaWiki\ParamValidator\TypeDef\UserDefTest::testValidate with data set "T232672: U+200E at position 0 for name" ('‎Emma', 'Emma')
Wikimedia\ParamValidator\ValidationException: Validation of `test` failed: baduser

F:\Dropbox\Code\MediaWiki\core\includes\libs\ParamValidator\TypeDef.php:66
F:\Dropbox\Code\MediaWiki\core\includes\ParamValidator\TypeDef\UserDef.php:90
F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\libs\ParamValidator\TypeDef\TypeDefTestCase.php:89

--

There were 8 failures:

1) Wikimedia\ParamValidator\TypeDef\ExpiryDefTest::testValidate with data set "Valid expiry" ('99990123123456', '9999-01-23T12:34:56Z')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'9999-01-23T12:34:56Z'
+'9999-01-23T11:34:56Z'

F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\libs\ParamValidator\TypeDef\TypeDefTestCase.php:89
F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\libs\ParamValidator\TypeDef\ExpiryDefTest.php:48

2) Wikimedia\ParamValidator\TypeDef\ExpiryDefTest::testValidate with data set "Expiry less than max" ('20190701123456', '2019-07-01T12:34:56Z', array('6 months', true))
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'2019-07-01T12:34:56Z'
+'2019-07-01T10:34:56Z'

F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\libs\ParamValidator\TypeDef\TypeDefTestCase.php:89
F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\libs\ParamValidator\TypeDef\ExpiryDefTest.php:48

3) Wikimedia\ParamValidator\TypeDef\ExpiryDefTest::testValidate with data set "Expiry exceeds max" ('9999-01-23T12:34:56Z', '2019-12-05T19:50:42Z', array('6 months', true), array(), array(array('paramvalidator-badexpiry-duration-max', null)))
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'2019-12-05T19:50:42Z'
+'2019-12-05T20:50:42Z'

F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\libs\ParamValidator\TypeDef\TypeDefTestCase.php:89
F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\libs\ParamValidator\TypeDef\ExpiryDefTest.php:48

4) Wikimedia\ParamValidator\TypeDef\ExpiryDefTest::testValidate with data set "Relative expiry exceeds max" ('10 years', '2019-12-05T19:50:42Z', array('6 months', true), array(), array(array('paramvalidator-badexpiry-duration-max', null)))
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'2019-12-05T19:50:42Z'
+'2019-12-05T20:50:42Z'

F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\libs\ParamValidator\TypeDef\TypeDefTestCase.php:89
F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\libs\ParamValidator\TypeDef\ExpiryDefTest.php:48

5) Wikimedia\ParamValidator\TypeDef\ExpiryDefTest::testNormalizeExpiry
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'2050-01-01T00:00:00Z'
+'2049-12-31T23:00:00Z'

F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\libs\ParamValidator\TypeDef\ExpiryDefTest.php:123

6) Wikimedia\ParamValidator\TypeDef\ExpiryDefTest::testNormalizeUsingMaxExpiry
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'2020-11-27T00:00:00Z'
+'2020-11-27T01:00:00Z'

F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\libs\ParamValidator\TypeDef\ExpiryDefTest.php:169

7) WatchedItemUnitTest::testgetExpiryInDays
Failed asserting that 0 is identical to 1.

F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\watcheditem\WatchedItemUnitTest.php:45
F:\Dropbox\Code\MediaWiki\core\tests\phpunit\MediaWikiUnitTestCase.php:116

8) WatchedItemUnitTest::testgetExpiryInDaysText
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'watchlist-expiring-days-full-text-1'
+'watchlist-expiring-hours-full-text'

F:\Dropbox\Code\MediaWiki\core\tests\phpunit\unit\includes\watcheditem\WatchedItemUnitTest.php:94
F:\Dropbox\Code\MediaWiki\core\tests\phpunit\MediaWikiUnitTestCase.php:116

ERRORS!
Tests: 12436, Assertions: 152410, Errors: 1, Failures: 8, Skipped: 9.
Script phpunit --colors=always --testsuite=core:unit,extensions:unit,skins:unit handling the phpunit:unit event returned with error code 2

Event Timeline

Thanks for filing this! The first error is a duplicate of T300669: Wikimedia\ParamValidator\ValidationException : Validation of `test` failed: baduser, though your bug report is much more thorough, thank you. IMO, we should disable the UserDefTest if it is not passing on macOS / Windows.

cc @daniel about the timezone issue, as I know he's been looking at setting up fake clocks etc for testing recently.

Prompted by @Addshore, I tried to reproduce this today (on Windows, and in summer) and the tests passed for me. I don't know if the problem was fixed or if some other condition is needed to reproduce.

I'll go ahead and close this for now as unreproducible, feel free to re open if this is still an issue, but we couldn't reproduce!