Skip to content

Commit 067a062

Browse files
Merge pull request #177 from magento-commerce/MCLOUD-13493
OS2 compatible with 2.4.4 & 2.4.5
2 parents 3ece877 + daf60ad commit 067a062

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

src/App/Logger/HandlerFactory.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,9 @@ public function create(string $handler): AbstractProcessingHandler
104104
);
105105
break;
106106
case static::HANDLER_STREAM:
107-
$defaultLevelStream = !empty($levelOverride) ?
108-
$this->normalizeLevel($levelOverride)
109-
: Logger::INFO;
110107
$handlerInstance = new StreamHandler(
111108
$configuration->get('stream'),
112-
$minLevel ?: $defaultLevelStream
109+
$minLevel ?: Logger::INFO
113110
);
114111
break;
115112
case static::HANDLER_EMAIL:

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/Search/AbstractService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function getVersion(): string
117117
}
118118
}
119119

120-
return $this->version;
120+
return preg_replace('/-.*/', '', $this->version); // Removes any suffix after '-'
121121
}
122122

123123
/**

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.4-p13 || 2.4.5 || >=2.4.5-p1 <2.4.5-p12' => '~1.1.0 || 1.2.*',
89+
'2.4.4-p13 || >=2.4.5-p12' => '^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/Functional/Acceptance/AbstractCest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ protected function prepareWorkplace(\CliTester $I, string $templateVersion): voi
7979
$I->cloneTemplateToWorkDir($templateVersion);
8080
$I->createAuthJson();
8181
$I->createArtifactsDir();
82-
$I->createArtifactCurrentTestedCode('ece-tools', '2002.1.99');
82+
$I->createArtifactCurrentTestedCode('ece-tools', '2002.2.99');
8383
$I->addArtifactsRepoToComposer();
84-
$I->addDependencyToComposer('magento/ece-tools', '2002.1.99');
84+
$I->addDependencyToComposer('magento/ece-tools', '2002.2.99');
8585
$I->addEceDockerGitRepoToComposer();
8686
$I->addCloudComponentsGitRepoToComposer();
8787
$I->addCloudPatchesGitRepoToComposer();

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,12 +332,12 @@ 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'
339339
],
340-
0
340+
1
341341
],
342342
[
343343
'2.3.7-p2',
@@ -436,7 +436,7 @@ public function validateVersionsDataProvider(): array
436436
ServiceInterface::NAME_DB_MARIA => '10.5.0', //wrong
437437
ServiceInterface::NAME_VARNISH => '7.1.0', //wrong
438438
ServiceInterface::NAME_REDIS => '6.1.3', //wrong
439-
ServiceInterface::NAME_OPENSEARCH => '1.0.0', //wrong
439+
ServiceInterface::NAME_OPENSEARCH => '2.3.0', //wrong
440440
ServiceInterface::NAME_RABBITMQ => '3.8.1' //wrong
441441
],
442442
6

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ public function testExecuteWithESauthOptions(): void
437437
['2.4.0', true],
438438
['2.4.2', false]
439439
]);
440-
$this->elasticSearchMock->expects($this->once())
440+
$this->elasticSearchMock->expects($this->any())
441441
->method('isInstalled')
442442
->willReturn(true);
443443
$this->elasticSearchMock->expects($this->once())
@@ -464,7 +464,7 @@ public function testExecuteWithESauthOptions(): void
464464
]
465465
]);
466466

467-
$this->openSearchMock->expects($this->once())
467+
$this->openSearchMock->expects($this->any())
468468
->method('isInstalled')
469469
->willReturn(false);
470470
$this->openSearchMock->expects($this->never())
@@ -501,22 +501,21 @@ 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')
509508
->with('>=2.3.7-p3 <2.4.0 || >=2.4.3-p2')
510509
->willReturn(true);
511-
$this->openSearchMock->expects($this->once())
510+
$this->openSearchMock->expects($this->any())
512511
->method('isInstalled')
513512
->willReturn(true);
514513
$this->openSearchMock->expects($this->once())
515514
->method('isAuthEnabled')
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');
@@ -535,9 +534,9 @@ public function testExecuteWithOSauthOptions(
535534
]
536535
]);
537536

538-
$this->elasticSearchMock->expects($this->once())
537+
$this->elasticSearchMock->expects($this->any())
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)