Skip to content

Commit ca1dba0

Browse files
authored
Fixing abstract elastic search test exception throwing. (#713)
* Fixing abstract elastic search test exception throwing. * fixed index import command test * implemented creating an index in cache clear test * removed non-existing search type in export service * removed unnecessary test
1 parent c8d5454 commit ca1dba0

File tree

5 files changed

+17
-139
lines changed

5 files changed

+17
-139
lines changed

Service/ExportService.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public function exportIndex(
4141
$maxLinesInFile = 300000
4242
) {
4343
$params = [
44-
'search_type' => 'scroll',
4544
'scroll' => '10m',
4645
'size' => $chunkSize,
4746
'source' => true,

Test/AbstractElasticsearchTestCase.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function runTest()
4040
return parent::runTest();
4141
}
4242

43-
foreach (range(1, $this->getNumberOfRetries()) as $try) {
43+
for ($try = 1; $try <= $this->getNumberOfRetries(); $try++) {
4444
try {
4545
return parent::runTest();
4646
} catch (\Exception $e) {
@@ -51,9 +51,13 @@ public function runTest()
5151
if ($try !== $this->getNumberOfRetries()) {
5252
$this->tearDown();
5353
$this->setUp();
54+
} else {
55+
throw $e;
5456
}
5557
}
5658
}
59+
60+
return false;
5761
}
5862

5963
/**

Tests/Functional/Command/CacheClearCommandTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818

1919
class CacheClearCommandTest extends AbstractElasticsearchTestCase
2020
{
21+
/**
22+
* {@inheritdoc}
23+
*/
24+
protected function getDataArray()
25+
{
26+
return ['default' => []];
27+
}
28+
2129
/**
2230
* Tests if command is being executed.
2331
*/

Tests/Functional/Command/IndexImportCommandTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function testIndexImport($bulkSize, $realSize, $filename)
6161
{
6262
$app = new Application();
6363
$app->add($this->getImportCommand());
64+
$manager = $this->getManager();
6465

6566
$command = $app->find('ongr:es:index:import');
6667
$commandTester = new CommandTester($command);
@@ -72,8 +73,6 @@ public function testIndexImport($bulkSize, $realSize, $filename)
7273
]
7374
);
7475

75-
$manager = $this->getManager();
76-
$manager->dropIndex();
7776
$repo = $manager->getRepository('AcmeBarBundle:Product');
7877
$search = $repo
7978
->createSearch()
@@ -83,7 +82,7 @@ public function testIndexImport($bulkSize, $realSize, $filename)
8382

8483
$ids = [];
8584
foreach ($results as $doc) {
86-
$ids[] = substr($doc->id, 3);
85+
$ids[] = substr($doc->getId(), 3);
8786
}
8887
sort($ids);
8988
$data = range(1, $realSize);
@@ -103,6 +102,7 @@ public function testIndexImportWithGzipOption($bulkSize, $realSize, $filename)
103102
{
104103
$app = new Application();
105104
$app->add($this->getImportCommand());
105+
$manager = $this->getManager();
106106

107107
$command = $app->find('ongr:es:index:import');
108108
$commandTester = new CommandTester($command);
@@ -115,8 +115,6 @@ public function testIndexImportWithGzipOption($bulkSize, $realSize, $filename)
115115
]
116116
);
117117

118-
$manager = $this->getManager();
119-
$manager->dropIndex();
120118
$repo = $manager->getRepository('AcmeBarBundle:Product');
121119
$search = $repo
122120
->createSearch()
@@ -126,7 +124,7 @@ public function testIndexImportWithGzipOption($bulkSize, $realSize, $filename)
126124

127125
$ids = [];
128126
foreach ($results as $doc) {
129-
$ids[] = substr($doc->id, 3);
127+
$ids[] = substr($doc->getId(), 3);
130128
}
131129
sort($ids);
132130
$data = range(1, $realSize);

Tests/Functional/Result/DocumentScanIteratorTest.php

Lines changed: 0 additions & 131 deletions
This file was deleted.

0 commit comments

Comments
 (0)