higgs 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,125 @@
1
+ #!/usr/local/bin/ruby
2
+
3
+ require 'drb'
4
+ require 'fileutils'
5
+ require 'higgs/storage'
6
+ require 'test/unit'
7
+
8
+ module Higgs::Test
9
+ class RemoteServicesTest < Test::Unit::TestCase
10
+ include Higgs
11
+
12
+ # for ident(1)
13
+ CVS_ID = '$Id: test_services.rb 676 2007-11-08 16:09:51Z toki $'
14
+
15
+ STORAGE_DIR = 'remote_storage'
16
+ REMOTE_SERVICES_URI = 'druby://localhost:31415'
17
+
18
+ class << self
19
+ include Higgs
20
+
21
+ def start_services
22
+ return if @pid
23
+
24
+ storage_name = File.join(STORAGE_DIR, 'foo')
25
+ FileUtils.rm_rf(STORAGE_DIR) unless $DEBUG
26
+ FileUtils.mkdir_p(STORAGE_DIR)
27
+
28
+ start_latch = File.join(STORAGE_DIR, '.start')
29
+ stop_latch = File.join(STORAGE_DIR, '.stop')
30
+ @pid = fork{
31
+ begin
32
+ require 'higgs/services'
33
+ require 'logger'
34
+
35
+ st = Storage.new(storage_name,
36
+ :jlog_rotate_max => 0,
37
+ :logger => proc{|path|
38
+ logger = Logger.new(path, 1)
39
+ logger.level = Logger::DEBUG
40
+ logger
41
+ })
42
+
43
+ sv = RemoteServices.new(:remote_services_uri => REMOTE_SERVICES_URI,
44
+ :storage => st)
45
+
46
+ FileUtils.touch(start_latch)
47
+ until (File.exist? stop_latch)
48
+ sleep(0.001) # spin lock
49
+ end
50
+ ensure
51
+ st.shutdown if st
52
+ sv.shutdown if sv
53
+ FileUtils.rm_rf(STORAGE_DIR) unless $DEBUG
54
+ end
55
+ }
56
+
57
+ until (File.exist? start_latch)
58
+ # spin lock
59
+ end
60
+
61
+ at_exit{
62
+ FileUtils.touch(stop_latch)
63
+ Process.waitpid(@pid)
64
+ }
65
+
66
+ DRb.start_service
67
+
68
+ nil
69
+ end
70
+
71
+ attr_reader :pid
72
+ end
73
+
74
+ def setup
75
+ RemoteServicesTest.start_services
76
+ @services = DRbObject.new_with_uri(REMOTE_SERVICES_URI)
77
+ @localhost_check_tmpfile = File.join(STORAGE_DIR, ".localhost_check.#{RemoteServicesTest.pid}")
78
+ end
79
+
80
+ def test_alive_service_v1
81
+ alive_service = @services[:alive_service_v1] or flunk
82
+ assert_equal(true, alive_service.call)
83
+ end
84
+
85
+ def test_localhost_check_service_v1
86
+ Dir.chdir('/') {
87
+ localhost_check_service = @services[:localhost_check_service_v1] or flunk
88
+ localhost_check_service.call{|localhost_check|
89
+ localhost_check.call
90
+ }
91
+ }
92
+ end
93
+
94
+ def test_localhost_check_service_v1_exists_tmpfile
95
+ localhost_check_service = @services[:localhost_check_service_v1] or flunk
96
+ FileUtils.touch(@localhost_check_tmpfile)
97
+ begin
98
+ localhost_check_service.call{|localhost_check|
99
+ localhost_check.call
100
+ }
101
+ ensure
102
+ FileUtils.rm(@localhost_check_tmpfile, :force => true)
103
+ end
104
+ end
105
+
106
+ def test_localhost_check_service_v1_RuntimeError_not_found_tmpfile
107
+ localhost_check_service = @services[:localhost_check_service_v1] or flunk
108
+ localhost_check_service.call{|localhost_check|
109
+ FileUtils.rm(@localhost_check_tmpfile, :force => true)
110
+ assert_raise(RuntimeError) { localhost_check.call }
111
+ }
112
+ end
113
+
114
+ def test_localhost_check_service_v1_RuntimeError_mismatch_message
115
+ localhost_check_service = @services[:localhost_check_service_v1] or flunk
116
+ localhost_check_service.call{|localhost_check|
117
+ File.open(@localhost_check_tmpfile, 'w') {|f|
118
+ f.binmode
119
+ f << 'bar'
120
+ }
121
+ assert_raise(RuntimeError) { localhost_check.call }
122
+ }
123
+ end
124
+ end
125
+ end
data/test/test_storage.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/local/bin/ruby
2
2
 
3
+ require 'digest'
3
4
  require 'fileutils'
4
5
  require 'higgs/storage'
5
6
  require 'logger'
@@ -10,7 +11,7 @@ module Higgs::Test
10
11
  include Higgs
11
12
 
12
13
  # for ident(1)
13
- CVS_ID = '$Id: test_storage.rb 627 2007-10-12 07:10:13Z toki $'
14
+ CVS_ID = '$Id: test_storage.rb 676 2007-11-08 16:09:51Z toki $'
14
15
 
15
16
  def setup
16
17
  srand(0) # preset for rand
@@ -36,12 +37,11 @@ module Higgs::Test
36
37
  include StorageTestCase
37
38
 
38
39
  # for ident(1)
39
- CVS_ID = '$Id: test_storage.rb 627 2007-10-12 07:10:13Z toki $'
40
+ CVS_ID = '$Id: test_storage.rb 676 2007-11-08 16:09:51Z toki $'
40
41
 
41
42
  def new_storage
42
43
  Storage.new(@name, :logger => @logger)
43
44
  end
44
- private :new_storage
45
45
 
46
46
  def test_raw_write_and_commit
47
47
  write_list = [
@@ -141,6 +141,15 @@ module Higgs::Test
141
141
  }
142
142
  end
143
143
 
144
+ def test_write_and_commit_standby_NotWritableError
145
+ @st.shutdown
146
+ @st = nil
147
+ @st = Storage.new(@name, :read_only => :standby, :logger => @logger)
148
+ assert_raise(Storage::NotWritableError) {
149
+ @st.write_and_commit([ [ :write, 'foo', "Hello world.\n" ] ])
150
+ }
151
+ end
152
+
144
153
  def test_write_and_commit_IndexError_not_exist_properties
145
154
  assert_raise(IndexError) {
146
155
  @st.write_and_commit([ [ :system_properties, 'foo', {} ] ])
@@ -224,6 +233,36 @@ module Higgs::Test
224
233
  assert_raise(IndexError) { @st.string_only('foo') }
225
234
  end
226
235
 
236
+ def test_change_number_and_unique_data_id
237
+ assert_equal(nil, @st.data_change_number(:foo))
238
+ assert_equal(nil, @st.properties_change_number(:foo))
239
+ assert_equal(nil, @st.unique_data_id(:foo))
240
+
241
+ @st.write_and_commit([ [ :write, :foo, 'apple' ] ])
242
+
243
+ assert_equal(1, @st.data_change_number(:foo))
244
+ assert_equal(1, @st.properties_change_number(:foo))
245
+ assert_equal("foo\t1", @st.unique_data_id(:foo))
246
+
247
+ @st.write_and_commit([ [ :custom_properties, :foo, { 'bar' => 'banana' } ] ])
248
+
249
+ assert_equal(1, @st.data_change_number(:foo))
250
+ assert_equal(2, @st.properties_change_number(:foo))
251
+ assert_equal("foo\t1", @st.unique_data_id(:foo))
252
+
253
+ @st.write_and_commit([ [ :write, :foo, 'orange' ] ])
254
+
255
+ assert_equal(3, @st.data_change_number(:foo))
256
+ assert_equal(3, @st.properties_change_number(:foo))
257
+ assert_equal("foo\t3", @st.unique_data_id(:foo))
258
+
259
+ @st.write_and_commit([ [ :system_properties, :foo, { 'string_only' => true } ] ])
260
+
261
+ assert_equal(3, @st.data_change_number(:foo))
262
+ assert_equal(4, @st.properties_change_number(:foo))
263
+ assert_equal("foo\t3", @st.unique_data_id(:foo))
264
+ end
265
+
227
266
  def test_key
228
267
  assert_equal(false, (@st.key? 'foo'))
229
268
  @st.write_and_commit([ [ :write, 'foo', "Hello world.\n" ] ])
@@ -242,6 +281,16 @@ module Higgs::Test
242
281
  assert_equal(false, (@st.key? 'bar'))
243
282
  end
244
283
 
284
+ def test_key_standby
285
+ @st.write_and_commit([ [ :write, 'foo', "Hello world.\n" ] ])
286
+ @st.shutdown
287
+ @st = nil
288
+ @st = Storage.new(@name, :read_only => :standby, :logger => @logger)
289
+
290
+ assert_equal(true, (@st.key? 'foo'))
291
+ assert_equal(false, (@st.key? 'bar'))
292
+ end
293
+
245
294
  def test_each_key
246
295
  @st.each_key do |key|
247
296
  flunk('not to reach')
@@ -283,6 +332,22 @@ module Higgs::Test
283
332
  assert(expected_keys.empty?)
284
333
  end
285
334
 
335
+ def test_each_key_standby
336
+ @st.write_and_commit([ [ :write, 'foo', 'one' ],
337
+ [ :write, 'bar', 'two' ],
338
+ [ :write, 'baz', 'three' ]
339
+ ])
340
+ @st.shutdown
341
+ @st = nil
342
+ @st = Storage.new(@name, :read_only => :standby, :logger => @logger)
343
+
344
+ expected_keys = %w[ foo bar baz ]
345
+ @st.each_key do |key|
346
+ assert(expected_keys.delete(key), "each_key do |#{key}|")
347
+ end
348
+ assert(expected_keys.empty?)
349
+ end
350
+
286
351
  def test_verify
287
352
  @st.write_and_commit([ [ :write, 'foo', "Hello world.\n" ] ])
288
353
  @st.verify
@@ -353,7 +418,11 @@ module Higgs::Test
353
418
  end
354
419
 
355
420
  def test_shutdown
421
+ assert_equal(false, @st.shutdown?)
422
+ assert_equal(true, @st.alive?)
356
423
  @st.shutdown
424
+ assert_equal(true, @st.shutdown?)
425
+ assert_equal(false, @st.alive?)
357
426
  assert_raise(Storage::ShutdownException) { @st.shutdown }
358
427
  assert_raise(Storage::ShutdownException) { @st.fetch('foo') }
359
428
  assert_raise(Storage::ShutdownException) { @st.fetch_properties('foo') }
@@ -366,20 +435,54 @@ module Higgs::Test
366
435
  assert_raise(Storage::ShutdownException) { @st.write_and_commit([]) }
367
436
  assert_raise(Storage::ShutdownException) { @st.verify }
368
437
  end
438
+
439
+ def test_switch_to_write_RuntimeError_not_standby_mode
440
+ assert_equal(false, @st.read_only)
441
+ assert_raise(RuntimeError) {
442
+ @st.switch_to_write
443
+ }
444
+ end
445
+
446
+ def test_switch_to_write_RuntimeError_not_standby_mode_on_read_only_mode
447
+ @st.shutdown
448
+ @st = nil
449
+ @st = Storage.new(@name, :read_only => true, :logger => @logger)
450
+
451
+ assert_equal(true, @st.read_only)
452
+ assert_raise(RuntimeError) {
453
+ @st.switch_to_write
454
+ }
455
+ end
456
+ end
457
+
458
+ class StorageSwitchToWriteTest < StorageTest
459
+ def new_storage
460
+ st = Storage.new(@name, :logger => @logger, :read_only => :standby)
461
+ assert_equal(:standby, st.read_only)
462
+ st.switch_to_write
463
+ assert_equal(false, st.read_only)
464
+ st
465
+ end
466
+
467
+ for name in instance_methods(true)
468
+ case (name)
469
+ when /^test_.*read_only/, /^test_.*standby/
470
+ undef_method name
471
+ end
472
+ end
369
473
  end
370
474
 
371
475
  class StorageRecoveryTest < Test::Unit::TestCase
372
476
  include StorageTestCase
373
477
 
374
478
  # for ident(1)
375
- CVS_ID = '$Id: test_storage.rb 627 2007-10-12 07:10:13Z toki $'
479
+ CVS_ID = '$Id: test_storage.rb 676 2007-11-08 16:09:51Z toki $'
376
480
 
377
481
  def new_storage
378
482
  Storage.new(@name,
379
483
  :jlog_rotate_max => 0, # unlimited rotation
380
484
  :logger => @logger)
381
485
  end
382
- private :new_storage
383
486
 
384
487
  def write_data(loop_count=100, data_count=10, data_max_size=1024*5)
385
488
  loop_count.times do
@@ -403,6 +506,10 @@ module Higgs::Test
403
506
  private :write_data
404
507
 
405
508
  def test_manual_recovery
509
+ other_name = File.join(@test_dir, 'bar')
510
+ FileUtils.cp("#{@name}.tar", "#{other_name}.tar", :preserve => true)
511
+ FileUtils.cp("#{@name}.idx", "#{other_name}.idx", :preserve => true)
512
+
406
513
  write_data
407
514
 
408
515
  3.times do
@@ -414,16 +521,41 @@ module Higgs::Test
414
521
 
415
522
  @st.shutdown
416
523
 
417
- other_name = File.join(@test_dir, 'bar')
418
- for name in Storage.rotate_entries("#{@name}.jlog")
524
+ for name in Storage.rotated_entries("#{@name}.jlog")
419
525
  name =~ /\.jlog.*$/ or raise 'mismatch'
420
526
  FileUtils.cp(name, other_name + $&, :preserve => true)
421
527
  end
422
528
  Storage.recover(other_name)
423
529
 
424
- assert(FileUtils.cmp("#{@name}.tar", "#{other_name}.tar"), 'data')
530
+ assert(FileUtils.cmp("#{@name}.tar", "#{other_name}.tar"), 'DATA should be same.')
425
531
  assert(Index.new.load("#{@name}.idx").to_h ==
426
- Index.new.load("#{other_name}.idx").to_h, 'index')
532
+ Index.new.load("#{other_name}.idx").to_h, 'INDEX should be same.')
533
+ end
534
+
535
+ def test_recovery_PanicError_unexpected_storage_id
536
+ other_name = File.join(@test_dir, 'bar')
537
+ st2 = Storage.new(other_name)
538
+ st2.shutdown
539
+
540
+ write_data
541
+
542
+ 3.times do
543
+ @st.rotate_journal_log(false)
544
+ end
545
+ 3.times do
546
+ @st.rotate_journal_log(true)
547
+ end
548
+
549
+ @st.shutdown
550
+
551
+ for name in Storage.rotated_entries("#{@name}.jlog")
552
+ name =~ /\.jlog.*$/ or raise 'mismatch'
553
+ FileUtils.cp(name, other_name + $&, :preserve => true)
554
+ end
555
+
556
+ assert_raise(Storage::PanicError) {
557
+ Storage.recover(other_name)
558
+ }
427
559
  end
428
560
 
429
561
  def test_auto_recovery
@@ -446,13 +578,63 @@ module Higgs::Test
446
578
  st2 = Storage.new(other_name, :logger => @logger)
447
579
  st2.shutdown
448
580
 
449
- assert(FileUtils.cmp("#{@name}.tar", "#{other_name}.tar"), 'data')
581
+ assert(FileUtils.cmp("#{@name}.tar", "#{other_name}.tar"), 'DATA should be same.')
450
582
  assert(Index.new.load("#{@name}.idx").to_h ==
451
- Index.new.load("#{other_name}.idx").to_h)
452
- assert(FileUtils.cmp("#{@name}.jlog", "#{other_name}.jlog"), 'index')
583
+ Index.new.load("#{other_name}.idx").to_h, 'INDEX should be same.')
584
+ assert(FileUtils.cmp("#{@name}.jlog", "#{other_name}.jlog"), 'JOURNAL LOG should be same.')
453
585
  end
454
586
 
455
- def test_lost_journal_log_error
587
+ def test_auto_recovery_on_standby_mode
588
+ write_data
589
+ @st.rotate_journal_log(true)
590
+
591
+ other_name = File.join(@test_dir, 'bar')
592
+ FileUtils.cp("#{@name}.tar", "#{other_name}.tar", :preserve => true)
593
+ FileUtils.cp("#{@name}.idx", "#{other_name}.idx", :preserve => true)
594
+
595
+ # write_data(10 * 10 * 256) < jlog_rotate_size(256 * 1024)
596
+ write_data(10, 10, 256)
597
+
598
+ # not closed journal log for other storage.
599
+ FileUtils.cp("#{@name}.jlog", "#{other_name}.jlog", :preserve => true)
600
+
601
+ @st.shutdown
602
+
603
+ # auto-recovery for other storage
604
+ st2 = Storage.new(other_name, :logger => @logger, :read_only => :standby)
605
+ st2.shutdown
606
+
607
+ assert(FileUtils.cmp("#{@name}.tar", "#{other_name}.tar"), 'DATA should be same.')
608
+ assert(Index.new.load("#{@name}.idx").to_h ==
609
+ Index.new.load("#{other_name}.idx").to_h, 'INDEX should be same.')
610
+ assert(FileUtils.cmp("#{@name}.jlog", "#{other_name}.jlog"), 'JOURNAL LOG should be same.')
611
+ end
612
+
613
+ def test_auto_recovery_NotWritableError
614
+ write_data
615
+ @st.rotate_journal_log(true)
616
+
617
+ other_name = File.join(@test_dir, 'bar')
618
+ FileUtils.cp("#{@name}.tar", "#{other_name}.tar", :preserve => true)
619
+ FileUtils.cp("#{@name}.idx", "#{other_name}.idx", :preserve => true)
620
+
621
+ # write_data(10 * 10 * 256) < jlog_rotate_size(256 * 1024)
622
+ write_data(10, 10, 256)
623
+
624
+ # not closed journal log for other storage.
625
+ FileUtils.cp("#{@name}.jlog", "#{other_name}.jlog", :preserve => true)
626
+
627
+ @st.shutdown
628
+
629
+ # auto-recovery for other storage
630
+ assert_raise(Higgs::Storage::NotWritableError) {
631
+ st2 = Storage.new(other_name, :logger => @logger, :read_only => true)
632
+ st2.shutdown
633
+ flunk('not to reach')
634
+ }
635
+ end
636
+
637
+ def test_recovery_PanicError_lost_journal_log_error
456
638
  write_data
457
639
  @st.rotate_journal_log(true)
458
640
 
@@ -470,13 +652,153 @@ module Higgs::Test
470
652
  st2 = Storage.new(other_name, :logger => @logger)
471
653
  }
472
654
  end
655
+
656
+ def test_apply_journal_log
657
+ other_name = File.join(@test_dir, 'bar')
658
+ FileUtils.cp("#{@name}.tar", "#{other_name}.tar", :preserve => true)
659
+ FileUtils.cp("#{@name}.idx", "#{other_name}.idx", :preserve => true)
660
+
661
+ write_data
662
+ @st.rotate_journal_log(true)
663
+ @st.shutdown
664
+
665
+ st2 = Storage.new(other_name, :jlog_rotate_size => 1024 * 8)
666
+ begin
667
+ for path in Storage.rotated_entries("#{@name}.jlog")
668
+ st2.apply_journal_log(path)
669
+ end
670
+ ensure
671
+ st2.shutdown
672
+ end
673
+
674
+ assert(FileUtils.cmp("#{@name}.tar", "#{other_name}.tar"), 'DATA should be same.')
675
+ assert(Index.new.load("#{@name}.idx").to_h ==
676
+ Index.new.load("#{other_name}.idx").to_h, 'INDEX should be same.')
677
+ end
678
+
679
+ def test_apply_journal_log_on_standby_mode
680
+ other_name = File.join(@test_dir, 'bar')
681
+ FileUtils.cp("#{@name}.tar", "#{other_name}.tar", :preserve => true)
682
+ FileUtils.cp("#{@name}.idx", "#{other_name}.idx", :preserve => true)
683
+
684
+ write_data
685
+ @st.rotate_journal_log(true)
686
+ @st.shutdown
687
+
688
+ st2 = Storage.new(other_name, :jlog_rotate_size => 1024 * 8, :read_only => :standby)
689
+ begin
690
+ for path in Storage.rotated_entries("#{@name}.jlog")
691
+ st2.apply_journal_log(path)
692
+ end
693
+ ensure
694
+ st2.shutdown
695
+ end
696
+
697
+ assert(FileUtils.cmp("#{@name}.tar", "#{other_name}.tar"), 'DATA should be same.')
698
+ assert(Index.new.load("#{@name}.idx").to_h ==
699
+ Index.new.load("#{other_name}.idx").to_h, 'INDEX should be same.')
700
+ end
701
+
702
+ def test_apply_journal_log_PanicError_unexpected_storage_id
703
+ write_data
704
+ @st.rotate_journal_log(true)
705
+ @st.shutdown
706
+
707
+ other_name = File.join(@test_dir, 'bar')
708
+ st2 = Storage.new(other_name, :jlog_rotate_size => 1024 * 8)
709
+ assert_equal(true, st2.alive?, 'alive storage')
710
+ assert_equal(false, st2.shutdown?)
711
+
712
+ begin
713
+ for path in Storage.rotated_entries("#{@name}.jlog")
714
+ assert_raise(Storage::PanicError) {
715
+ st2.apply_journal_log(path)
716
+ }
717
+ end
718
+ assert_equal(false, st2.alive?, 'panic storage')
719
+ assert_equal(false, st2.shutdown?)
720
+ ensure
721
+ st2.shutdown
722
+ end
723
+
724
+ assert_equal(false, st2.alive?, 'shutdown storage')
725
+ assert_equal(true, st2.shutdown?)
726
+ end
727
+
728
+ def test_apply_journal_log_PanicError_lost_journal_log
729
+ other_name = File.join(@test_dir, 'bar')
730
+ FileUtils.cp("#{@name}.tar", "#{other_name}.tar", :preserve => true)
731
+ FileUtils.cp("#{@name}.idx", "#{other_name}.idx", :preserve => true)
732
+
733
+ write_data
734
+ write_data
735
+ write_data
736
+ @st.rotate_journal_log(true)
737
+ @st.shutdown
738
+
739
+ st2 = Storage.new(other_name, :jlog_rotate_size => 1024 * 8)
740
+ assert_equal(true, st2.alive?, 'alive storage')
741
+ assert_equal(false, st2.shutdown?)
742
+
743
+ begin
744
+ entries = Storage.rotated_entries("#{@name}.jlog")
745
+ entries.shift # skip first journal log
746
+ for path in entries
747
+ assert_raise(Storage::PanicError) {
748
+ st2.apply_journal_log(path)
749
+ }
750
+ end
751
+ assert_equal(false, st2.alive?, 'panic storage')
752
+ assert_equal(false, st2.shutdown?)
753
+ ensure
754
+ st2.shutdown
755
+ end
756
+
757
+ assert_equal(false, st2.alive?, 'shutdown storage')
758
+ assert_equal(true, st2.shutdown?)
759
+ end
760
+
761
+ def test_apply_journal_log_from_online_backup
762
+ write_data
763
+ @st.rotate_journal_log(true)
764
+
765
+ other_name = File.join(@test_dir, 'bar')
766
+ FileUtils.cp("#{@name}.tar", "#{other_name}.tar", :preserve => true)
767
+ FileUtils.cp("#{@name}.idx", "#{other_name}.idx", :preserve => true)
768
+
769
+ other_name = File.join(@test_dir, 'bar')
770
+ for name in Storage.rotated_entries("#{@name}.jlog")
771
+ name =~ /\.jlog.*$/ or raise 'mismatch'
772
+ FileUtils.cp(name, other_name + $&, :preserve => true)
773
+ FileUtils.rm(name)
774
+ end
775
+ Storage.recover(other_name)
776
+
777
+ write_data
778
+ @st.rotate_journal_log(true)
779
+ @st.shutdown
780
+
781
+ other_name = File.join(@test_dir, 'bar')
782
+ st2 = Storage.new(other_name, :jlog_rotate_size => 1024 * 8)
783
+ begin
784
+ for path in Storage.rotated_entries("#{@name}.jlog")
785
+ st2.apply_journal_log(path)
786
+ end
787
+ ensure
788
+ st2.shutdown
789
+ end
790
+
791
+ assert(FileUtils.cmp("#{@name}.tar", "#{other_name}.tar"), 'DATA should be same.')
792
+ assert(Index.new.load("#{@name}.idx").to_h ==
793
+ Index.new.load("#{other_name}.idx").to_h, 'INDEX should be same.')
794
+ end
473
795
  end
474
796
 
475
- class ReadOnlyStorageFirstOpenTest < Test::Unit::TestCase
797
+ class ReadOnlyStorageFirstOpenErrorTest < Test::Unit::TestCase
476
798
  include Higgs
477
799
 
478
800
  # for ident(1)
479
- CVS_ID = '$Id: test_storage.rb 627 2007-10-12 07:10:13Z toki $'
801
+ CVS_ID = '$Id: test_storage.rb 676 2007-11-08 16:09:51Z toki $'
480
802
 
481
803
  def setup
482
804
  @test_dir = 'st_test'
@@ -494,7 +816,7 @@ module Higgs::Test
494
816
  FileUtils.rm_rf(@test_dir) unless $DEBUG
495
817
  end
496
818
 
497
- def test_read_only_first_open
819
+ def test_read_only_first_open_error
498
820
  assert_raise(Errno::ENOENT) {
499
821
  Storage.new(@name, :read_only => true, :logger => @logger)
500
822
  }
@@ -7,7 +7,7 @@ require 'test/unit'
7
7
  module Higgs::Test
8
8
  class StorageConfTest < Test::Unit::TestCase
9
9
  # for ident(1)
10
- CVS_ID = '$Id: test_storage_conf.rb 559 2007-09-25 15:20:20Z toki $'
10
+ CVS_ID = '$Id: test_storage_conf.rb 636 2007-10-14 09:43:23Z toki $'
11
11
 
12
12
  include Higgs
13
13
 
@@ -89,14 +89,6 @@ module Higgs::Test
89
89
  assert_equal(0, options[:jlog_rotate_max])
90
90
  end
91
91
 
92
- def test_jlog_rotate_service_uri
93
- File.open(@conf_path, 'w') {|w|
94
- w << "jlog_rotate_service_uri: druby://localhost:14142\n"
95
- }
96
- options = Storage.load_conf(@conf_path)
97
- assert_equal('druby://localhost:14142', options[:jlog_rotate_service_uri])
98
- end
99
-
100
92
  def test_properties_cache_limit_size
101
93
  File.open(@conf_path, 'w') {|w|
102
94
  w << "properties_cache_limit_size: 256\n"
@@ -6,7 +6,7 @@ require 'test/unit'
6
6
  module Higgs::Test
7
7
  class StorageInitOptionsTest < Test::Unit::TestCase
8
8
  # for ident(1)
9
- CVS_ID = '$Id: test_storage_init_opts.rb 590 2007-09-30 06:13:54Z toki $'
9
+ CVS_ID = '$Id: test_storage_init_opts.rb 636 2007-10-14 09:43:23Z toki $'
10
10
 
11
11
  include Higgs::Storage::InitOptions
12
12
 
@@ -25,8 +25,6 @@ module Higgs::Test
25
25
  assert_equal(1024 * 256, self.jlog_rotate_size)
26
26
  assert_equal(1, @jlog_rotate_max)
27
27
  assert_equal(1, self.jlog_rotate_max)
28
- assert_equal(nil, @jlog_rotate_service_uri)
29
- assert_equal(nil, self.jlog_rotate_service_uri)
30
28
  assert_instance_of(Proc, @Logger)
31
29
  end
32
30
 
@@ -101,12 +99,6 @@ module Higgs::Test
101
99
  assert_equal(100, self.jlog_rotate_max)
102
100
  end
103
101
 
104
- def test_jlog_rotate_service_uri
105
- init_options(:jlog_rotate_service_uri => 'druby://localhost:14142')
106
- assert_equal('druby://localhost:14142', @jlog_rotate_service_uri)
107
- assert_equal('druby://localhost:14142', self.jlog_rotate_service_uri)
108
- end
109
-
110
102
  def test_logger
111
103
  init_options(:logger => proc{|path| :dummy_logger })
112
104
  assert_equal(:dummy_logger, @Logger.call('foo'))