File tree Expand file tree Collapse file tree 5 files changed +85
-10
lines changed
dev/tests/integration/testsuite/Magento/Elasticsearch
Catalog/Model/Indexer/Category/Product/Action Expand file tree Collapse file tree 5 files changed +85
-10
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,14 @@ class RowsTest extends \PHPUnit\Framework\TestCase
54
54
*/
55
55
private $ fulltextSearchCollectionFactory ;
56
56
57
+ /**
58
+ * Elasticsearch7 engine configuration is also compatible with OpenSearch 1
59
+ */
60
+ private const ENGINE_SUPPORTED_VERSIONS = [
61
+ 7 => 'elasticsearch7 ' ,
62
+ 1 => 'elasticsearch7 ' ,
63
+ ];
64
+
57
65
/**
58
66
* @inheritdoc
59
67
*/
@@ -71,7 +79,14 @@ protected function setUp(): void
71
79
protected function assertPreConditions (): void
72
80
{
73
81
$ currentEngine = $ this ->objectManager ->get (EngineResolverInterface::class)->getCurrentSearchEngine ();
74
- $ this ->assertEquals ($ this ->getInstalledSearchEngine (), $ currentEngine );
82
+ $ this ->assertEquals (
83
+ $ this ->getInstalledSearchEngine (),
84
+ $ currentEngine ,
85
+ sprintf (
86
+ 'Search engine configuration "%s" is not compatible with the installed version ' ,
87
+ $ currentEngine
88
+ )
89
+ );
75
90
}
76
91
77
92
/**
@@ -84,7 +99,7 @@ private function getInstalledSearchEngine(): string
84
99
if (!$ this ->searchEngine ) {
85
100
// phpstan:ignore "Class Magento\TestModuleCatalogSearch\Model\ElasticsearchVersionChecker not found."
86
101
$ version = $ this ->objectManager ->get (ElasticsearchVersionChecker::class)->getVersion ();
87
- $ this ->searchEngine = 'elasticsearch ' . $ version ;
102
+ $ this ->searchEngine = self :: ENGINE_SUPPORTED_VERSIONS [ $ version ] ?? 'elasticsearch ' . $ version ;
88
103
}
89
104
90
105
return $ this ->searchEngine ;
Original file line number Diff line number Diff line change @@ -58,6 +58,14 @@ class ElasticsearchTest extends \PHPUnit\Framework\TestCase
58
58
*/
59
59
private $ productRepository ;
60
60
61
+ /**
62
+ * Elasticsearch7 engine configuration is also compatible with OpenSearch 1
63
+ */
64
+ private const ENGINE_SUPPORTED_VERSIONS = [
65
+ 7 => 'elasticsearch7 ' ,
66
+ 1 => 'elasticsearch7 ' ,
67
+ ];
68
+
61
69
protected function setUp (): void
62
70
{
63
71
$ objectManager = Bootstrap::getObjectManager ();
@@ -78,7 +86,14 @@ protected function setUp(): void
78
86
protected function assertPreConditions (): void
79
87
{
80
88
$ currentEngine = Bootstrap::getObjectManager ()->get (EngineResolverInterface::class)->getCurrentSearchEngine ();
81
- $ this ->assertEquals ($ this ->getInstalledSearchEngine (), $ currentEngine );
89
+ $ this ->assertEquals (
90
+ $ this ->getInstalledSearchEngine (),
91
+ $ currentEngine ,
92
+ sprintf (
93
+ 'Search engine configuration "%s" is not compatible with the installed version ' ,
94
+ $ currentEngine
95
+ )
96
+ );
82
97
}
83
98
84
99
/**
@@ -169,7 +184,7 @@ private function getInstalledSearchEngine()
169
184
if (!$ this ->searchEngine ) {
170
185
// phpstan:ignore "Class Magento\TestModuleCatalogSearch\Model\ElasticsearchVersionChecker not found."
171
186
$ version = Bootstrap::getObjectManager ()->get (ElasticsearchVersionChecker::class)->getVersion ();
172
- $ this ->searchEngine = 'elasticsearch ' . $ version ;
187
+ $ this ->searchEngine = self :: ENGINE_SUPPORTED_VERSIONS [ $ version ] ?? 'elasticsearch ' . $ version ;
173
188
}
174
189
return $ this ->searchEngine ;
175
190
}
Original file line number Diff line number Diff line change @@ -72,6 +72,14 @@ class IndexHandlerTest extends TestCase
72
72
*/
73
73
private $ searchIndexNameResolver ;
74
74
75
+ /**
76
+ * Elasticsearch7 engine configuration is also compatible with OpenSearch 1
77
+ */
78
+ private const ENGINE_SUPPORTED_VERSIONS = [
79
+ 7 => 'elasticsearch7 ' ,
80
+ 1 => 'elasticsearch7 ' ,
81
+ ];
82
+
75
83
/**
76
84
* {@inheritdoc}
77
85
*/
@@ -100,7 +108,14 @@ protected function setUp(): void
100
108
protected function assertPreConditions (): void
101
109
{
102
110
$ currentEngine = Bootstrap::getObjectManager ()->get (EngineResolverInterface::class)->getCurrentSearchEngine ();
103
- $ this ->assertEquals ($ this ->getInstalledSearchEngine (), $ currentEngine );
111
+ $ this ->assertEquals (
112
+ $ this ->getInstalledSearchEngine (),
113
+ $ currentEngine ,
114
+ sprintf (
115
+ 'Search engine configuration "%s" is not compatible with the installed version ' ,
116
+ $ currentEngine
117
+ )
118
+ );
104
119
}
105
120
106
121
/**
@@ -306,7 +321,7 @@ private function getInstalledSearchEngine()
306
321
if (!$ this ->searchEngine ) {
307
322
// phpstan:ignore "Class Magento\TestModuleCatalogSearch\Model\ElasticsearchVersionChecker not found."
308
323
$ version = Bootstrap::getObjectManager ()->get (ElasticsearchVersionChecker::class)->getVersion ();
309
- $ this ->searchEngine = 'elasticsearch ' . $ version ;
324
+ $ this ->searchEngine = self :: ENGINE_SUPPORTED_VERSIONS [ $ version ] ?? 'elasticsearch ' . $ version ;
310
325
}
311
326
return $ this ->searchEngine ;
312
327
}
Original file line number Diff line number Diff line change @@ -63,6 +63,14 @@ class ReindexAllTest extends \PHPUnit\Framework\TestCase
63
63
*/
64
64
private $ productRepository ;
65
65
66
+ /**
67
+ * Elasticsearch7 engine configuration is also compatible with OpenSearch 1
68
+ */
69
+ private const ENGINE_SUPPORTED_VERSIONS = [
70
+ 7 => 'elasticsearch7 ' ,
71
+ 1 => 'elasticsearch7 ' ,
72
+ ];
73
+
66
74
protected function setUp (): void
67
75
{
68
76
$ this ->connectionManager = Bootstrap::getObjectManager ()->create (ConnectionManager::class);
@@ -79,7 +87,14 @@ protected function setUp(): void
79
87
protected function assertPreConditions (): void
80
88
{
81
89
$ currentEngine = Bootstrap::getObjectManager ()->get (EngineResolverInterface::class)->getCurrentSearchEngine ();
82
- $ this ->assertEquals ($ this ->getInstalledSearchEngine (), $ currentEngine );
90
+ $ this ->assertEquals (
91
+ $ this ->getInstalledSearchEngine (),
92
+ $ currentEngine ,
93
+ sprintf (
94
+ 'Search engine configuration "%s" is not compatible with the installed version ' ,
95
+ $ currentEngine
96
+ )
97
+ );
83
98
}
84
99
85
100
/**
@@ -279,7 +294,7 @@ private function getInstalledSearchEngine()
279
294
if (!$ this ->searchEngine ) {
280
295
// phpstan:ignore "Class Magento\TestModuleCatalogSearch\Model\ElasticsearchVersionChecker not found."
281
296
$ version = Bootstrap::getObjectManager ()->get (ElasticsearchVersionChecker::class)->getVersion ();
282
- $ this ->searchEngine = 'elasticsearch ' . $ version ;
297
+ $ this ->searchEngine = self :: ENGINE_SUPPORTED_VERSIONS [ $ version ] ?? 'elasticsearch ' . $ version ;
283
298
}
284
299
return $ this ->searchEngine ;
285
300
}
Original file line number Diff line number Diff line change @@ -50,6 +50,14 @@ class AdapterTest extends \PHPUnit\Framework\TestCase
50
50
*/
51
51
private $ searchEngine ;
52
52
53
+ /**
54
+ * Elasticsearch7 engine configuration is also compatible with OpenSearch 1
55
+ */
56
+ private const ENGINE_SUPPORTED_VERSIONS = [
57
+ 7 => 'elasticsearch7 ' ,
58
+ 1 => 'elasticsearch7 ' ,
59
+ ];
60
+
53
61
/**
54
62
* @inheritdoc
55
63
*/
@@ -104,7 +112,14 @@ protected function createAdapter()
104
112
protected function assertPreConditions (): void
105
113
{
106
114
$ currentEngine = $ this ->objectManager ->get (EngineResolverInterface::class)->getCurrentSearchEngine ();
107
- $ this ->assertEquals ($ this ->getInstalledSearchEngine (), $ currentEngine );
115
+ $ this ->assertEquals (
116
+ $ this ->getInstalledSearchEngine (),
117
+ $ currentEngine ,
118
+ sprintf (
119
+ 'Search engine configuration "%s" is not compatible with the installed version ' ,
120
+ $ currentEngine
121
+ )
122
+ );
108
123
}
109
124
110
125
/**
@@ -737,7 +752,7 @@ private function getInstalledSearchEngine()
737
752
if (!$ this ->searchEngine ) {
738
753
// phpstan:ignore "Class Magento\TestModuleCatalogSearch\Model\ElasticsearchVersionChecker not found."
739
754
$ version = $ this ->objectManager ->get (ElasticsearchVersionChecker::class)->getVersion ();
740
- $ this ->searchEngine = 'elasticsearch ' . $ version ;
755
+ $ this ->searchEngine = self :: ENGINE_SUPPORTED_VERSIONS [ $ version ] ?? 'elasticsearch ' . $ version ;
741
756
}
742
757
return $ this ->searchEngine ;
743
758
}
You can’t perform that action at this time.
0 commit comments