Stop blocking ruby during long-running operations

This commit is contained in:
John Keiser 2014-03-24 15:39:25 -07:00
parent fd75ebc9a2
commit 4f580efe8a
5 changed files with 708 additions and 154 deletions

View file

@ -0,0 +1,25 @@
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
require 'test/unit'
require 'lxc'
require 'test_helpers'
class TestLXCCreateAsynchronous < Test::Unit::TestCase
include TestHelpers
def setup
if Process::Sys::geteuid != 0
raise 'This test must be ran as root'
end
@name = 'test_async_create'
container = LXC::Container.new(@name)
container.destroy if container.defined?
end
def test_create_allows_ruby_to_continue
c = LXC::Container.new(@name)
assert_long_running_function_does_not_block_ruby do
c.create('ubuntu')
end
end
end