3 class TestMogileFS__Admin < TestMogileFS
6 @klass = MogileFS::Admin
11 res = {"host1_remoteroot"=>"/mnt/mogilefs/rur-1",
12 "host1_hostname"=>"rur-1",
14 "host1_http_get_port"=>"",
18 "host1_http_port"=>"",
19 "host1_status"=>"alive",
21 actual = @client.clean 'hosts', 'host', res
23 expected = [{"status"=>"alive",
29 "remoteroot"=>"/mnt/mogilefs/rur-1",
33 assert_equal expected, actual
42 @backend.list_fids = {
45 'fid_1_class' => 'normal',
46 'fid_1_devcount' => '2',
47 'fid_1_domain' => 'test',
48 'fid_1_key' => 'file_key',
49 'fid_1_length' => '4',
52 @backend.list_fids = {
55 'fid_1_class' => 'normal',
56 'fid_1_devcount' => '2',
57 'fid_1_domain' => 'test',
58 'fid_1_key' => 'new_new_key',
59 'fid_1_length' => '9',
63 @client.each_fid { |fid| fids << fid }
71 "key" => "file_key" },
77 "key" => "new_new_key" },
80 assert_equal expected, fids
84 @backend.get_domains = {
87 'domain2' => 'images',
88 'domain1classes' => '1',
89 'domain2classes' => '2',
90 'domain1class1name' => 'default',
91 'domain1class1mindevcount' => '2',
92 'domain2class1name' => 'default',
93 'domain2class1mindevcount' => '2',
94 'domain2class2name' => 'resize',
95 'domain2class2mindevcount' => '1',
99 'test' => { 'default' => 2, },
100 'images' => { 'default' => 2, 'resize' => 1 },
103 assert_equal expected, @client.get_domains
106 def disabled_test_get_stats
110 'fids' => { 'max' => '99', 'count' => '2' },
112 { 'status' => 'alive', 'files' => '2', 'id' => '1', 'host' => 'rur-1' },
113 { 'status' => 'alive', 'files' => '2', 'id' => '2', 'host' => 'rur-2' }
116 { 'files' => '2', 'class' => 'normal', 'devcount' => '2',
119 'file' => [{ 'files' => '2', 'class' => 'normal', 'domain' => 'test' }]
125 def test_get_stats_fids
132 'fids' => { 'max' => 99, 'count' => 2 },
135 assert_equal expected, @client.get_stats('all')
139 @backend.list_fids = {
142 'fid_1_class' => 'normal',
143 'fid_1_devcount' => '2',
144 'fid_1_domain' => 'test',
145 'fid_1_key' => 'file_key',
146 'fid_1_length' => '4',
148 'fid_2_class' => 'normal',
149 'fid_2_devcount' => '2',
150 'fid_2_domain' => 'test',
151 'fid_2_key' => 'new_new_key',
152 'fid_2_length' => '9',
161 "key" => "file_key" },
167 "key" => "new_new_key" },
170 assert_equal expected, @client.list_fids(0, 100)