Skip to content

Commit

Permalink
Fixing abstract elastic search test exception throwing. (#713)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
saimaz authored Nov 18, 2016
1 parent c8d5454 commit ca1dba0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 139 deletions.
1 change: 0 additions & 1 deletion Service/ExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function exportIndex(
$maxLinesInFile = 300000
) {
$params = [
'search_type' => 'scroll',
'scroll' => '10m',
'size' => $chunkSize,
'source' => true,
Expand Down
6 changes: 5 additions & 1 deletion Test/AbstractElasticsearchTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function runTest()
return parent::runTest();
}

foreach (range(1, $this->getNumberOfRetries()) as $try) {
for ($try = 1; $try <= $this->getNumberOfRetries(); $try++) {
try {
return parent::runTest();
} catch (\Exception $e) {
Expand All @@ -51,9 +51,13 @@ public function runTest()
if ($try !== $this->getNumberOfRetries()) {
$this->tearDown();
$this->setUp();
} else {
throw $e;
}
}
}

return false;
}

/**
Expand Down
8 changes: 8 additions & 0 deletions Tests/Functional/Command/CacheClearCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@

class CacheClearCommandTest extends AbstractElasticsearchTestCase
{
/**
* {@inheritdoc}
*/
protected function getDataArray()
{
return ['default' => []];
}

/**
* Tests if command is being executed.
*/
Expand Down
10 changes: 4 additions & 6 deletions Tests/Functional/Command/IndexImportCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function testIndexImport($bulkSize, $realSize, $filename)
{
$app = new Application();
$app->add($this->getImportCommand());
$manager = $this->getManager();

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

$manager = $this->getManager();
$manager->dropIndex();
$repo = $manager->getRepository('AcmeBarBundle:Product');
$search = $repo
->createSearch()
Expand All @@ -83,7 +82,7 @@ public function testIndexImport($bulkSize, $realSize, $filename)

$ids = [];
foreach ($results as $doc) {
$ids[] = substr($doc->id, 3);
$ids[] = substr($doc->getId(), 3);
}
sort($ids);
$data = range(1, $realSize);
Expand All @@ -103,6 +102,7 @@ public function testIndexImportWithGzipOption($bulkSize, $realSize, $filename)
{
$app = new Application();
$app->add($this->getImportCommand());
$manager = $this->getManager();

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

$manager = $this->getManager();
$manager->dropIndex();
$repo = $manager->getRepository('AcmeBarBundle:Product');
$search = $repo
->createSearch()
Expand All @@ -126,7 +124,7 @@ public function testIndexImportWithGzipOption($bulkSize, $realSize, $filename)

$ids = [];
foreach ($results as $doc) {
$ids[] = substr($doc->id, 3);
$ids[] = substr($doc->getId(), 3);
}
sort($ids);
$data = range(1, $realSize);
Expand Down
131 changes: 0 additions & 131 deletions Tests/Functional/Result/DocumentScanIteratorTest.php

This file was deleted.

0 comments on commit ca1dba0

Please sign in to comment.