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
38 @backend.list_fids = {
41 'fid_1_class' => 'normal',
42 'fid_1_devcount' => '2',
43 'fid_1_domain' => 'test',
44 'fid_1_key' => 'file_key',
45 'fid_1_length' => '4',
48 @backend.list_fids = {
51 'fid_1_class' => 'normal',
52 'fid_1_devcount' => '2',
53 'fid_1_domain' => 'test',
54 'fid_1_key' => 'new_new_key',
55 'fid_1_length' => '9',
57 @backend.list_fids = { 'fid_count' => 0 }
60 @client.each_fid { |fid| fids << fid }
68 "key" => "file_key" },
74 "key" => "new_new_key" },
77 assert_equal expected, fids
81 @backend.get_domains = {
84 'domain2' => 'images',
85 'domain1classes' => '1',
86 'domain2classes' => '2',
87 'domain1class1name' => 'default',
88 'domain1class1mindevcount' => '2',
89 'domain2class1name' => 'default',
90 'domain2class1mindevcount' => '2',
91 'domain2class2name' => 'resize',
92 'domain2class2mindevcount' => '1',
96 'test' => { 'default' => 2, },
97 'images' => { 'default' => 2, 'resize' => 1 },
100 assert_equal expected, @client.get_domains
103 def test_get_stats_fids
110 'fids' => { 'max' => 99, 'count' => 2 },
113 assert_equal expected, @client.get_stats('all')
117 @backend.list_fids = {
120 'fid_1_class' => 'normal',
121 'fid_1_devcount' => '2',
122 'fid_1_domain' => 'test',
123 'fid_1_key' => 'file_key',
124 'fid_1_length' => '4',
126 'fid_2_class' => 'normal',
127 'fid_2_devcount' => '2',
128 'fid_2_domain' => 'test',
129 'fid_2_key' => 'new_new_key',
130 'fid_2_length' => '9',
139 "key" => "file_key" },
145 "key" => "new_new_key" },
148 assert_equal expected, @client.list_fids(0, 100)