From ef1c98aff2479793219024cb720a0d36f71e068e Mon Sep 17 00:00:00 2001 From: Adam Cooper Date: Fri, 12 Jul 2024 17:48:30 +0100 Subject: [PATCH] Add healthy check to the smoke test for the service. Side effect being that all 3rd party dependencies of the service must be working for a successful deployment. --- tests/features/check-service-status.feature | 2 +- tests/smoke/context/CommonContext.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/features/check-service-status.feature b/tests/features/check-service-status.feature index 48c2718d44..2e65318237 100644 --- a/tests/features/check-service-status.feature +++ b/tests/features/check-service-status.feature @@ -8,7 +8,7 @@ Feature: Check status of the service Scenario: I want to check the service health Given I fetch the healthcheck endpoint Then I see JSON output - And it contains a "overall_healthy" key/value pair + And the service is declared healthy @smoke Scenario: I want to discover the service version diff --git a/tests/smoke/context/CommonContext.php b/tests/smoke/context/CommonContext.php index f6eb612b61..95e9c7f372 100644 --- a/tests/smoke/context/CommonContext.php +++ b/tests/smoke/context/CommonContext.php @@ -217,6 +217,17 @@ public function iSeeJsonOutput(): void $this->responseJson = $this->assertJsonResponse(); } + /** + * @Then the service is declared healthy + */ + public function theServiceIsDeclaredHealthy(): void + { + $this->responseJson = $this->assertJsonResponse(); + + $this->itContainsAKeyValuePair('overall_healthy'); + Assert::assertTrue($this->responseJson['overall_healthy']); + } + /** * @Then it contains a :key key\/value pair */