Skip to content

Commit

Permalink
Signed-off-by: Bram Leeda <[email protected]>
Browse files Browse the repository at this point in the history
Add extra assertions for the ElasticSearch check result data
  • Loading branch information
bram123 committed Jan 4, 2023
1 parent 19581cd commit 192bf3f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/ElasticSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ public function testElasticSearch(string $clusterStatus, string $expectedResult)
$mockClient = new Client(['handler' => $mockHandler]);
$check = new ElasticSearch('localhost:9200', [], [], $mockClient);

static::assertInstanceOf($expectedResult, $check->check());
// Assert the ElasticSearch check converts the API response to the correct ResultInterface implementation
$checkResult = $check->check();
static::assertInstanceOf($expectedResult, $checkResult);

// Assert ElasticSearch check returns extra data
$resultData = $checkResult->getData();
static::assertIsArray($resultData);
static::assertArrayHasKey('responseTime', $resultData);
static::assertIsNumeric($resultData['responseTime']);
}

/**
Expand Down

0 comments on commit 192bf3f

Please sign in to comment.