Skip to content

Commit

Permalink
Fix issue with elastic tests and improve output
Browse files Browse the repository at this point in the history
  • Loading branch information
donhardman committed Oct 30, 2024
1 parent 6cd8509 commit 3027c11
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/Plugin/Insert/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function run(): Task {
$taskFn = static function (Payload $payload, Client $manticoreClient): TaskResult {
for ($i = 0, $maxI = sizeof($payload->queries) - 1; $i <= $maxI; $i++) {
$query = $payload->queries[$i];

$resp = $manticoreClient->sendRequest($query, $i === 0 ? null : $payload->path);
}

Expand Down
5 changes: 1 addition & 4 deletions test/Plugin/CliTable/CliTableHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Manticoresearch\Buddy\Core\ManticoreSearch\Endpoint as ManticoreEndpoint;
use Manticoresearch\Buddy\Core\ManticoreSearch\RequestFormat;
use Manticoresearch\Buddy\Core\Network\Request;
use Manticoresearch\Buddy\Core\Plugin\TableFormatter;
use Manticoresearch\Buddy\Core\Tool\Buddy;
use Manticoresearch\Buddy\CoreTest\Trait\TestHTTPServerTrait;
use Manticoresearch\Buddy\CoreTest\Trait\TestInEnvironmentTrait;
Expand Down Expand Up @@ -55,20 +54,18 @@ public function testCliTableOk(): void {
$serverUrl = self::setUpMockManticoreServer(false);
$manticoreClient = new HTTPClient($serverUrl);
$manticoreClient->setForceSync(true);
$tableFormatter = new TableFormatter();
Payload::$type = 'queries';
$payload = Payload::fromRequest($request);
$handler = new Handler($payload);
$refCls = new ReflectionClass($handler);
$refCls->getProperty('manticoreClient')->setValue($handler, $manticoreClient);
$refCls->getProperty('tableFormatter')->setValue($handler, $tableFormatter);
go(
function () use ($handler, $respBody) {
$task = $handler->run();
$task->wait(true);

$this->assertEquals(true, $task->isSucceed());
$result = $task->getResult()->getStruct();
$result = $task->getResult()->getTableFormatted(0);
$this->assertIsString($result);
$this->assertStringContainsString($respBody, $result);
self::finishMockManticoreServer();
Expand Down
8 changes: 4 additions & 4 deletions test/src/Trait/TestFunctionalTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,10 @@ protected static function runHttpQuery(
? 'Content-type: application/x-www-form-urlencoded'
: 'Content-type: application/json'
);
exec(
"curl -s 127.0.0.1:$port/$path -H '$header' --data-binary @$payloadFile $redirect",
$output
);

$command = "curl -s 127.0.0.1:$port/$path -H '$header' --data-binary @$payloadFile $redirect";
echo 'Commmand: ' . $command . PHP_EOL;
exec($command, $output);

/** @var array{error:string}|array<int,array{error:string,data:array<int,array<string,string>>,total?:string,columns?:string}> $result */
$result = match ($path) {
Expand Down

0 comments on commit 3027c11

Please sign in to comment.