Skip to content

Commit

Permalink
Do not test retrieving leases if etcd server version is too low
Browse files Browse the repository at this point in the history
  • Loading branch information
Oipo committed Jun 23, 2024
1 parent c613939 commit 5187f3b
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions test/TestServices/Etcdv3UsingService.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Ichor {
}

Task<tl::expected<void, Ichor::StartError>> start() final {
_v = _etcd->getDetectedVersion();
co_await put_get_delete_test();
co_await txn_test();
co_await leases_test();
Expand Down Expand Up @@ -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};
Expand Down

0 comments on commit 5187f3b

Please sign in to comment.