]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
unit test LFNIndex::lfn_get_name
authorLoic Dachary <loic@dachary.org>
Wed, 27 Mar 2013 20:02:57 +0000 (16:02 -0400)
committerLoic Dachary <loic@dachary.org>
Thu, 28 Mar 2013 07:58:57 +0000 (08:58 +0100)
commitc8ac1ee9f898fdb7c5b60f29760f756a487904de
tree5f68a93d0ba981ceae7abd21a83d46c732de86bf
parentb9c8d4f8966054bf3471fe24f8dfdc411d18bba9
unit test LFNIndex::lfn_get_name

The escape logic is tested for

  * leading . => \.
  * / => \s
  * \ => \\
  * leading DIR_ => \d

The file names for small object names ( size < FILENAME_PREFIX_LEN )
are created with CEPH_NOSNAP and checked to contain the _head string
and not the _long string.

The file names for long object names ( size >= FILENAME_PREFIX_LEN )
are tested to contain the _long string. A matching file is created to
check that it is removed unless it contains the expected extended
attribute.

If the SHA1 of two long object names collide and they have the same
prefix, lfn_get_name increments an anticollision counter to
differentiate them. This condition is engineered because it would be
really difficult to find two long names that actually create such a
collision.

The lfn_get_name method is private and the get_mangled_name method is
used to access it. The out_path argument is not available and cannot
be tested. However it is a trivial concatenation of the stringsin the
path vector.

A TestIndex class is derived from the LFNIndex class to set the pure
virtual functions. The TestLFNIndex fixture is derived from it so that
the tests get access to the protected methods of LFNIndex

The SetUp method of the fixture creates a PATH directory to be used by
all tests as the base path for all object files.

http://tracker.ceph.com/issues/4560 refs #4560

Signed-off-by: Loic Dachary <loic@dachary.org>
src/Makefile.am
src/test/os/TestLFNIndex.cc [new file with mode: 0644]