Skip to content

Commit

Permalink
Add a test for Server#destroy
Browse files Browse the repository at this point in the history
Previously the exception was swallowed. This adds an explicit test on a
new server to prevent interference with other tests.
  • Loading branch information
ekohl committed Jul 16, 2024
1 parent 21fa469 commit f1e16fb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/libvirt/models/compute/server_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
%w{ start stop destroy reboot suspend }.each do |action|
test(action) { server.respond_to? action }
end
%w{ start reboot suspend stop destroy}.each do |action|
%w{ start reboot suspend stop }.each do |action|
test("#{action} returns successfully") {
begin
server.send(action.to_sym)
Expand Down Expand Up @@ -60,6 +60,11 @@
end
end
end

test('can destroy') do
servers.create(:name => Fog::Mock.random_letters(8)).destroy
end

test('be a kind of Fog::Libvirt::Compute::Server') { server.kind_of? Fog::Libvirt::Compute::Server }
tests("serializes to xml") do
test("with memory") { server.to_xml.match?(%r{<memory>\d+</memory>}) }
Expand Down

0 comments on commit f1e16fb

Please sign in to comment.