diff options
author | James Smith <james@floppy.org.uk> | 2012-02-06 17:03:26 +0000 |
---|---|---|
committer | James Smith <james@floppy.org.uk> | 2012-02-06 17:03:26 +0000 |
commit | c33334fc921894ee035e79591732188a08b3eed9 (patch) | |
tree | 0ea731f061658baac991c540e3aee19792457dd9 /activesupport/test | |
parent | af7dafff818094a6e02505fe7d6d87add6c2a7e8 (diff) | |
download | rails-c33334fc921894ee035e79591732188a08b3eed9.tar.gz rails-c33334fc921894ee035e79591732188a08b3eed9.tar.bz2 rails-c33334fc921894ee035e79591732188a08b3eed9.zip |
Change FILENAME_MAX_SIZE in FileStore to 228.
In order that temp filenames generated from it will fit in 255 chars. See https://github.com/rails/rails/issues/4907
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/caching_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index b03865da93..1175db6527 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -575,6 +575,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 |