Attempt to fix a flaky integration test
This commit attempts to fix the integration test SubscriberListingRepositoryTest::testReturnsCorrectCountForSubscribersInDynamicSegment() that was failing sometimes on CircleCI. My theory is that the test was failing because we were using created_at to order the subscribers in the query that is used to get subscribers in a given dynamic segment, but there is a chance the the value of this field is the same for all the three subscribers that are created in this test. As this could lead to a situation where the order of the returned subscribers changes, causing the test to fail. To work around that, I changed the test to order the results by ID. This way we should always get the subscribers in the same order. [MAILPOET-3451]
This commit is contained in:
@@ -212,6 +212,7 @@ class SubscriberListingRepositoryTest extends \MailPoetTest {
|
||||
$this->listingData['filter'] = ['segment' => $list->getId()];
|
||||
$this->listingData['limit'] = 2;
|
||||
$this->listingData['offset'] = 2;
|
||||
$this->listingData['sort_by'] = 'id';
|
||||
$data = $this->repository->getData($this->getListingDefinition());
|
||||
expect(count($data))->equals(1);
|
||||
expect($data[0]->getEmail())->equals($wpUserEmail3);
|
||||
|
Reference in New Issue
Block a user