cookbook-openstack-compute/spec/compute_spec.rb
John Dewey a1acd590a0 Changed cookbook name to openstack-compute
Changed the cookbook name to openstack-compute, fixed all tests, and
addressed attributes. Also addressed calls to external services,
primarily keystone -> openstack-identity.

All tests pass.

Change-Id: Ic567a33cefd78cc3b2217986d3ff7475bc93f874
2013-05-16 17:59:06 -07:00

68 lines
1.9 KiB
Ruby

require "spec_helper"
describe "openstack-compute::compute" do
describe "ubuntu" do
before do
nova_common_stubs
@chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
@chef_run.converge "openstack-compute::compute"
end
expect_runs_nova_common_recipe
it "runs api-metadata recipe" do
expect(@chef_run).to include_recipe "openstack-compute::api-metadata"
end
it "runs network recipe" do
expect(@chef_run).to include_recipe "openstack-compute::network"
end
it "installs nova compute packages" do
expect(@chef_run).to upgrade_package "nova-compute"
end
it "installs kvm when virt_type is 'kvm'" do
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
node = chef_run.node
node.set["openstack-compute"]["libvirt"]["virt_type"] = "kvm"
chef_run.converge "openstack-compute::compute"
expect(chef_run).to upgrade_package "nova-compute-kvm"
expect(chef_run).not_to upgrade_package "nova-compute-qemu"
end
it "installs qemu when virt_type is 'qemu'" do
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
node = chef_run.node
node.set["openstack-compute"]["libvirt"]["virt_type"] = "qemu"
chef_run.converge "openstack-compute::compute"
expect(chef_run).to upgrade_package "nova-compute-qemu"
expect(chef_run).not_to upgrade_package "nova-compute-kvm"
end
describe "nova-compute.conf" do
before do
@file = @chef_run.cookbook_file "/etc/nova/nova-compute.conf"
end
it "has proper modes" do
expect(sprintf("%o", @file.mode)).to eq "644"
end
it "template contents" do
pending "TODO: implement"
end
end
it "starts nova compute on boot" do
expect(@chef_run).to set_service_to_start_on_boot "nova-compute"
end
it "runs libvirt recipe" do
expect(@chef_run).to include_recipe "openstack-compute::libvirt"
end
end
end