Skip to content

Commit 4345cf7

Browse files
committed
MC-42025: Bad performance and outages after upgrade to MariaDB 10.2.34
1 parent ac0f192 commit 4345cf7

File tree

2 files changed

+32
-21
lines changed
  • app/code/Magento/Sales/Test/Unit/Model/ResourceModel
  • dev/tests/integration/testsuite/Magento/Backend/Model/Dashboard

2 files changed

+32
-21
lines changed

app/code/Magento/Sales/Test/Unit/Model/ResourceModel/GridTest.php

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Framework\DB\Adapter\AdapterInterface as ConnectionAdapterInterface;
1111
use Magento\Framework\DB\Select;
1212
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
13+
use Magento\Sales\Model\Grid\LastUpdateTimeCache;
1314
use Magento\Sales\Model\ResourceModel\Grid;
1415
use Magento\Sales\Model\ResourceModel\Provider\NotSyncedDataProviderInterface;
1516
use PHPUnit\Framework\MockObject\MockObject;
@@ -59,14 +60,9 @@ class GridTest extends TestCase
5960
protected function setUp(): void
6061
{
6162
$objectManager = new ObjectManager($this);
62-
$this->notSyncedDataProvider = $this->getMockBuilder(NotSyncedDataProviderInterface::class)
63-
->disableOriginalConstructor()
64-
->setMethods(['getIds'])
65-
->getMockForAbstractClass();
66-
$this->connection = $this->getMockBuilder(ConnectionAdapterInterface::class)
67-
->disableOriginalConstructor()
68-
->setMethods(['select', 'fetchAll', 'insertOnDuplicate'])
69-
->getMockForAbstractClass();
63+
$this->notSyncedDataProvider = $this->createMock(NotSyncedDataProviderInterface::class);
64+
$this->connection = $this->createMock(ConnectionAdapterInterface::class);
65+
$lastUpdateTimeCache = $this->createMock(LastUpdateTimeCache::class);
7066

7167
$this->grid = $objectManager->getObject(
7268
Grid::class,
@@ -76,7 +72,8 @@ protected function setUp(): void
7672
'gridTableName' => $this->gridTable,
7773
'connection' => $this->connection,
7874
'_tables' => ['sales_order' => $this->mainTable, 'sales_order_grid' => $this->gridTable],
79-
'columns' => $this->columns
75+
'columns' => $this->columns,
76+
'lastUpdateTimeCache' => $lastUpdateTimeCache,
8077
]
8178
);
8279
}
@@ -87,23 +84,36 @@ protected function setUp(): void
8784
public function testRefreshBySchedule()
8885
{
8986
$notSyncedIds = ['1', '2', '3'];
90-
$fetchResult = ['column_1' => '1', 'column_2' => '2'];
87+
$fetchResult = [
88+
['entity_id' => 1, 'updated_at' => date('Y-m-d H:i:s')],
89+
['entity_id' => 2, 'updated_at' => date('Y-m-d H:i:s')],
90+
];
9191

92-
$this->notSyncedDataProvider->expects($this->atLeastOnce())->method('getIds')->willReturn($notSyncedIds);
93-
$select = $this->getMockBuilder(Select::class)
94-
->disableOriginalConstructor()
95-
->setMethods(['from', 'columns', 'where'])
96-
->getMock();
97-
$select->expects($this->atLeastOnce())->method('from')->with(['sales_order' => $this->mainTable], [])
92+
$this->notSyncedDataProvider->expects($this->atLeastOnce())
93+
->method('getIds')
94+
->willReturn($notSyncedIds);
95+
$select = $this->createMock(Select::class);
96+
$select->expects($this->atLeastOnce())
97+
->method('from')
98+
->with(['sales_order' => $this->mainTable], [])
9899
->willReturnSelf();
99-
$select->expects($this->atLeastOnce())->method('columns')->willReturnSelf();
100-
$select->expects($this->atLeastOnce())->method('where')
100+
$select->expects($this->atLeastOnce())
101+
->method('columns')
102+
->willReturnSelf();
103+
$select->expects($this->atLeastOnce())
104+
->method('where')
101105
->with($this->mainTable . '.entity_id IN (?)', $notSyncedIds)
102106
->willReturnSelf();
103107

104-
$this->connection->expects($this->atLeastOnce())->method('select')->willReturn($select);
105-
$this->connection->expects($this->atLeastOnce())->method('fetchAll')->with($select)->willReturn($fetchResult);
106-
$this->connection->expects($this->atLeastOnce())->method('insertOnDuplicate')
108+
$this->connection->expects($this->atLeastOnce())
109+
->method('select')
110+
->willReturn($select);
111+
$this->connection->expects($this->atLeastOnce())
112+
->method('fetchAll')
113+
->with($select)
114+
->willReturn($fetchResult);
115+
$this->connection->expects($this->atLeastOnce())
116+
->method('insertOnDuplicate')
107117
->with($this->gridTable, $fetchResult, array_keys($this->columns))
108118
->willReturn(array_count_values($notSyncedIds));
109119

dev/tests/integration/testsuite/Magento/Backend/Model/Dashboard/ChartTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* Verify chart data by different period.
1515
*
1616
* @magentoAppArea adminhtml
17+
* @magentoAppIsolation enabled
1718
*/
1819
class ChartTest extends TestCase
1920
{

0 commit comments

Comments
 (0)