aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/caching_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-03-30 17:43:55 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-03-30 17:43:55 -0700
commitad95a61b62e70b839567c2e91e127fc2a1acb113 (patch)
tree92453dda1ef23216e364ec5dcca4768a89e8144e /activesupport/test/caching_test.rb
parentc3d482f0b24dd9cddfbd8ea88976abbcc1e93f85 (diff)
parentc33334fc921894ee035e79591732188a08b3eed9 (diff)
downloadrails-ad95a61b62e70b839567c2e91e127fc2a1acb113.tar.gz
rails-ad95a61b62e70b839567c2e91e127fc2a1acb113.tar.bz2
rails-ad95a61b62e70b839567c2e91e127fc2a1acb113.zip
Merge pull request #4911 from Floppy/master
Reduce FILENAME_MAX_SIZE in ActiveSupport::Cache::FileStore
Diffstat (limited to 'activesupport/test/caching_test.rb')
-rw-r--r--activesupport/test/caching_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index ba027f1ff0..4371a02934 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -579,6 +579,16 @@ class FileStoreTest < ActiveSupport::TestCase
assert_equal "views/index?id=1", @cache_with_pathname.send(:file_path_key, key)
end
+ # Test that generated cache keys are short enough to have Tempfile stuff added to them and
+ # remain valid
+ def test_filename_max_size
+ key = "#{'A' * ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE}"
+ path = @cache.send(:key_file_path, key)
+ Dir::Tmpname.create(path) do |tmpname, n, opts|
+ assert (File.basename(tmpname+'.lock').length <= 255), "Temp filename too long: #{File.basename(tmpname+'.lock').length}"
+ end
+ end
+
# Because file systems have a maximum filename size, filenames > max size should be split in to directories
# If filename is 'AAAAB', where max size is 4, the returned path should be AAAA/B
def test_key_transformation_max_filename_size