Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/collection_manager_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ def test_update_collection_history_retention

settings = Management::UpdateCollectionSettings.new(history: true)
@magma_collection_manager.update_collection(scope_name, collection_name, settings)
env.consistency.wait_until_collection_satisfies_predicate(TEST_MAGMA_BUCKET_NAME, scope_name, collection_name) do |c|
c["history"] == true
end

coll = get_collection(scope_name, collection_name, @magma_collection_manager)

Expand Down Expand Up @@ -479,6 +482,9 @@ def test_update_collection_max_expiry

settings = Management::UpdateCollectionSettings.new(max_expiry: 1)
@collection_manager.update_collection(scope_name, collection_name, settings)
env.consistency.wait_until_collection_satisfies_predicate(env.bucket, scope_name, collection_name) do |c|
c["maxTTL"] == 1
end

coll_spec = get_collection(scope_name, collection_name)

Expand Down Expand Up @@ -529,6 +535,9 @@ def test_update_collection_max_expiry_no_expiry
settings = Management::UpdateCollectionSettings.new(max_expiry: -1)

@collection_manager.update_collection(scope_name, collection_name, settings)
env.consistency.wait_until_collection_satisfies_predicate(env.bucket, scope_name, collection_name) do |c|
c["maxTTL"] == -1
end

coll_spec = get_collection(scope_name, collection_name)

Expand Down
12 changes: 12 additions & 0 deletions test/utils/consistency_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ def wait_until_collection_dropped(bucket_name, scope_name, collection_name, time
end
end

def wait_until_collection_satisfies_predicate(bucket_name, scope_name, collection_name, timeout: DEFAULT_TIMEOUT_SECS, &blk)
wait_until(timeout,
"Collection `#{collection_name}` in scope `#{scope_name}` & 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}/scopes") do |resp|
resp["scopes"].any? do |scope|
scope["name"] == scope_name && scope["collections"].any? { |c| c["name"] == collection_name && yield(c) }
Comment thread
DemetrisChr marked this conversation as resolved.
end
end
end
end

def wait_until_bucket_present_in_indexes(name, timeout: DEFAULT_TIMEOUT_SECS)
wait_until(timeout, "Bucket `#{name}` is not present in the query service in all nodes") do
@query_hosts.all? do |host|
Expand Down
Loading