|
29 | 29 |
|
30 | 30 | expect(task.create_requested_volumes(task.options[:volumes])).to eq([default_volume, requested_volume]) |
31 | 31 | end |
| 32 | + |
| 33 | + context "with a flavor that has no root disk" do |
| 34 | + let(:flavor) { FactoryBot.create(:flavor_openstack, :root_disk_size => 0) } |
| 35 | + |
| 36 | + it "sets the requested volume as a boot disk" do |
| 37 | + expected_volume = {:name => "custom_volume_1", :size => 2, :uuid => volume.id, :source_type => "volume", |
| 38 | + :destination_type => "volume", :boot_index => 0, :bootable => true, :imageRef => template.ems_ref} |
| 39 | + |
| 40 | + expect(task.create_requested_volumes(task.options[:volumes])).to eq([expected_volume]) |
| 41 | + end |
| 42 | + |
| 43 | + context "with multiple requested volumes" do |
| 44 | + let(:task_volumes) { [{:name => "custom_volume_1", :size => 2}, {:name => "custom_volume_2", :size => 4}] } |
| 45 | + |
| 46 | + it "sets other volumes as boot_index -1" do |
| 47 | + expected_volume_1 = {:name => "custom_volume_1", :size => 2, :uuid => volume.id, :source_type => "volume", |
| 48 | + :destination_type => "volume", :boot_index => 0, :bootable => true, :imageRef => template.ems_ref} |
| 49 | + expected_volume_2 = {:name => "custom_volume_2", :size => 4, :uuid => volume.id, :source_type => "volume", |
| 50 | + :destination_type => "volume", :boot_index => -1} |
| 51 | + |
| 52 | + expect(task.create_requested_volumes(task.options[:volumes])).to eq([expected_volume_1, expected_volume_2]) |
| 53 | + end |
| 54 | + end |
| 55 | + end |
32 | 56 | end |
33 | 57 |
|
34 | 58 | context "#check_volumes" do |
|
0 commit comments