From f3dc3e3de0c9b24eb86d3a9b59e5875b47bbbbe2 Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Tue, 11 Feb 2014 08:45:58 -0200 Subject: [PATCH] Ensure #stop is called if #shutdown fails in test --- test/test_lxc_running.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/test_lxc_running.rb b/test/test_lxc_running.rb index 9e541bf..56905a7 100644 --- a/test/test_lxc_running.rb +++ b/test/test_lxc_running.rb @@ -16,11 +16,15 @@ class TestLXCRunning < Test::Unit::TestCase end def teardown - @container.shutdown(3) - if @container.running? - @container.stop - @container.wait(:stopped, 3) + begin + @container.shutdown(3) + rescue LXC::Error + if @container.running? + @container.stop + @container.wait(:stopped, 3) + end end + assert(!@container.running?) end def test_container_running