diff options
Diffstat (limited to 'test/test_fresh.rb')
-rw-r--r-- | test/test_fresh.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/test_fresh.rb b/test/test_fresh.rb index 89b37b6..1b0fa15 100644 --- a/test/test_fresh.rb +++ b/test/test_fresh.rb @@ -91,6 +91,36 @@ EOF assert_equal [], @admin.get_devices end + def test_create_update_delete_class + domain = "rbmogtest#{Time.now.strftime('%Y%m%d%H%M%S')}.#{uuid}" + @admin.create_domain(domain) + yield_for_monitor_update { @admin.get_domains.include?(domain) and break } + + assert_nothing_raised do + @admin.create_class(domain, "klassy", 1) + end + assert_raises(MogileFS::Backend::ClassExistsError) do + @admin.create_class(domain, "klassy", 1) + end + + assert_nothing_raised do + @admin.update_class(domain, "klassy", + :mindevcount => 1, :replpolicy => "MultipleHosts(1)") + end + + tmp = nil + yield_for_monitor_update do + tmp = @admin.get_domains[domain]["klassy"] + break if tmp && tmp["replpolicy"] == "MultipleHosts(1)" + end + assert tmp, "domain did not show up" + assert_equal 1, tmp["mindevcount"] + assert_equal "MultipleHosts(1)", tmp["replpolicy"] + assert_nothing_raised { @admin.update_class(domain, "klassy", 2) } + ensure + @admin.delete_class(domain, "klassy") rescue nil + end + def teardown if @mogstored_pid && @mogstored_pid.size > 0 Process.kill(:TERM, @mogstored_pid.read.to_i) |