From f5022e669f48ec2fe4b7ad30fd8563b352ac331a Mon Sep 17 00:00:00 2001 From: Dimitris Christodoulou Date: Wed, 26 Aug 2026 12:08:28 +0100 Subject: [PATCH] Improve stability of test_update_bucket_history_retention --- test/bucket_manager_test.rb | 5 +++++ test/utils/consistency_helper.rb | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/test/bucket_manager_test.rb b/test/bucket_manager_test.rb index 9de42cf3..79d18656 100644 --- a/test/bucket_manager_test.rb +++ b/test/bucket_manager_test.rb @@ -115,6 +115,11 @@ def test_update_bucket_history_retention s.history_retention_duration = 600 end, ) + + env.consistency.wait_until_bucket_satisfies_predicate(bucket_name) do |c| + c["historyRetentionCollectionDefault"] == false + end + res = @bucket_manager.get_bucket(bucket_name) refute res.history_retention_collection_default diff --git a/test/utils/consistency_helper.rb b/test/utils/consistency_helper.rb index e9c647e3..a6da3e5a 100644 --- a/test/utils/consistency_helper.rb +++ b/test/utils/consistency_helper.rb @@ -66,8 +66,8 @@ def fetch_hosts(management_endpoint, timeout: DEFAULT_TIMEOUT_SECS) node_services = JSON.parse(node_services_resp.body) config["nodes"].zip(node_services["nodesExt"]).each do |node, node_ext| - @management_hosts << node["configuredHostname"] - host = node["configuredHostname"].split(":")[0] + @management_hosts << node["hostname"] + host = node["hostname"].split(":")[0] @query_hosts << "#{host}:#{node_ext['services']['n1ql']}" if node_ext["services"].key?("n1ql") end break @@ -88,6 +88,14 @@ def wait_until_bucket_dropped(name, timeout: DEFAULT_TIMEOUT_SECS) end end + def wait_until_bucket_satisfies_predicate(bucket_name, timeout: DEFAULT_TIMEOUT_SECS, &blk) + wait_until(timeout, + "Bucket `#{bucket_name}` does not satisfy the predicate at " \ + "#{blk.source_location.join(':')} in all nodes") do + resource_satisfies_predicate("pools/default/buckets/#{bucket_name}", &blk) + end + end + def wait_until_scope_present(bucket_name, scope_name, timeout: DEFAULT_TIMEOUT_SECS) wait_until(timeout, "Scope `#{scope_name}` in bucket `#{bucket_name}` is not present in all nodes") do resource_satisfies_predicate("pools/default/buckets/#{bucket_name}/scopes") do |resp|