@@ -228,6 +228,57 @@ def test_cs_feature_bit(self):
228228 stderr = p .stderr .getvalue ()
229229 self .fail ("command failed:\n %s" , stderr )
230230
231+ def test_cs_snaps_set_insensitive (self ):
232+ """
233+ That setting a charmap fails for an empty directory with snaps.
234+ """
235+
236+ attrs = {
237+ "ceph.dir.casesensitive" : False ,
238+ "ceph.dir.normalization" : "nfc" ,
239+ "ceph.dir.encoding" : "utf8" ,
240+ }
241+
242+ self .mount_a .run_shell_payload ("mkdir -p foo/dir; mkdir foo/.snap/one; rmdir foo/dir" )
243+ for attr , v in attrs .items ():
244+ try :
245+ self .mount_a .setfattr ("foo/" , attr , v , helpfulexception = True )
246+ except DirectoryNotEmptyError :
247+ pass
248+ else :
249+ self .fail ("should fail" )
250+ try :
251+ self .check_cs ("foo" )
252+ except NoSuchAttributeError :
253+ pass
254+ else :
255+ self .fail ("should fail" )
256+
257+ def test_cs_parent_snaps_set_insensitive (self ):
258+ """
259+ That setting a charmap succeeds for an empty directory with parent snaps.
260+ """
261+
262+ attrs = {
263+ "ceph.dir.casesensitive" : False ,
264+ "ceph.dir.normalization" : "nfc" ,
265+ "ceph.dir.encoding" : "utf8" ,
266+ }
267+
268+ self .mount_a .run_shell_payload ("mkdir -p foo/{trash,bar}; mkdir foo/.snap/one; rmdir foo/trash;" )
269+ for attr , v in attrs .items ():
270+ try :
271+ self .mount_a .setfattr ("foo/bar" , attr , v , helpfulexception = True )
272+ except DirectoryNotEmptyError :
273+ pass
274+ else :
275+ self .fail ("should fail" )
276+ try :
277+ self .check_cs ("foo/bar" )
278+ except NoSuchAttributeError :
279+ pass
280+ else :
281+ self .fail ("should fail" )
231282
232283 def test_cs_remount (self ):
233284 """
0 commit comments