spec/beaker/hypervisor/vmpooler_spec.rb in beaker-3.14.0 vs spec/beaker/hypervisor/vmpooler_spec.rb in beaker-3.15.0
- old
+ new
@@ -58,9 +58,45 @@
}
expect(merged_tags).to include(expected_hash)
end
end
+ describe '#disk_added?' do
+ let(:vmpooler) { Beaker::Vmpooler.new(make_hosts, make_opts) }
+ let(:response_hash_no_disk) {
+ {
+ "ok" => "true",
+ "hostname" => {
+ "template"=>"redhat-7-x86_64",
+ "domain"=>"delivery.puppetlabs.net"
+ }
+ }
+ }
+ let(:response_hash_disk) {
+ {
+ "ok" => "true",
+ "hostname" => {
+ "disk" => [
+ '+16gb',
+ '+8gb'
+ ],
+ "template"=>"redhat-7-x86_64",
+ "domain"=>"delivery.puppetlabs.net"
+ }
+ }
+ }
+ it 'returns false when there is no disk' do
+ host = response_hash_no_disk['hostname']
+ expect(vmpooler.disk_added?(host, "8", 0)).to be(false)
+ end
+
+ it 'returns true when there is a disk' do
+ host = response_hash_disk["hostname"]
+ expect(vmpooler.disk_added?(host, "16", 0)).to be(true)
+ expect(vmpooler.disk_added?(host, "8", 1)).to be(true)
+ end
+ end
+
describe "#provision" do
it 'provisions hosts from the pool' do
vmpooler = Beaker::Vmpooler.new( make_hosts, make_opts )
allow( vmpooler ).to receive( :require ).and_return( true )