roma 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +44 -1
  3. data/Gemfile.lock +18 -15
  4. data/README.md +15 -1
  5. data/bin/consistency_test +10 -0
  6. data/bin/data_accumulation +11 -0
  7. data/lib/roma/async_process.rb +39 -2
  8. data/lib/roma/command/sys_command_receiver.rb +80 -0
  9. data/lib/roma/command/vn_command_receiver.rb +1 -1
  10. data/lib/roma/config.rb +1 -1
  11. data/lib/roma/plugin/plugin_storage.rb +105 -1
  12. data/lib/roma/romad.rb +13 -1
  13. data/lib/roma/routing/cb_rttable.rb +1 -1
  14. data/lib/roma/tools/consistency_test.rb +77 -0
  15. data/lib/roma/tools/data_accumulation.rb +64 -0
  16. data/lib/roma/version.rb +1 -1
  17. data/lib/roma/write_behind.rb +138 -1
  18. data/test/config4mhash.rb +1 -1
  19. data/test/config4storage_error.rb +1 -1
  20. data/test/config4test.rb +1 -1
  21. data/test/cpdbtest/config4cpdb_base.rb +1 -1
  22. data/test/optional_test/t_mkroute_rich.rb +44 -0
  23. data/test/optional_test/t_other_cpdb.rb +45 -0
  24. data/test/optional_test/t_other_database.rb +59 -0
  25. data/test/{t_routing_logic.rb → optional_test/t_routing_logic.rb} +1 -0
  26. data/test/roma-test-storage.rb +685 -0
  27. data/test/roma-test-utils.rb +24 -0
  28. data/test/run-test.rb +9 -0
  29. data/test/t_command_definition.rb +2 -0
  30. data/test/t_cpdata.rb +1 -0
  31. data/test/t_cpdb.rb +22 -34
  32. data/test/t_eventmachine.rb +1 -0
  33. data/test/t_listplugin.rb +2 -0
  34. data/test/t_logshift.rb +2 -4
  35. data/test/t_mapcountplugin.rb +48 -37
  36. data/test/t_mapplugin.rb +2 -0
  37. data/test/t_mhash.rb +2 -1
  38. data/test/t_new_func.rb +386 -0
  39. data/test/t_protocol.rb +66 -1
  40. data/test/t_rclient.rb +2 -0
  41. data/test/t_replication.rb +299 -0
  42. data/test/t_routing_data.rb +6 -5
  43. data/test/t_storage.rb +5 -740
  44. data/test/t_storage_error.rb +1 -0
  45. data/test/t_writebehind.rb +11 -2
  46. metadata +31 -19
@@ -6,6 +6,7 @@ require 'roma/config'
6
6
  require 'roma/messaging/con_pool'
7
7
  require 'roma/logging/rlogger'
8
8
  require 'roma/client/rclient'
9
+ require 'roma/client/version'
9
10
  require 'roma/client/client_pool'
10
11
 
11
12
  Roma::Client::RomaClient.class_eval do
@@ -20,6 +21,8 @@ module RomaTestUtils
20
21
  DEFAULT_PORTS = %w(11211 11212)
21
22
  DEFAULT_NODES = DEFAULT_PORTS.map { |port| "#{DEFAULT_HOST}_#{port}" }
22
23
  DEFAULT_TIMEOUT_SEC = 90
24
+ REPLICA_PORTS = %w(21211 21212)
25
+ REPLICA_NODES = REPLICA_PORTS.map { |port| "#{DEFAULT_HOST}_#{port}" }
23
26
  SHELL_LOG = 'roma_test_outputs.log'
24
27
 
25
28
  Roma::Logging::RLogger.create_singleton_instance("#{Roma::Config::LOG_PATH}/roma_test.log",
@@ -42,6 +45,20 @@ module RomaTestUtils
42
45
  sleep 1
43
46
  end
44
47
 
48
+ def start_roma_replica(conf = DEFAULT_CONFIG, div_bits: 3, replication_in_host: true)
49
+ FileUtils.rm_rf(Dir.glob("#{Roma::Config::STORAGE_PATH}/#{REPLICA_NODES[0][0..-2]}?*"))
50
+ FileUtils.rm_rf(Dir.glob("#{Roma::Config::STORAGE_PATH}/#{DEFAULT_IP}_#{REPLICA_PORTS[0][0..-2]}?*"))
51
+ sleep 0.1
52
+
53
+ system("#{ruby_path} #{mkroute_path} #{REPLICA_NODES.join(' ')} -d #{div_bits} --replication_in_host >> #{SHELL_LOG} 2>&1")
54
+ sleep 0.2
55
+
56
+ REPLICA_NODES.each do |node|
57
+ do_command_romad(node, conf, replication_in_host)
58
+ end
59
+ sleep 1
60
+ end
61
+
45
62
  def join_roma(node, conf = DEFAULT_CONFIG, replication_in_host: true)
46
63
  do_command_romad(node, conf, replication_in_host, true)
47
64
  end
@@ -119,6 +136,13 @@ module RomaTestUtils
119
136
  Roma::Messaging::ConPool.instance.close_all
120
137
  end
121
138
 
139
+ def stop_roma_replica
140
+ balse_message = %w(balse yes)
141
+ send_message(messages: balse_message, node: REPLICA_NODES[0])
142
+ Roma::Client::ConPool.instance.close_all
143
+ Roma::Messaging::ConPool.instance.close_all
144
+ end
145
+
122
146
  def stop_roma_node(node)
123
147
  send_message(messages: 'rbalse', node: node)
124
148
  Roma::Client::ConPool.instance.close_all
@@ -13,8 +13,17 @@ $LOAD_PATH.unshift("#{client_base_path}/roma-ruby-client/lib")
13
13
 
14
14
  require 'roma-test-utils'
15
15
 
16
+ puts "* ROMA Version : #{Roma::Config::VERSION}"
17
+ puts "* Ruby Client Version : #{Roma::Client::VERSION::STRING}"
18
+
16
19
  Dir["#{base_path}/test/t_*.rb"].each do |test_file|
17
20
  require File.basename(test_file, '*.rb')
18
21
  end
19
22
 
23
+ ### optional test
24
+ require_relative './optional_test/t_routing_logic.rb'
25
+ #require_relative './optional_test/t_mkroute_rich.rb'
26
+ #require_relative './optional_test/t_other_database.rb'
27
+ #require_relative './optional_test/t_other_cpdb.rb'
28
+
20
29
  exit(Test::Unit::AutoRunner.run)
@@ -135,6 +135,7 @@ class DefCmdTest
135
135
  end
136
136
 
137
137
  class DefineCommandTest < Test::Unit::TestCase
138
+ self.test_order = :defined
138
139
 
139
140
  def setup
140
141
  @obj = DefCmdTest.new
@@ -287,6 +288,7 @@ class DefCmdTestNoHash < DefCmdTest
287
288
  end
288
289
 
289
290
  class DefineCommandNoHashTest < Test::Unit::TestCase
291
+ self.test_order = :defined
290
292
  def setup
291
293
  @obj = DefCmdTestNoHash.new
292
294
  end
@@ -82,6 +82,7 @@ end
82
82
 
83
83
  # test of copying vnode
84
84
  class CopyDataTest < Test::Unit::TestCase
85
+ self.test_order = :defined
85
86
  include RomaTestUtils
86
87
 
87
88
  def setup
@@ -5,6 +5,7 @@ require 'roma/config'
5
5
  require 'pathname'
6
6
 
7
7
  class CpdbBaseTest < Test::Unit::TestCase
8
+ self.test_order = :defined
8
9
  include RomaTestUtils
9
10
 
10
11
  def teardown
@@ -20,11 +21,13 @@ class GroongaTest < CpdbBaseTest
20
21
  def setup
21
22
  start_roma 'cpdbtest/config4cpdb_groonga.rb'
22
23
  @rc=Roma::Client::RomaClient.new(["localhost_11211","localhost_11212"])
24
+ @sock = TCPSocket.new("localhost", 11211)
23
25
  end
24
26
 
25
- def test_cpdb
26
- value = `#{bin_dir}/cpdb 11211`.chomp
27
- assert_equal("ERROR:cpdb supports just TCStorage system, your storage type is GroongaStorage", value)
27
+ def test_st_class_grn
28
+ @sock.write("stat st_class\r\n")
29
+ assert_equal("storages[roma].storage.st_class GroongaStorage", @sock.gets.chomp)
30
+ assert_equal('END', @sock.gets.chomp)
28
31
  end
29
32
  end
30
33
 
@@ -33,10 +36,12 @@ class RubyHashTest < CpdbBaseTest
33
36
  def setup
34
37
  start_roma 'cpdbtest/config4cpdb_rh.rb'
35
38
  @rc=Roma::Client::RomaClient.new(["localhost_11211","localhost_11212"])
39
+ @sock = TCPSocket.new("localhost", 11211)
36
40
  end
37
- def test_cpdb
38
- value = `#{bin_dir}/cpdb 11211`.chomp
39
- assert_equal("ERROR:cpdb supports just TCStorage system, your storage type is RubyHashStorage", value)
41
+ def test_st_class_rh
42
+ @sock.write("stat st_class\r\n")
43
+ assert_equal('storages[roma].storage.st_class RubyHashStorage', @sock.gets.chomp)
44
+ assert_equal('END', @sock.gets.chomp)
40
45
  end
41
46
  end
42
47
 
@@ -45,6 +50,7 @@ class TcTest < CpdbBaseTest
45
50
  def setup
46
51
  start_roma 'cpdbtest/config4cpdb_tc.rb'
47
52
  @rc=Roma::Client::RomaClient.new(["localhost_11211","localhost_11212"])
53
+ @sock = TCPSocket.new("localhost", 11211)
48
54
  end
49
55
  def test_cpdb
50
56
  # Log Assertion
@@ -55,6 +61,11 @@ class TcTest < CpdbBaseTest
55
61
  valueFileList = `ls ./localhost_11211/roma/`.chomp
56
62
  assert_match(/9.tc.([\d]+)/, valueFileList)
57
63
  end
64
+ def test_st_class_tc
65
+ @sock.write("stat st_class\r\n")
66
+ assert_equal('storages[roma].storage.st_class TCStorage', @sock.gets.chomp)
67
+ assert_equal('END', @sock.gets.chomp)
68
+ end
58
69
  end
59
70
 
60
71
  # TcMem Storage Test
@@ -62,34 +73,11 @@ class TcMemTest < CpdbBaseTest
62
73
  def setup
63
74
  start_roma 'cpdbtest/config4cpdb_tcmem.rb'
64
75
  @rc=Roma::Client::RomaClient.new(["localhost_11211","localhost_11212"])
76
+ @sock = TCPSocket.new("localhost", 11211)
65
77
  end
66
- def test_cpdb
67
- value = `#{bin_dir}/cpdb 11211`.chomp
68
- assert_equal("ERROR:cpdb supports just TCStorage system, your storage type is TCMemStorage" , value)
69
- end
70
- end
71
-
72
- # Dbm Storage Test
73
- class DbmTest < CpdbBaseTest
74
- def setup
75
- start_roma 'cpdbtest/config4cpdb_dbm.rb'
76
- @rc=Roma::Client::RomaClient.new(["localhost_11211","localhost_11212"])
77
- end
78
- def test_cpdb
79
- value = `#{bin_dir}/cpdb 11211`.chomp
80
- assert_equal("ERROR:cpdb supports just TCStorage system, your storage type is DbmStorage", value)
81
- end
82
- end
83
-
84
- # Sqlite3 Storage Test
85
- class Sqlite3Test < CpdbBaseTest
86
- def setup
87
- start_roma 'cpdbtest/config4cpdb_sqlite3.rb'
88
- @rc=Roma::Client::RomaClient.new(["localhost_11211","localhost_11212"])
89
- end
90
- def test_cpdb
91
- value = `#{bin_dir}/cpdb 11211`.chomp
92
- assert_equal("ERROR:cpdb supports just TCStorage system, your storage type is SQLite3Storage", value)
78
+ def test_st_class_tcmem
79
+ @sock.write("stat st_class\r\n")
80
+ assert_equal('storages[roma].storage.st_class TCMemStorage', @sock.gets.chomp)
81
+ assert_equal('END', @sock.gets.chomp)
93
82
  end
94
83
  end
95
-
@@ -3,6 +3,7 @@
3
3
  require 'eventmachine'
4
4
 
5
5
  class EventMachineTest < Test::Unit::TestCase
6
+ self.test_order = :defined
6
7
  LOOP_NUM = 5
7
8
 
8
9
  def test_context_switch
@@ -610,10 +610,12 @@ module ListPluginTests
610
610
  end # ListPluginTests
611
611
 
612
612
  class ListPluginTest < Test::Unit::TestCase
613
+ self.test_order = :defined
613
614
  include ListPluginTests
614
615
  end
615
616
 
616
617
  class ListPluginTestForceForward < Test::Unit::TestCase
618
+ self.test_order = :defined
617
619
  include ListPluginTests
618
620
 
619
621
  def setup
@@ -4,6 +4,7 @@ require 'socket'
4
4
  require 'test/unit'
5
5
 
6
6
  class LogShiftTest < Test::Unit::TestCase
7
+ self.test_order = :defined
7
8
  include RomaTestUtils
8
9
 
9
10
  def setup
@@ -30,7 +31,6 @@ class LogShiftTest < Test::Unit::TestCase
30
31
  assert_equal("END", @sock_port_1.gets.chomp)
31
32
  assert_equal('{"localhost_11212"=>"STORED", "localhost_11211"=>"STORED"}', @sock_port_1.gets.chomp)
32
33
  @sock_port_1.write("stat log_shift_size\r\n")
33
- puts "Old value was : #{old_log_shift_size} "
34
34
  assert_equal( "stats.log_shift_size 4096" , @sock_port_1.gets.chomp);
35
35
  assert_equal("END", @sock_port_1.gets.chomp)
36
36
 
@@ -51,7 +51,6 @@ class LogShiftTest < Test::Unit::TestCase
51
51
  assert_equal("END", @sock_port_1.gets.chomp)
52
52
  assert_equal('{"localhost_11212"=>"STORED", "localhost_11211"=>"STORED"}', @sock_port_1.gets.chomp)
53
53
  @sock_port_1.write("stat log_shift_age\r\n")
54
- puts "Old value was : #{old_log_shift_age} "
55
54
  assert_equal( "stats.log_shift_age 7" , @sock_port_1.gets.chomp);
56
55
  assert_equal("END", @sock_port_1.gets.chomp)
57
56
 
@@ -72,7 +71,6 @@ class LogShiftTest < Test::Unit::TestCase
72
71
  assert_equal("END", @sock_port_1.gets.chomp)
73
72
  assert_equal('{"localhost_11212"=>"STORED", "localhost_11211"=>"STORED"}', @sock_port_1.gets.chomp)
74
73
  @sock_port_1.write("stat log_shift_age\r\n")
75
- puts "Old value was : #{old_log_shift_age} "
76
74
  assert_equal( "stats.log_shift_age min" , @sock_port_1.gets.chomp);
77
75
  assert_equal("END", @sock_port_1.gets.chomp)
78
76
 
@@ -83,4 +81,4 @@ class LogShiftTest < Test::Unit::TestCase
83
81
 
84
82
  end
85
83
 
86
- end
84
+ end
@@ -8,6 +8,7 @@ Roma::Client::RomaClient.class_eval{
8
8
  }
9
9
 
10
10
  class MapCountPluginTest < Test::Unit::TestCase
11
+ self.test_order = :defined
11
12
  include RomaTestUtils
12
13
 
13
14
  DATE_FORMAT = "%Y-%m-%dT%H:%M:%S +00"
@@ -25,6 +26,16 @@ class MapCountPluginTest < Test::Unit::TestCase
25
26
  stop_roma
26
27
  end
27
28
 
29
+ def check_roma_value(h, res)
30
+ h.each{|k, v|
31
+ if k == 'last_updated_date'
32
+ assert_equal true, res[k].between?(v, v+1)
33
+ else
34
+ assert_equal v, res[k]
35
+ end
36
+ }
37
+ end
38
+
28
39
  def test_mapcount_get(n = 5)
29
40
  n.times do |i|
30
41
  @sk = "subkey#{i}"
@@ -34,16 +45,16 @@ class MapCountPluginTest < Test::Unit::TestCase
34
45
  (i+1).times do |j|
35
46
  retc["subkey#{j}"] = 1
36
47
  end
37
- assert_equal retc, @rc.mapcount_countup(@k, @sk, 0)
48
+ check_roma_value(retc, @rc.mapcount_countup(@k, @sk, 0))
38
49
 
39
50
  retg = {"last_updated_date"=>@lt}
40
51
  retg["subkey#{i}"] = 1
41
- assert_equal retg, @rc.mapcount_get(@k, @sk)
42
- assert_equal retc, @rc.mapcount_get(@k)
52
+ check_roma_value(retg, @rc.mapcount_get(@k, @sk))
53
+ check_roma_value(retc, @rc.mapcount_get(@k))
43
54
  end
44
55
 
45
56
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>1, "subkey1"=>1}
46
- assert_equal ret2, @rc.mapcount_get(@k, 'subkey0,subkey1')
57
+ check_roma_value(ret2, @rc.mapcount_get(@k, 'subkey0,subkey1'))
47
58
  end
48
59
 
49
60
  def test_mapcount_countup_array
@@ -52,30 +63,30 @@ class MapCountPluginTest < Test::Unit::TestCase
52
63
 
53
64
  def test_mapcount_countup_array_multi
54
65
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>1, "subkey1"=>1}
55
- assert_equal ret2, @rc.mapcount_countup(@k, ["subkey0", "subkey1"])
66
+ check_roma_value(ret2, @rc.mapcount_countup(@k, ["subkey0", "subkey1"]))
56
67
 
57
68
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>1, "subkey1"=>2}
58
69
  @rc.mapcount_countup(@k, ["subkey1"])
59
- assert_equal ret2, @rc.mapcount_get(@k)
70
+ check_roma_value(ret2, @rc.mapcount_get(@k))
60
71
  end
61
72
 
62
73
  def test_mapcount_countup_hash
63
74
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>1, "subkey1"=>1}
64
- assert_equal ret2, @rc.mapcount_countup(@k, ["subkey0", "subkey1"])
75
+ check_roma_value(ret2, @rc.mapcount_countup(@k, ["subkey0", "subkey1"]))
65
76
 
66
77
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>4, "subkey1"=>1}
67
78
  @rc.mapcount_countup(@k, {"subkey0" => 3})
68
- assert_equal ret2, @rc.mapcount_get(@k)
79
+ check_roma_value(ret2, @rc.mapcount_get(@k))
69
80
 
70
81
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>4, "subkey1"=>11}
71
82
  @rc.mapcount_countup(@k, {"subkey1" => 10})
72
- assert_equal ret2, @rc.mapcount_get(@k)
83
+ check_roma_value(ret2, @rc.mapcount_get(@k))
73
84
  end
74
85
 
75
86
  def test_mapcount_countup_degits
76
87
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>125, "subkey1"=>30}
77
88
  @rc.mapcount_countup(@k, {"subkey0" => 125, "subkey1" => 30})
78
- assert_equal ret2, @rc.mapcount_get(@k)
89
+ check_roma_value(ret2, @rc.mapcount_get(@k))
79
90
  end
80
91
 
81
92
  def test_mapcount_countup_expt
@@ -90,29 +101,29 @@ class MapCountPluginTest < Test::Unit::TestCase
90
101
  ret_time = {"last_updated_date"=>@lt}
91
102
 
92
103
  assert_nil @rc.mapcount_update(@k)
93
- assert_equal @ret, @rc.mapcount_countup(@k, @sk, 0)
94
- assert_equal @ret, @rc.mapcount_update(@k)
95
- assert_equal ret_time, @rc.mapcount_update(@k, 'subkey2')
96
- assert_equal @ret, @rc.mapcount_update(@k, nil, 1)
104
+ check_roma_value(@ret, @rc.mapcount_countup(@k, @sk, 0))
105
+ check_roma_value(@ret, @rc.mapcount_update(@k))
106
+ check_roma_value(ret_time, @rc.mapcount_update(@k, 'subkey2'))
107
+ check_roma_value(@ret, @rc.mapcount_update(@k, nil, 1))
97
108
  sleep 2
98
109
  assert_nil @rc.mapcount_get(@k)
99
110
  end
100
111
 
101
112
  def test_mapcount_update_subkeys
102
113
  ret = {"last_updated_date"=>@lt, @sk=>1}
103
- assert_equal @ret, @rc.mapcount_countup(@k, @sk, 0)
104
- assert_equal @ret, @rc.mapcount_update(@k, @sk, 1)
114
+ check_roma_value(@ret, @rc.mapcount_countup(@k, @sk, 0))
115
+ check_roma_value(@ret, @rc.mapcount_update(@k, @sk, 1))
105
116
  sleep 2
106
117
  assert_nil @rc.mapcount_get(@k)
107
118
  end
108
119
 
109
120
  def test_mapcount_update_time
110
121
  ret = {"last_updated_date"=>@lt, @sk=>1}
111
- assert_equal @ret, @rc.mapcount_countup(@k, @sk, 0)
122
+ check_roma_value(@ret, @rc.mapcount_countup(@k, @sk, 0))
112
123
  sleep 2
113
124
  lt2 = Time.parse(Time.now.strftime(DATE_FORMAT))
114
125
  ret2 = {"last_updated_date"=>lt2, @sk=>1}
115
- assert_equal ret2, @rc.mapcount_update(@k)
126
+ check_roma_value(ret2, @rc.mapcount_update(@k))
116
127
  end
117
128
 
118
129
  def test_counts
@@ -156,16 +167,16 @@ class MapCountPluginTest < Test::Unit::TestCase
156
167
  (i+1).times do |j|
157
168
  retc["subkey#{j}"] = 1
158
169
  end
159
- assert_equal retc, @rc.mapcount_countup_ms(@k, @sk, 0)
160
-
170
+ check_roma_value(retc, @rc.mapcount_countup_ms(@k, @sk, 0))
171
+
161
172
  retg = {"last_updated_date"=>@lt}
162
173
  retg["subkey#{i}"] = 1
163
- assert_equal retg, @rc.mapcount_get_ms(@k, @sk)
164
- assert_equal retc, @rc.mapcount_get_ms(@k)
174
+ check_roma_value(retg, @rc.mapcount_get_ms(@k, @sk))
175
+ check_roma_value(retc, @rc.mapcount_get_ms(@k))
165
176
  end
166
177
 
167
178
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>1, "subkey1"=>1}
168
- assert_equal ret2, @rc.mapcount_get_ms(@k, 'subkey0,subkey1')
179
+ check_roma_value(ret2, @rc.mapcount_get_ms(@k, 'subkey0,subkey1'))
169
180
  end
170
181
 
171
182
  def test_mapcount_countup_ms_array
@@ -174,30 +185,30 @@ class MapCountPluginTest < Test::Unit::TestCase
174
185
 
175
186
  def test_mapcount_countup_ms_array_multi
176
187
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>1, "subkey1"=>1}
177
- assert_equal ret2, @rc.mapcount_countup_ms(@k, ["subkey0", "subkey1"])
188
+ check_roma_value(ret2, @rc.mapcount_countup_ms(@k, ["subkey0", "subkey1"]))
178
189
 
179
190
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>1, "subkey1"=>2}
180
191
  @rc.mapcount_countup_ms(@k, ["subkey1"])
181
- assert_equal ret2, @rc.mapcount_get_ms(@k)
192
+ check_roma_value(ret2, @rc.mapcount_get_ms(@k))
182
193
  end
183
194
 
184
195
  def test_mapcount_countup_ms_hash
185
196
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>1, "subkey1"=>1}
186
- assert_equal ret2, @rc.mapcount_countup_ms(@k, ["subkey0", "subkey1"])
197
+ check_roma_value(ret2, @rc.mapcount_countup_ms(@k, ["subkey0", "subkey1"]))
187
198
 
188
199
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>4, "subkey1"=>1}
189
200
  @rc.mapcount_countup_ms(@k, {"subkey0" => 3})
190
- assert_equal ret2, @rc.mapcount_get_ms(@k)
201
+ check_roma_value(ret2, @rc.mapcount_get_ms(@k))
191
202
 
192
203
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>4, "subkey1"=>11}
193
204
  @rc.mapcount_countup_ms(@k, {"subkey1" => 10})
194
- assert_equal ret2, @rc.mapcount_get_ms(@k)
205
+ check_roma_value(ret2, @rc.mapcount_get_ms(@k))
195
206
  end
196
207
 
197
208
  def test_mapcount_countup_ms_degits
198
209
  ret2 = {"last_updated_date"=>@lt, "subkey0"=>125, "subkey1"=>30}
199
210
  @rc.mapcount_countup_ms(@k, {"subkey0" => 125, "subkey1" => 30})
200
- assert_equal ret2, @rc.mapcount_get_ms(@k)
211
+ check_roma_value(ret2, @rc.mapcount_get_ms(@k))
201
212
  end
202
213
 
203
214
  def test_mapcount_countup_ms_expt
@@ -212,29 +223,29 @@ class MapCountPluginTest < Test::Unit::TestCase
212
223
  ret_time = {"last_updated_date"=>@lt}
213
224
 
214
225
  assert_nil @rc.mapcount_update_ms(@k)
215
- assert_equal @ret, @rc.mapcount_countup_ms(@k, @sk, 0)
216
- assert_equal @ret, @rc.mapcount_update_ms(@k)
217
- assert_equal ret_time, @rc.mapcount_update_ms(@k, 'subkey2')
218
- assert_equal @ret, @rc.mapcount_update_ms(@k, nil, 1)
226
+ check_roma_value(@ret, @rc.mapcount_countup_ms(@k, @sk, 0))
227
+ check_roma_value(@ret, @rc.mapcount_update_ms(@k))
228
+ check_roma_value(ret_time, @rc.mapcount_update_ms(@k, 'subkey2'))
229
+ check_roma_value(@ret, @rc.mapcount_update_ms(@k, nil, 1))
219
230
  sleep 2
220
231
  assert_nil @rc.mapcount_get_ms(@k)
221
232
  end
222
233
 
223
234
  def test_mapcount_update_ms_subkeys
224
235
  ret = {"last_updated_date"=>@lt, @sk=>1}
225
- assert_equal @ret, @rc.mapcount_countup_ms(@k, @sk, 0)
226
- assert_equal @ret, @rc.mapcount_update_ms(@k, @sk, 1)
236
+ check_roma_value(@ret, @rc.mapcount_countup_ms(@k, @sk, 0))
237
+ check_roma_value(@ret, @rc.mapcount_update_ms(@k, @sk, 1))
227
238
  sleep 2
228
239
  assert_nil @rc.mapcount_get_ms(@k)
229
240
  end
230
241
 
231
242
  def test_mapcount_update_ms_time
232
243
  ret = {"last_updated_date"=>@lt, @sk=>1}
233
- assert_equal @ret, @rc.mapcount_countup_ms(@k, @sk, 0)
244
+ check_roma_value(@ret, @rc.mapcount_countup_ms(@k, @sk, 0))
234
245
  sleep 2
235
246
  lt2 = Time.parse(Time.now.strftime(DATE_FORMAT))
236
247
  ret2 = {"last_updated_date"=>lt2, @sk=>1}
237
- assert_equal ret2, @rc.mapcount_update_ms(@k)
248
+ check_roma_value(ret2, @rc.mapcount_update_ms(@k))
238
249
  end
239
250
 
240
251
  def test_counts_ms