Skip to content

Commit b4f30fa

Browse files
committed
adjust the import test when gzip is used gzip
1 parent c49241c commit b4f30fa

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

Tests/Functional/Command/IndexImportCommandTest.php

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -85,37 +85,37 @@ public function testIndexImport(int $bulkSize, int $realSize, string $filename)
8585
*
8686
* @dataProvider compressedDataProvider
8787
*/
88-
// public function testIndexImportWithGzipOption($bulkSize, $realSize, $filename)
89-
// {
90-
// $index = $this->getIndex(DummyDocument::class);
91-
//
92-
// $app = new Application();
93-
// $app->add($this->getImportCommand());
94-
//
95-
// $command = $app->find('ongr:es:index:import');
96-
// $commandTester = new CommandTester($command);
97-
// $commandTester->execute(
98-
// [
99-
// 'command' => $command->getName(),
100-
// 'filename' => __DIR__ . '/../../app/data_seed/' . $filename,
101-
// '--bulk-size' => $bulkSize,
102-
// '--gzip' => null,
103-
// ]
104-
// );
105-
//
106-
//
107-
// $search = $index->createSearch()->addQuery(new MatchAllQuery())->setSize($realSize);
108-
// $results = $index->findDocuments($search);
109-
//
110-
// $ids = [];
111-
// /** @var DummyDocument $doc */
112-
// foreach ($results as $doc) {
113-
// $ids[] = (int)$doc->id;
114-
// }
115-
// sort($ids);
116-
// $data = range(1, $realSize);
117-
// $this->assertEquals($data, $ids);
118-
// }
88+
public function testIndexImportWithGzipOption($bulkSize, $realSize, $filename)
89+
{
90+
$index = $this->getIndex(DummyDocument::class);
91+
92+
$app = new Application();
93+
$app->add($this->getImportCommand());
94+
95+
$command = $app->find('ongr:es:index:import');
96+
$commandTester = new CommandTester($command);
97+
$commandTester->execute(
98+
[
99+
'command' => $command->getName(),
100+
'filename' => __DIR__ . '/../../app/data_seed/' . $filename,
101+
'--bulk-size' => $bulkSize,
102+
'--gzip' => null,
103+
]
104+
);
105+
106+
107+
$search = $index->createSearch()->addQuery(new MatchAllQuery())->setSize($realSize);
108+
$results = $index->findDocuments($search);
109+
110+
$ids = [];
111+
/** @var DummyDocument $doc */
112+
foreach ($results as $doc) {
113+
$ids[] = (int)$doc->id;
114+
}
115+
sort($ids);
116+
$data = range(1, $realSize);
117+
$this->assertEquals($data, $ids);
118+
}
119119

120120
/**
121121
* Returns import index command with assigned container.
161 Bytes
Binary file not shown.
164 Bytes
Binary file not shown.
150 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)