Skip to content

Commit febffbd

Browse files
committed
Merge branch 'MCLOUD-13455' of github.com:magento-commerce/ece-tools into MCLOUD-13455
2 parents 898d008 + 8fcfd70 commit febffbd

File tree

4 files changed

+72
-301
lines changed

4 files changed

+72
-301
lines changed

src/Config/Validator/Deploy/ServiceVersion.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
use Magento\MagentoCloud\App\Error;
1111
use Magento\MagentoCloud\App\GenericException;
12+
use Magento\MagentoCloud\Config\Validator;
13+
use Magento\MagentoCloud\Config\ValidatorInterface;
1214
use Magento\MagentoCloud\Service\Detector\DatabaseType;
1315
use Magento\MagentoCloud\Service\ServiceInterface;
1416
use Magento\MagentoCloud\Service\ServiceFactory;
1517
use Magento\MagentoCloud\Service\Validator as ServiceVersionValidator;
16-
use Magento\MagentoCloud\Config\Validator;
17-
use Magento\MagentoCloud\Config\ValidatorInterface;
1818
use Psr\Log\LoggerInterface;
1919

2020
/**
@@ -80,8 +80,8 @@ public function validate(): Validator\ResultInterface
8080
$services = [
8181
ServiceInterface::NAME_RABBITMQ,
8282
ServiceInterface::NAME_REDIS,
83-
ServiceInterface::NAME_VALKEY,
8483
ServiceInterface::NAME_REDIS_SESSION,
84+
ServiceInterface::NAME_VALKEY,
8585
ServiceInterface::NAME_VALKEY_SESSION,
8686
ServiceInterface::NAME_ELASTICSEARCH,
8787
ServiceInterface::NAME_OPENSEARCH,

src/Service/Validator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class Validator
2727
* Supported version constraints of Valkey services
2828
*/
2929
private const VALKEY_SUPPORT_VERSIONS = [
30+
'2.4.5-p13 <2.4.6' => '~8.0.0 || ~8.0.1',
31+
'2.4.6-p11 <2.4.7' => '~8.0.0 || ~8.0.1',
32+
'2.4.7-p6 <2.4.8' => '~8.0.0 || ~8.0.1',
3033
'>=2.4.8' => ' ~8.0.0 || ~8.0.1',
31-
'2.4.7-p6' => '~8.0.0 || ~8.0.1',
32-
'2.4.6-p11' => '~8.0.0 || ~8.0.1',
33-
'2.4.5-p13' => '~8.0.0 || ~8.0.1',
3434
];
3535

3636
/**

src/Test/Unit/Config/Validator/Deploy/ServiceVersionTest.php

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
use Magento\MagentoCloud\Config\Validator\Deploy\ServiceVersion;
1111
use Magento\MagentoCloud\Config\ValidatorException;
1212
use Magento\MagentoCloud\Service\Detector\DatabaseType;
13-
use Magento\MagentoCloud\Service\ServiceMismatchException;
14-
use Magento\MagentoCloud\Service\ServiceInterface;
1513
use Magento\MagentoCloud\Service\ServiceFactory;
14+
use Magento\MagentoCloud\Service\ServiceInterface;
15+
use Magento\MagentoCloud\Service\ServiceMismatchException;
1616
use Magento\MagentoCloud\Service\Validator as ServiceVersionValidator;
1717
use Magento\MagentoCloud\Config\Validator\Result\Error;
1818
use Magento\MagentoCloud\Config\Validator\Result\Success;
@@ -190,7 +190,9 @@ public function testValidateWithErrors(): void
190190
'error message 3',
191191
'error message 4',
192192
'error message 5',
193-
'error message 6'
193+
'error message 6',
194+
'error message 7',
195+
'error message 8',
194196
];
195197
$service1 = $this->createMock(ServiceInterface::class);
196198
$service1->expects($this->once())
@@ -206,20 +208,37 @@ public function testValidateWithErrors(): void
206208
->willReturn('2.2');
207209
$service4 = $this->createMock(ServiceInterface::class);
208210
$service4->expects($this->once())
209-
->method('getVersion')
210-
->willReturn('7.7');
211+
->method('getVersion')
212+
->willReturn('8.0');
211213
$service5 = $this->createMock(ServiceInterface::class);
212214
$service5->expects($this->once())
213-
->method('getVersion')
214-
->willReturn('1.2');
215+
->method('getVersion')
216+
->willReturn('8.0');
215217
$service6 = $this->createMock(ServiceInterface::class);
216218
$service6->expects($this->once())
219+
->method('getVersion')
220+
->willReturn('7.7');
221+
$service7 = $this->createMock(ServiceInterface::class);
222+
$service7->expects($this->once())
223+
->method('getVersion')
224+
->willReturn('1.2');
225+
$service8 = $this->createMock(ServiceInterface::class);
226+
$service8->expects($this->once())
217227
->method('getVersion')
218228
->willReturn('5.7');
219-
$this->serviceFactory->expects($this->exactly(6))
229+
$this->serviceFactory->expects($this->exactly(8))
220230
->method('create')
221-
->willReturnOnConsecutiveCalls($service1, $service2, $service3, $service4, $service5, $service6);
222-
$this->serviceVersionValidatorMock->expects($this->exactly(6))
231+
->willReturnOnConsecutiveCalls(
232+
$service1,
233+
$service2,
234+
$service3,
235+
$service4,
236+
$service5,
237+
$service6,
238+
$service7,
239+
$service8,
240+
);
241+
$this->serviceVersionValidatorMock->expects($this->exactly(8))
223242
->method('validateService')
224243
// withConsecutive() alternative.
225244
->willReturnCallback(
@@ -231,16 +250,18 @@ function ($arg1, $arg2) use ($errorMessages) {
231250
} elseif ($arg1 == ServiceInterface::NAME_REDIS_SESSION && $arg2 == '2.2') {
232251
return $errorMessages[2];
233252
} elseif ($arg1 == ServiceInterface::NAME_VALKEY && $arg2 == '8.0') {
234-
return $errorMessages[1];
253+
return $errorMessages[3];
235254
} elseif ($arg1 == ServiceInterface::NAME_VALKEY_SESSION && $arg2 == '8.0') {
236-
return $errorMessages[2];
255+
return $errorMessages[4];
237256
} elseif ($arg1 == ServiceInterface::NAME_ELASTICSEARCH && $arg2 == '7.7') {
238-
return $errorMessages[3];
257+
return $errorMessages[5];
239258
} elseif ($arg1 == ServiceInterface::NAME_OPENSEARCH && $arg2 == '1.2') {
240-
return $errorMessages[4];
259+
return $errorMessages[6];
241260
} elseif ($arg1 == ServiceInterface::NAME_DB_MYSQL && $arg2 == '5.7') {
242-
return $errorMessages[5];
261+
return $errorMessages[7];
243262
}
263+
264+
return '';
244265
}
245266
);
246267
$this->resultFactoryMock->expects($this->once())

0 commit comments

Comments
 (0)