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
3 changes: 3 additions & 0 deletions google-cloud-storage/acceptance/storage/bucket_acl_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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! }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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! }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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?
Expand All @@ -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"
Expand Down Expand Up @@ -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"

Expand All @@ -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?
Expand All @@ -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?
Expand All @@ -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"
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions google-cloud-storage/acceptance/storage/file_acl_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions google-cloud-storage/acceptance/storage/file_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions google-cloud-storage/acceptance/storage_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions google-cloud-storage/samples/acceptance/files_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions google-cloud-storage/samples/acceptance/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions google-cloud-storage/samples/acceptance/iam_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading