Skip to content

Commit

Permalink
Merge "[service-ng]Add max_disk size change case to rspec"
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzh authored and Gerrit Code Review committed Jan 16, 2013
2 parents d7c4ad5 + 90d8263 commit 4f096e8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
31 changes: 31 additions & 0 deletions ng/rabbit/spec/node_spec.rb
Expand Up @@ -305,6 +305,37 @@ class Node
amqp_start(credentials, instance).should == true
@node.unprovision(credentials["name"])
end

it "should change loop file size if the configuration changed after restart" do
credentials = @node.provision(:free)
sleep 3
[@options[:max_disk] * 2, @options[:max_disk]].each do |to_size|
@node.shutdown
@options[:max_disk] = to_size
EM.run do
@node = VCAP::Services::Rabbit::Node.new(@options)
EM.add_timer(1) {EM.stop}
end
instance = @node.get_instance(credentials["name"])
amqp_start(credentials, instance).should == true
File.size(instance.image_file).should == to_size.to_i * 1024 * 1024
end

# Verify revert case if set to the wrong size
@node.shutdown
old_size = @options[:max_disk].to_i
# Set disk size to 1M which is less than the size needed for sure
@options[:max_disk] = 1
EM.run do
@node = VCAP::Services::Rabbit::Node.new(@options)
EM.add_timer(1) {EM.stop}
end
instance = @node.get_instance(credentials["name"])
amqp_start(credentials, instance).should == true
File.size(instance.image_file).should == old_size.to_i * 1024 * 1024
@options[:max_disk] = old_size
@node.unprovision(credentials["name"])
end
end

describe "Node.shutdown" do
Expand Down
3 changes: 2 additions & 1 deletion ng/rabbit/spec/spec_helper.rb
Expand Up @@ -79,7 +79,8 @@ def getNodeTestConfig
:image_dir => "/tmp/rabbitmq_image",
:max_disk => 128,
:migration_nfs => "/tmp/migration",
:disabled_file => "/tmp/redis_instances/DISABLED",
:disabled_file => "/tmp/redis_instances/DISABLED",
:filesystem_quota => true,
}
options[:local_db] = "sqlite3:" + options[:local_db_file]
options
Expand Down

0 comments on commit 4f096e8

Please sign in to comment.