aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/consul/consul.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2026-04-08 17:42:57 +0200
committerGitHub Enterprise <[email protected]>2026-04-08 17:42:57 +0200
commit110aa738efe8f30afd16461fb6e6ee238624f714 (patch)
tree2059294cec9792c2f5e3cc16ea7f1dbd6e25bfa8 /src/zenutil/consul/consul.cpp
parentuse correct return code for unsupported multirange requests in objectstore (#... (diff)
downloadzen-110aa738efe8f30afd16461fb6e6ee238624f714.tar.xz
zen-110aa738efe8f30afd16461fb6e6ee238624f714.zip
fully provisioned hub instances now sets initial check status to "passing" in consul (#930)
Diffstat (limited to 'src/zenutil/consul/consul.cpp')
-rw-r--r--src/zenutil/consul/consul.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/zenutil/consul/consul.cpp b/src/zenutil/consul/consul.cpp
index 951beed65..c9884ea61 100644
--- a/src/zenutil/consul/consul.cpp
+++ b/src/zenutil/consul/consul.cpp
@@ -205,6 +205,10 @@ ConsulClient::RegisterService(const ServiceRegistrationInfo& Info)
{
Writer.AddString("DeregisterCriticalServiceAfter"sv, fmt::format("{}s", Info.DeregisterAfterSeconds));
}
+ if (!Info.InitialStatus.empty())
+ {
+ Writer.AddString("Status"sv, Info.InitialStatus);
+ }
}
Writer.EndObject(); // Check
}
@@ -693,13 +697,18 @@ TEST_CASE("util.consul.service_lifecycle")
REQUIRE(Client.DeregisterService(ServiceId));
CHECK_FALSE(Client.HasService(ServiceId));
- // Phase 3: Register again, verify passing, then fail health and verify check goes critical
+ // Phase 3: Register with InitialStatus, verify immediately passing before any health check fires,
+ // then fail health and verify check goes critical
HealthServer.Mock.HealthCheckCount.store(0);
HealthServer.Mock.FailHealth.store(false);
+ Info.InitialStatus = "passing";
REQUIRE(Client.RegisterService(Info));
REQUIRE(Client.HasService(ServiceId));
+ CHECK_EQ(HealthServer.Mock.HealthCheckCount.load(), 0);
+ CHECK_EQ(GetCheckStatus(Client, ServiceId), "passing");
+
REQUIRE(WaitForCondition([&]() { return HealthServer.Mock.HealthCheckCount.load() >= 1; }, 10000));
CHECK_EQ(GetCheckStatus(Client, ServiceId), "passing");