georgringer / news

TYPO3 Extension news
GNU General Public License v2.0
265 stars 355 forks source link

Test is flaky due to timing-sensitiveness #2130

Closed oliverklee closed 1 year ago

oliverklee commented 1 year ago

(At least) one test is flaky because it depends on timing:

https://github.com/georgringer/news/actions/runs/5319693463/jobs/9632486917?pr=2129

1) GeorgRinger\News\Tests\Unit\Backend\FormDataProvider\NewsRowInitializeNewTest::archiveTimeIsFilled
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
     'tableName' => 'tx_news_domain_model_news'
     'pageTsConfig' => Array (...)
     'databaseRow' => Array (
-        'datetime' => 1687245725
+        'datetime' => 1687245724
         'archive' => 1688109725
     )
 )

The tests probably depends on all of its code being executed in the same second (which makes it flaky), and also it looks like it tests too much (as the datetime comparison should not be part of the test assertions).

I'll have a look at it.