Skip to content

Commit 70f8ef3

Browse files
MCLOUD-13493: Made opensearch2 compatible with 2.4.4 & 2.4.5
1 parent 3ece877 commit 70f8ef3

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

src/Service/OpenSearch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(
5151
*/
5252
public function getFullEngineName(): string
5353
{
54-
if ($this->magentoVersion->isGreaterOrEqual('2.4.6')) {
54+
if ($this->magentoVersion->isGreaterOrEqual('2.4.4')) {
5555
return static::ENGINE_NAME;
5656
}
5757

src/Service/Validator.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ class Validator
8585
'>=2.4.4' => '~7.10.0', // Greater than 7.10 isn't supported on cloud infrastructure.
8686
],
8787
ServiceInterface::NAME_OPENSEARCH => [
88-
'>=2.3.7-p3 <2.4.0 || >=2.4.3-p2 <2.4.4-p7 || >=2.4.5 <2.4.5-p7' => '~1.1.0 || 1.2.*',
89-
'>=2.4.4-p8 < 2.4.5 || >=2.4.5-p6 <2.4.6' => '1.3.*',
90-
'>=2.4.6' => '^2'
88+
'>=2.3.7-p3 <2.4.0 || >=2.4.3-p2 <2.4.0' => '~1.1.0 || 1.2.*',
89+
'>=2.4.4' => '^2'
9190
],
9291
ServiceInterface::NAME_RABBITMQ => [
9392
'<2.3.0' => '~3.5.0',

src/Step/Deploy/InstallUpdate/Install/Setup/InstallCommandFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private function getEsOptions(): array
268268
$configuration = $this->openSearch->getConfiguration();
269269
$isAuthEnabled = $this->openSearch->isAuthEnabled();
270270

271-
if ($this->magentoVersion->isGreaterOrEqual('2.4.6')) {
271+
if ($this->magentoVersion->isGreaterOrEqual('2.4.4')) {
272272
$enginePrefixName = 'opensearch';
273273
}
274274
} else {

src/Test/Unit/Service/OpenSearchTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,12 @@ public function getVersionFromTypeDataProvider()
205205
],
206206
'1.1'
207207
],
208-
208+
[
209+
[
210+
['host' => '127.0.0.1', 'port' => '1234', 'type' => 'opensearch:2.0']
211+
],
212+
'2.0'
213+
],
209214
];
210215
}
211216

src/Test/Unit/Service/ValidatorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public function validateVersionsDataProvider(): array
332332
[
333333
'2.4.4',
334334
[
335-
ServiceInterface::NAME_OPENSEARCH => '1.2.2',
335+
ServiceInterface::NAME_OPENSEARCH => '2.3.0',
336336
ServiceInterface::NAME_REDIS => '6.2',
337337
ServiceInterface::NAME_REDIS_SESSION => '6.2',
338338
ServiceInterface::NAME_RABBITMQ => '3.9'
@@ -416,7 +416,7 @@ public function validateVersionsDataProvider(): array
416416
ServiceInterface::NAME_NGINX => '1.18.0',
417417
ServiceInterface::NAME_VARNISH => '7.0.0',
418418
ServiceInterface::NAME_REDIS => '6.2.6',
419-
ServiceInterface::NAME_OPENSEARCH => '1.2',
419+
ServiceInterface::NAME_OPENSEARCH => '2.3.0',
420420
ServiceInterface::NAME_RABBITMQ => '3.9.0'
421421
],
422422
0
@@ -449,7 +449,7 @@ public function validateVersionsDataProvider(): array
449449
ServiceInterface::NAME_NGINX => '1.18.0',
450450
ServiceInterface::NAME_VARNISH => '7.0.0',
451451
ServiceInterface::NAME_REDIS => '6.2.6',
452-
ServiceInterface::NAME_OPENSEARCH => '1.2',
452+
ServiceInterface::NAME_OPENSEARCH => '2.3.0',
453453
ServiceInterface::NAME_RABBITMQ => '3.9.0'
454454
],
455455
0

src/Test/Unit/Step/Deploy/InstallUpdate/Install/Setup/InstallCommandFactoryTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,7 @@ public function testExecuteWithOSauthOptions(
501501
->willReturnMap([
502502
['2.4.0', true],
503503
['2.4.2', true],
504-
['2.4.4', true],
505-
['2.4.6', $greaterOrEqual],
504+
['2.4.4', $greaterOrEqual],
506505
]);
507506
$this->magentoVersionMock->expects($this->once())
508507
->method('satisfies')
@@ -516,7 +515,7 @@ public function testExecuteWithOSauthOptions(
516515
->willReturn(true);
517516
$this->openSearchMock->expects($this->once())
518517
->method('getFullEngineName')
519-
->willReturn('opensearch1');
518+
->willReturn('opensearch');
520519
$this->openSearchMock->expects($this->once())
521520
->method('getHost')
522521
->willReturn('127.0.0.1');
@@ -537,7 +536,7 @@ public function testExecuteWithOSauthOptions(
537536

538537
$this->elasticSearchMock->expects($this->once())
539538
->method('isInstalled')
540-
->willReturn(true);
539+
->willReturn(false);
541540
$this->elasticSearchMock->expects($this->never())
542541
->method('isAuthEnabled');
543542
$this->elasticSearchMock->expects($this->never())
@@ -550,7 +549,7 @@ public function testExecuteWithOSauthOptions(
550549
->method('getConfiguration');
551550

552551
$command = $this->installCommandFactory->create();
553-
self::assertStringContainsString("--search-engine='opensearch1'", $command);
552+
self::assertStringContainsString("--search-engine='opensearch'", $command);
554553
self::assertStringContainsString("--" . $enginePrefixName . "-enable-auth='1'", $command);
555554
self::assertStringContainsString("--" . $enginePrefixName . "-username='user'", $command);
556555
self::assertStringContainsString("--" . $enginePrefixName . "-password='secret'", $command);

0 commit comments

Comments
 (0)