From 6789003e9ba29f08a357435c9d01549a7ca41130 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 16 Jul 2026 14:53:28 -0700 Subject: [PATCH] chore(storage): fix order dependency in get_object_contexts test Currently this fails if the order is incorrect: ``` -Key: my-custom-key, Value: my-custom-value Key: my-custom-key-2, Value: my-custom-value-2 +Key: my-custom-key, Value: my-custom-value ``` Noticed in https://github.com/googleapis/google-cloud-ruby/pull/34751 --- google-cloud-storage/samples/acceptance/files_test.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/google-cloud-storage/samples/acceptance/files_test.rb b/google-cloud-storage/samples/acceptance/files_test.rb index aa8bf1f10f49..bbee97a951ce 100644 --- a/google-cloud-storage/samples/acceptance/files_test.rb +++ b/google-cloud-storage/samples/acceptance/files_test.rb @@ -337,10 +337,13 @@ def mock_cipher.random_key set_object_contexts bucket_name: bucket.name, file_name: remote_file_name, custom_context_key: custom_context_key2, custom_context_value: custom_context_value2 end it "fetches all object contexts" do - - assert_output "Custom Contexts for #{remote_file_name} are:\nKey: #{custom_context_key1}, Value: #{custom_context_value1}\nKey: #{custom_context_key2}, Value: #{custom_context_value2}\n" do + out, _err = capture_io do get_object_contexts bucket_name: bucket.name, file_name: remote_file_name end + + assert_includes out, "Custom Contexts for #{remote_file_name} are:\n" + assert_includes out, "Key: #{custom_context_key1}, Value: #{custom_context_value1}\n" + assert_includes out, "Key: #{custom_context_key2}, Value: #{custom_context_value2}\n" end end