rfuse 1.1.2 → 1.2.0.rc202009.69

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,49 +0,0 @@
1
- require 'spec_helper'
2
- require 'ffi-xattr'
3
-
4
- describe RFuse::Fuse do
5
- it "should handle extended attributes" do
6
- mockfs = mock("fuse")
7
-
8
- file_stat = RFuse::Stat.file(0444,:size => 11)
9
-
10
- mockfs.stub(:getattr).and_return(file_stat)
11
- mockfs.stub(:getxattr) { |ctx,path,name|
12
- case name
13
- when "user.one"
14
- "1"
15
- when "user.two"
16
- "2"
17
- when "user.large"
18
- "x" * 1000
19
- else
20
- ""
21
- end
22
- }
23
-
24
- mockfs.stub(:listxattr).with(anything(),"/myfile").and_return([ "user.one","user.two","user.large" ])
25
- mockfs.should_receive(:setxattr).with(anything(),"/myfile","user.three","updated",anything())
26
- mockfs.should_receive(:removexattr).with(anything(),"/myfile","user.one")
27
-
28
- mountpoint = tempmount()
29
-
30
- with_fuse(mountpoint,mockfs) do
31
- xattr = Xattr.new("#{mountpoint}/myfile")
32
- xattr.list.should include("user.one")
33
- xattr.list.should include("user.two")
34
- xattr.list.size.should == 3
35
-
36
- xattr['user.one'].should == "1"
37
- xattr['user.two'].should == "2"
38
- xattr['user.three']= "updated"
39
- xattr['xxxxx'].should be_nil
40
- xattr.remove('user.one')
41
- # And now with a non-ruby system #TODO. There'd be a way to guard this properly
42
- if system("getfattr --version")
43
- system("getfattr -d #{mountpoint}/myfile > /dev/null").should be(true)
44
- else
45
- puts "Warning Skipping getfattr test"
46
- end
47
- end
48
- end
49
- end