2013-12-06 17:43:19 +01:00
|
|
|
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
|
|
|
|
|
2013-12-05 20:29:25 +01:00
|
|
|
require 'test/unit'
|
2013-12-06 17:43:19 +01:00
|
|
|
require 'lxc'
|
2013-12-05 20:29:25 +01:00
|
|
|
|
|
|
|
class TestLXCUndefined < Test::Unit::TestCase
|
|
|
|
def setup
|
2013-12-06 17:59:20 +01:00
|
|
|
@name = 'test_undefined'
|
2013-12-05 20:29:25 +01:00
|
|
|
@container = LXC::Container.new(@name)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_container_config_file_name
|
2014-01-14 11:51:22 +01:00
|
|
|
lxc_path = LXC.global_config_item('lxc.lxcpath')
|
|
|
|
config_path = File.join(lxc_path, @name, 'config')
|
2013-12-05 20:29:25 +01:00
|
|
|
assert_equal(config_path, @container.config_file_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_container_not_defined
|
2013-12-06 17:59:20 +01:00
|
|
|
assert(!@container.defined?)
|
2013-12-05 20:29:25 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_container_init_pid
|
2013-12-06 17:59:20 +01:00
|
|
|
assert_nil(@container.init_pid)
|
2013-12-05 20:29:25 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_container_not_running
|
2013-12-06 17:59:20 +01:00
|
|
|
assert(!@container.running?)
|
2013-12-05 20:29:25 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_container_stopped
|
2014-01-14 12:24:00 +01:00
|
|
|
assert_equal(:stopped, @container.state)
|
2013-12-05 20:29:25 +01:00
|
|
|
end
|
|
|
|
end
|