1 # -*- encoding: binary -*-
4 class TestMogileFS__Admin < TestMogileFS
7 @klass = MogileFS::Admin
12 res = {"host1_remoteroot"=>"/mnt/mogilefs/rur-1",
13 "host1_hostname"=>"rur-1",
15 "host1_http_get_port"=>"",
19 "host1_http_port"=>"",
20 "host1_status"=>"alive",
22 actual = @client.clean 'hosts', 'host', res
24 expected = [{"status"=>"alive",
30 "remoteroot"=>"/mnt/mogilefs/rur-1",
34 assert_equal expected, actual
43 @backend.list_fids = {
46 'fid_1_class' => 'normal',
47 'fid_1_devcount' => '2',
48 'fid_1_domain' => 'test',
49 'fid_1_key' => 'file_key',
50 'fid_1_length' => '4',
53 @backend.list_fids = {
56 'fid_1_class' => 'normal',
57 'fid_1_devcount' => '2',
58 'fid_1_domain' => 'test',
59 'fid_1_key' => 'new_new_key',
60 'fid_1_length' => '9',
64 @client.each_fid { |fid| fids << fid }
72 "key" => "file_key" },
78 "key" => "new_new_key" },
81 assert_equal expected, fids
85 @backend.get_domains = {
88 'domain2' => 'images',
89 'domain1classes' => '1',
90 'domain2classes' => '2',
91 'domain1class1name' => 'default',
92 'domain1class1mindevcount' => '2',
93 'domain2class1name' => 'default',
94 'domain2class1mindevcount' => '2',
95 'domain2class2name' => 'resize',
96 'domain2class2mindevcount' => '1',
100 'test' => { 'default' => 2, },
101 'images' => { 'default' => 2, 'resize' => 1 },
104 assert_equal expected, @client.get_domains
107 def test_get_stats_fids
114 'fids' => { 'max' => 99, 'count' => 2 },
117 assert_equal expected, @client.get_stats('all')
121 @backend.list_fids = {
124 'fid_1_class' => 'normal',
125 'fid_1_devcount' => '2',
126 'fid_1_domain' => 'test',
127 'fid_1_key' => 'file_key',
128 'fid_1_length' => '4',
130 'fid_2_class' => 'normal',
131 'fid_2_devcount' => '2',
132 'fid_2_domain' => 'test',
133 'fid_2_key' => 'new_new_key',
134 'fid_2_length' => '9',
143 "key" => "file_key" },
149 "key" => "new_new_key" },
152 assert_equal expected, @client.list_fids(0, 100)