From 5187f3bc4c1952031cc16ab5a3f3215b3fcfe7a5 Mon Sep 17 00:00:00 2001 From: Michael de Lang Date: Sun, 23 Jun 2024 23:36:15 +0200 Subject: [PATCH] Do not test retrieving leases if etcd server version is too low --- test/TestServices/Etcdv3UsingService.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/test/TestServices/Etcdv3UsingService.h b/test/TestServices/Etcdv3UsingService.h index 3fbacd70..27f2e8d1 100644 --- a/test/TestServices/Etcdv3UsingService.h +++ b/test/TestServices/Etcdv3UsingService.h @@ -12,6 +12,7 @@ namespace Ichor { } Task> start() final { + _v = _etcd->getDetectedVersion(); co_await put_get_delete_test(); co_await txn_test(); co_await leases_test(); @@ -169,16 +170,18 @@ namespace Ichor { throw std::runtime_error("ttl keys[0] != v3_lease_key"); } - Etcd::v3::LeaseLeasesRequest leasesReq{}; - auto leasesReply = co_await _etcd->leaseLeases(leasesReq); - if(!leasesReply) { - throw std::runtime_error("leases"); - } - if(leasesReply->leases.size() != 1) { - throw std::runtime_error("leases leases.size() != 1"); - } - if(leasesReply->leases[0].id != 101) { - throw std::runtime_error("leases leases[0].id != 101"); + if(_v >= Version{3, 3, 0}) { + Etcd::v3::LeaseLeasesRequest leasesReq{}; + auto leasesReply = co_await _etcd->leaseLeases(leasesReq); + if (!leasesReply) { + throw std::runtime_error("leases"); + } + if (leasesReply->leases.size() != 1) { + throw std::runtime_error("leases leases.size() != 1"); + } + if (leasesReply->leases[0].id != 101) { + throw std::runtime_error("leases leases[0].id != 101"); + } } Etcd::v3::LeaseRevokeRequest revokeReq{101};