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 disabled_test_get_stats
111 'fids' => { 'max' => '99', 'count' => '2' },
113 { 'status' => 'alive', 'files' => '2', 'id' => '1', 'host' => 'rur-1' },
114 { 'status' => 'alive', 'files' => '2', 'id' => '2', 'host' => 'rur-2' }
117 { 'files' => '2', 'class' => 'normal', 'devcount' => '2',
120 'file' => [{ 'files' => '2', 'class' => 'normal', 'domain' => 'test' }]
126 def test_get_stats_fids
133 'fids' => { 'max' => 99, 'count' => 2 },
136 assert_equal expected, @client.get_stats('all')
140 @backend.list_fids = {
143 'fid_1_class' => 'normal',
144 'fid_1_devcount' => '2',
145 'fid_1_domain' => 'test',
146 'fid_1_key' => 'file_key',
147 'fid_1_length' => '4',
149 'fid_2_class' => 'normal',
150 'fid_2_devcount' => '2',
151 'fid_2_domain' => 'test',
152 'fid_2_key' => 'new_new_key',
153 'fid_2_length' => '9',
162 "key" => "file_key" },
168 "key" => "new_new_key" },
171 assert_equal expected, @client.list_fids(0, 100)