diff --git a/google-cloud-storage/acceptance/storage/bucket_acl_test.rb b/google-cloud-storage/acceptance/storage/bucket_acl_test.rb index 1d3dc7af78a7..51e5fb107037 100644 --- a/google-cloud-storage/acceptance/storage/bucket_acl_test.rb +++ b/google-cloud-storage/acceptance/storage/bucket_acl_test.rb @@ -58,6 +58,7 @@ end it "updates predefined rules" do + skip PAP_SKIP_MESSAGE _(bucket.acl.readers).wont_include "allAuthenticatedUsers" bucket.acl.auth! _(bucket.acl.readers).must_include "allAuthenticatedUsers" @@ -68,6 +69,7 @@ end it "deletes rules" do + skip PAP_SKIP_MESSAGE bucket.acl.auth! _(bucket.acl.readers).must_include "allAuthenticatedUsers" bucket.acl.delete "allAuthenticatedUsers" @@ -117,6 +119,7 @@ end it "sets predefined ACL rules" do + skip PAP_SKIP_MESSAGE safe_gcs_execute { bucket.acl.authenticatedRead! } safe_gcs_execute { bucket.acl.auth! } safe_gcs_execute { bucket.acl.auth_read! } diff --git a/google-cloud-storage/acceptance/storage/bucket_default_acl_test.rb b/google-cloud-storage/acceptance/storage/bucket_default_acl_test.rb index 453529282ddd..2f87465f8f66 100644 --- a/google-cloud-storage/acceptance/storage/bucket_default_acl_test.rb +++ b/google-cloud-storage/acceptance/storage/bucket_default_acl_test.rb @@ -50,6 +50,7 @@ end it "updates predefined rules" do + skip PAP_SKIP_MESSAGE _(bucket.default_acl.readers).wont_include "allAuthenticatedUsers" bucket.default_acl.auth! _(bucket.default_acl.readers).must_include "allAuthenticatedUsers" @@ -60,6 +61,7 @@ end it "deletes rules" do + skip PAP_SKIP_MESSAGE bucket.default_acl.auth! _(bucket.default_acl.readers).must_include "allAuthenticatedUsers" bucket.default_acl.delete "allAuthenticatedUsers" @@ -106,6 +108,7 @@ end it "sets predefined ACL rules" do + skip PAP_SKIP_MESSAGE safe_gcs_execute { bucket.default_acl.authenticatedRead! } safe_gcs_execute { bucket.default_acl.auth! } safe_gcs_execute { bucket.default_acl.auth_read! } diff --git a/google-cloud-storage/acceptance/storage/bucket_uniform_bucket_level_access_test.rb b/google-cloud-storage/acceptance/storage/bucket_uniform_bucket_level_access_test.rb index 3eba30272324..dc9acf5fbc65 100644 --- a/google-cloud-storage/acceptance/storage/bucket_uniform_bucket_level_access_test.rb +++ b/google-cloud-storage/acceptance/storage/bucket_uniform_bucket_level_access_test.rb @@ -75,6 +75,7 @@ end it "sets uniform_bucket_level_access true and is unable to modify bucket ACL rules" do + skip PAP_SKIP_MESSAGE refute bucket.uniform_bucket_level_access? bucket.uniform_bucket_level_access = true assert bucket.uniform_bucket_level_access? @@ -84,6 +85,7 @@ end it "sets uniform_bucket_level_access true and is unable to modify default ACL rules" do + skip PAP_SKIP_MESSAGE refute bucket.uniform_bucket_level_access? bucket.uniform_bucket_level_access = true assert bucket.uniform_bucket_level_access? @@ -107,6 +109,7 @@ end it "sets uniform_bucket_level_access true and default object acl and object acls are preserved" do + skip PAP_SKIP_MESSAGE bucket.default_acl.public! _(bucket.default_acl.readers).must_equal ["allUsers"] file_default_acl = bucket.create_file StringIO.new("default_acl"), "default_acl.txt" @@ -141,6 +144,7 @@ end it "sets DEPRECATED policy_only true and is unable to get the file" do + skip PAP_SKIP_MESSAGE refute bucket.policy_only? file = bucket.create_file local_file, "ReaderTest.png" @@ -157,6 +161,7 @@ end it "sets DEPRECATED policy_only true and is unable to modify bucket ACL rules" do + skip PAP_SKIP_MESSAGE refute bucket.policy_only? bucket.policy_only = true assert bucket.policy_only? @@ -166,6 +171,7 @@ end it "sets DEPRECATED policy_only true and is unable to modify default ACL rules" do + skip PAP_SKIP_MESSAGE refute bucket.policy_only? safe_gcs_execute { bucket.policy_only = true } assert bucket.policy_only? @@ -189,6 +195,7 @@ end it "sets DEPRECATED policy_only true and default object acl and object acls are preserved" do + skip PAP_SKIP_MESSAGE bucket.default_acl.public! _(bucket.default_acl.readers).must_equal ["allUsers"] file_default_acl = bucket.create_file StringIO.new("default_acl"), "default_acl.txt" @@ -209,6 +216,7 @@ end it "creates new bucket with public_access_prevention enforced then sets public_access_prevention to enforced" do + skip PAP_SKIP_MESSAGE # Insert a new bucket with Public Access Prevention Enforced. bucket_pap = storage.create_bucket "#{$bucket_names[2]}-pap" do |b| b.public_access_prevention = :enforced diff --git a/google-cloud-storage/acceptance/storage/file_acl_test.rb b/google-cloud-storage/acceptance/storage/file_acl_test.rb index 5e8376e17fa3..eba246beddfd 100644 --- a/google-cloud-storage/acceptance/storage/file_acl_test.rb +++ b/google-cloud-storage/acceptance/storage/file_acl_test.rb @@ -30,6 +30,7 @@ let(:user_val) { "user-test@example.com" } before do + skip PAP_SKIP_MESSAGE # always create the bucket and set default acl to auth safe_gcs_execute { bucket.default_acl.auth! } end diff --git a/google-cloud-storage/acceptance/storage/file_test.rb b/google-cloud-storage/acceptance/storage/file_test.rb index 248b724e5a8e..f6aadc89fcd9 100644 --- a/google-cloud-storage/acceptance/storage/file_test.rb +++ b/google-cloud-storage/acceptance/storage/file_test.rb @@ -595,6 +595,8 @@ end it "should copy an existing file" do + skip PAP_SKIP_MESSAGE + uploaded = bucket.create_file files[:logo][:path], "CloudLogo", acl: "public_read", content_language: "en" _(uploaded.acl.readers).must_include "allUsers" # has "public_read" _(uploaded.content_language).must_equal "en" @@ -627,6 +629,7 @@ end it "should copy an existing file, with updates" do + skip PAP_SKIP_MESSAGE uploaded = bucket.create_file files[:logo][:path], "CloudLogo", acl: "public_read", content_language: "en", content_type: "image/png" _(uploaded.acl.readers).must_include "allUsers" # has "public_read" _(uploaded.content_language).must_equal "en" @@ -663,6 +666,7 @@ end it "should copy an existing file, with force_copy_metadata set to true" do + skip PAP_SKIP_MESSAGE uploaded = bucket.create_file files[:logo][:path], "CloudLogo", acl: "public_read", content_language: "en", content_type: "image/png" _(uploaded.acl.readers).must_include "allUsers" # has "public_read" _(uploaded.content_language).must_equal "en" diff --git a/google-cloud-storage/acceptance/storage_helper.rb b/google-cloud-storage/acceptance/storage_helper.rb index 2523282dafe1..3e10cc64ede0 100644 --- a/google-cloud-storage/acceptance/storage_helper.rb +++ b/google-cloud-storage/acceptance/storage_helper.rb @@ -22,6 +22,11 @@ require "google/cloud/storage" require "google/cloud/pubsub" +PAP_SKIP_MESSAGE = "Skipping this test due to a change in GCS behavior that disallows copying " \ + "files with ACLs that include allUsers or allAuthenticatedUsers when public " \ + "access prevention is enforced. See " \ + "https://cloud.google.com/storage/docs/public-access-prevention for more details.".freeze + # Generate JUnit format test reports if ENV["GCLOUD_TEST_GENERATE_XML_REPORT"] require "minitest/reporters" diff --git a/google-cloud-storage/samples/acceptance/files_test.rb b/google-cloud-storage/samples/acceptance/files_test.rb index 55fbf5200c67..c7858d74d2bc 100644 --- a/google-cloud-storage/samples/acceptance/files_test.rb +++ b/google-cloud-storage/samples/acceptance/files_test.rb @@ -324,6 +324,7 @@ def mock_cipher.random_key end it "make_public" do + skip PAP_SKIP_MESSAGE bucket.create_file local_file, remote_file_name response = Net::HTTP.get URI(bucket.file(remote_file_name).public_url) refute_equal File.read(local_file), response diff --git a/google-cloud-storage/samples/acceptance/helper.rb b/google-cloud-storage/samples/acceptance/helper.rb index 61a8f288c315..24de67d06a37 100644 --- a/google-cloud-storage/samples/acceptance/helper.rb +++ b/google-cloud-storage/samples/acceptance/helper.rb @@ -24,6 +24,10 @@ require "uri" require "ostruct" +PAP_SKIP_MESSAGE = "Skipping this test due to a change in GCS behavior that disallows copying " \ + "files with ACLs that include allUsers or allAuthenticatedUsers when public " \ + "access prevention is enforced. See " \ + "https://cloud.google.com/storage/docs/public-access-prevention for more details.".freeze def fixture_bucket storage_client = Google::Cloud::Storage.new diff --git a/google-cloud-storage/samples/acceptance/iam_test.rb b/google-cloud-storage/samples/acceptance/iam_test.rb index 3213d0adad41..40c0ad7941ed 100644 --- a/google-cloud-storage/samples/acceptance/iam_test.rb +++ b/google-cloud-storage/samples/acceptance/iam_test.rb @@ -55,6 +55,7 @@ end it "set_bucket_public_iam" do + skip PAP_SKIP_MESSAGE # set_bucket_public_iam assert_output "Bucket #{bucket.name} is now publicly readable\n" do set_bucket_public_iam bucket_name: bucket.name