From f1e16fbbcfe1c9a8b21601a040fefd556df030bc Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 16 Jul 2024 16:29:09 +0200 Subject: [PATCH] Add a test for Server#destroy Previously the exception was swallowed. This adds an explicit test on a new server to prevent interference with other tests. --- tests/libvirt/models/compute/server_tests.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/libvirt/models/compute/server_tests.rb b/tests/libvirt/models/compute/server_tests.rb index 026023c..30d45f2 100644 --- a/tests/libvirt/models/compute/server_tests.rb +++ b/tests/libvirt/models/compute/server_tests.rb @@ -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) @@ -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{\d+}) }