aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/cache/cache_entry_test.rb
diff options
context:
space:
mode:
authorGodfrey Chan <godfreykfc@gmail.com>2018-04-11 21:38:02 -0700
committerGodfrey Chan <godfreykfc@gmail.com>2018-04-11 21:43:51 -0700
commit84b1feeaff94a598b335c5d3f73c4f74f489a165 (patch)
tree5f97c2846f99622983ce1e041367a1260cb97a78 /activesupport/test/cache/cache_entry_test.rb
parent7622b85a300a1863ece44eb429ddabdadbee7f77 (diff)
downloadrails-84b1feeaff94a598b335c5d3f73c4f74f489a165.tar.gz
rails-84b1feeaff94a598b335c5d3f73c4f74f489a165.tar.bz2
rails-84b1feeaff94a598b335c5d3f73c4f74f489a165.zip
Add failing test for compression bug
On Rails 5.2, when compression is enabled (which it is by default), the actual value being written to the underlying storage is actually _bigger_ than the uncompressed raw value. This is because the `@marshaled_value` instance variable (typically) gets serialized with the entry object, which is then written to the underlying storage, essentially double-storing every value (once uncompressed, once possibly compressed). This regression was introduced in #32254.
Diffstat (limited to 'activesupport/test/cache/cache_entry_test.rb')
-rw-r--r--activesupport/test/cache/cache_entry_test.rb21
1 files changed, 0 insertions, 21 deletions
diff --git a/activesupport/test/cache/cache_entry_test.rb b/activesupport/test/cache/cache_entry_test.rb
index 80ff7ad564..d7baaa5c72 100644
--- a/activesupport/test/cache/cache_entry_test.rb
+++ b/activesupport/test/cache/cache_entry_test.rb
@@ -13,25 +13,4 @@ class CacheEntryTest < ActiveSupport::TestCase
assert entry.expired?, "entry is expired"
end
end
-
- def test_compressed_values
- value = "value" * 100
- entry = ActiveSupport::Cache::Entry.new(value, compress: true, compress_threshold: 1)
- assert_equal value, entry.value
- assert(value.bytesize > entry.size, "value is compressed")
- end
-
- def test_compressed_by_default
- value = "value" * 100
- entry = ActiveSupport::Cache::Entry.new(value, compress_threshold: 1)
- assert_equal value, entry.value
- assert(value.bytesize > entry.size, "value is compressed")
- end
-
- def test_uncompressed_values
- value = "value" * 100
- entry = ActiveSupport::Cache::Entry.new(value, compress: false)
- assert_equal value, entry.value
- assert_equal value.bytesize, entry.size
- end
end