Added libvirt and nova-network tests
* Added rhel platform tests and default (ubuntu) tests for libvirt. * Added rhel platform tests and default (ubuntu) tests for nova-network. * Found and cleaned up a few misnamed tests.
This commit is contained in:
@@ -25,11 +25,8 @@ platform_options["libvirt_packages"].each do |pkg|
|
||||
end
|
||||
end
|
||||
|
||||
# oh fedora...
|
||||
bash "create libvirtd group" do
|
||||
cwd "/tmp"
|
||||
user "root"
|
||||
code <<-EOH
|
||||
execute "create libvirtd group" do
|
||||
command <<-EOH.gsub /^\s+/, ""
|
||||
groupadd -f libvirtd
|
||||
usermod -G libvirtd nova
|
||||
EOH
|
||||
@@ -37,7 +34,6 @@ bash "create libvirtd group" do
|
||||
only_if { platform? %w{fedora redhat centos} }
|
||||
end
|
||||
|
||||
# oh redhat
|
||||
# http://fedoraproject.org/wiki/Getting_started_with_OpenStack_EPEL#Installing_within_a_VM
|
||||
# ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-system-x86_64
|
||||
link "/usr/bin/qemu-system-x86_64" do
|
||||
|
||||
@@ -7,7 +7,7 @@ describe "nova::api-metadata" do
|
||||
@chef_run = ::ChefSpec::ChefRunner.new(
|
||||
:platform => "redhat",
|
||||
:log_level => ::LOG_LEVEL
|
||||
).converge "nova::api-ec2"
|
||||
).converge "nova::api-metadata"
|
||||
end
|
||||
|
||||
it "installs metadata api packages" do
|
||||
|
||||
@@ -44,7 +44,7 @@ describe "nova::api-os-compute" do
|
||||
|
||||
expect_creates_api_paste
|
||||
|
||||
it "notifies nova-api-metadata restart" do
|
||||
it "notifies nova-api-os-compute restart" do
|
||||
@file = @chef_run.template "/etc/nova/api-paste.ini"
|
||||
expect(@file).to notify "service[nova-api-os-compute]", :restart
|
||||
end
|
||||
|
||||
@@ -10,6 +10,14 @@ describe "nova::compute" do
|
||||
).converge "nova::compute"
|
||||
end
|
||||
|
||||
it "does not install kvm when virt_type is 'kvm'" do
|
||||
pending "TODO: how to test this"
|
||||
end
|
||||
|
||||
it "does not install qemu when virt_type is 'qemu'" do
|
||||
pending "TODO: how to test this"
|
||||
end
|
||||
|
||||
it "installs nova compute packages" do
|
||||
expect(@chef_run).to upgrade_package "openstack-nova-compute"
|
||||
end
|
||||
|
||||
5
spec/keystone_registration_spec.rb
Normal file
5
spec/keystone_registration_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "nova::keystone_registration" do
|
||||
#TODO: implement
|
||||
end
|
||||
64
spec/libvirt-redhat_spec.rb
Normal file
64
spec/libvirt-redhat_spec.rb
Normal file
@@ -0,0 +1,64 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "nova::libvirt" do
|
||||
describe "redhat" do
|
||||
before do
|
||||
nova_common_stubs
|
||||
@chef_run = ::ChefSpec::ChefRunner.new(
|
||||
:platform => "redhat",
|
||||
:log_level => ::LOG_LEVEL
|
||||
).converge "nova::libvirt"
|
||||
end
|
||||
|
||||
it "installs libvirt packages" do
|
||||
expect(@chef_run).to install_package "libvirt"
|
||||
end
|
||||
|
||||
it "creates libvirtd group and adds to nova" do
|
||||
cmd = <<-EOH.gsub /^\s+/, ""
|
||||
groupadd -f libvirtd
|
||||
usermod -G libvirtd nova
|
||||
EOH
|
||||
expect(@chef_run).to execute_command cmd
|
||||
end
|
||||
|
||||
it "symlinks qemu-kvm" do
|
||||
link = @chef_run.link "/usr/bin/qemu-system-x86_64"
|
||||
expect(link).to link_to "/usr/libexec/qemu-kvm"
|
||||
end
|
||||
|
||||
it "starts libvirt" do
|
||||
expect(@chef_run).to start_service "libvirtd"
|
||||
end
|
||||
|
||||
it "starts libvirt on boot" do
|
||||
expect(@chef_run).to set_service_to_start_on_boot "libvirtd"
|
||||
end
|
||||
|
||||
it "does not create /etc/default/libvirt-bin" do
|
||||
pending "TODO: how to test this"
|
||||
end
|
||||
|
||||
describe "libvirtd" do
|
||||
before do
|
||||
@file = @chef_run.template "/etc/sysconfig/libvirtd"
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file).to be_owned_by "root", "root"
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "644"
|
||||
end
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: implement"
|
||||
end
|
||||
|
||||
it "notifies libvirt-bin restart" do
|
||||
expect(@file).to notify "service[libvirt-bin]", :restart
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
102
spec/libvirt_spec.rb
Normal file
102
spec/libvirt_spec.rb
Normal file
@@ -0,0 +1,102 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "nova::libvirt" do
|
||||
describe "ubuntu" do
|
||||
before do
|
||||
nova_common_stubs
|
||||
@chef_run_opts = {
|
||||
:platform => "ubuntu",
|
||||
:version => "12.04",
|
||||
:log_level => ::LOG_LEVEL,
|
||||
}
|
||||
@chef_run = ::ChefSpec::ChefRunner.new @chef_run_opts
|
||||
@chef_run.converge "nova::libvirt"
|
||||
end
|
||||
|
||||
it "installs libvirt packages" do
|
||||
expect(@chef_run).to install_package "libvirt-bin"
|
||||
end
|
||||
|
||||
it "does not create libvirtd group and add to nova" do
|
||||
pending "TODO: how to test this"
|
||||
end
|
||||
|
||||
it "does not symlink qemu-kvm" do
|
||||
pending "TODO: how to test this"
|
||||
end
|
||||
|
||||
it "starts dbus" do
|
||||
expect(@chef_run).to start_service "dbus"
|
||||
end
|
||||
|
||||
it "starts dbus on boot" do
|
||||
expect(@chef_run).to set_service_to_start_on_boot "dbus"
|
||||
end
|
||||
|
||||
it "starts libvirt" do
|
||||
expect(@chef_run).to start_service "libvirt-bin"
|
||||
end
|
||||
|
||||
it "starts libvirt on boot" do
|
||||
expect(@chef_run).to set_service_to_start_on_boot "libvirt-bin"
|
||||
end
|
||||
|
||||
it "disables default libvirt network" do
|
||||
cmd = "virsh net-autostart default --disable"
|
||||
expect(@chef_run).to execute_command cmd
|
||||
end
|
||||
|
||||
it "deletes default libvirt network" do
|
||||
cmd = "virsh net-destroy default"
|
||||
expect(@chef_run).to execute_command cmd
|
||||
end
|
||||
|
||||
describe "libvirtd.conf" do
|
||||
before do
|
||||
@file = @chef_run.template "/etc/libvirt/libvirtd.conf"
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file).to be_owned_by "root", "root"
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "644"
|
||||
end
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: implement"
|
||||
end
|
||||
|
||||
it "notifies libvirt-bin restart" do
|
||||
expect(@file).to notify "service[libvirt-bin]", :restart
|
||||
end
|
||||
end
|
||||
|
||||
describe "libvirt-bin" do
|
||||
before do
|
||||
@file = @chef_run.template "/etc/default/libvirt-bin"
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file).to be_owned_by "root", "root"
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "644"
|
||||
end
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: implement"
|
||||
end
|
||||
|
||||
it "notifies libvirt-bin restart" do
|
||||
expect(@file).to notify "service[libvirt-bin]", :restart
|
||||
end
|
||||
end
|
||||
|
||||
it "does not create /etc/sysconfig/libvirtd" do
|
||||
pending "TODO: how to test this"
|
||||
end
|
||||
end
|
||||
end
|
||||
22
spec/network-redhat_spec.rb
Normal file
22
spec/network-redhat_spec.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "nova::network" do
|
||||
describe "redhat" do
|
||||
before do
|
||||
nova_common_stubs
|
||||
@chef_run = ::ChefSpec::ChefRunner.new(
|
||||
:platform => "redhat",
|
||||
:log_level => ::LOG_LEVEL
|
||||
).converge "nova::network"
|
||||
end
|
||||
|
||||
it "installs nova network packages" do
|
||||
expect(@chef_run).to upgrade_package "iptables"
|
||||
expect(@chef_run).to upgrade_package "openstack-nova-network"
|
||||
end
|
||||
|
||||
it "starts nova network on boot" do
|
||||
expect(@chef_run).to set_service_to_start_on_boot "openstack-nova-network"
|
||||
end
|
||||
end
|
||||
end
|
||||
27
spec/network_spec.rb
Normal file
27
spec/network_spec.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "nova::network" do
|
||||
describe "ubuntu" do
|
||||
before do
|
||||
nova_common_stubs
|
||||
@chef_run_opts = {
|
||||
:platform => "ubuntu",
|
||||
:version => "12.04",
|
||||
:log_level => ::LOG_LEVEL,
|
||||
}
|
||||
@chef_run = ::ChefSpec::ChefRunner.new @chef_run_opts
|
||||
@chef_run.converge "nova::network"
|
||||
end
|
||||
|
||||
expect_runs_nova_common_recipe
|
||||
|
||||
it "installs nova network packages" do
|
||||
expect(@chef_run).to upgrade_package "iptables"
|
||||
expect(@chef_run).to upgrade_package "nova-network"
|
||||
end
|
||||
|
||||
it "starts nova network on boot" do
|
||||
expect(@chef_run).to set_service_to_start_on_boot "nova-network"
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user