Fix clear_config method.

This commit is contained in:
NiR- 2014-06-06 10:24:18 +02:00
parent 323a6519ef
commit 755609c059
2 changed files with 11 additions and 1 deletions

View file

@ -2121,7 +2121,7 @@ Init_lxc(void)
rb_define_method(Container, "add_device_node",
container_add_device_node, -1);
rb_define_method(Container, "attach", container_attach, -1);
rb_define_method(Container, "clear_config", container_clear_config, -1);
rb_define_method(Container, "clear_config", container_clear_config, 0);
rb_define_method(Container, "clear_config_item",
container_clear_config_item, 1);
rb_define_method(Container, "clone", container_clone, -1);

View file

@ -28,6 +28,7 @@ class TestLXCCreated < Test::Unit::TestCase
def test_container_configuration
capdrop = @container.config_item('lxc.cap.drop')
assert_instance_of(Array, @container.config_item('lxc.cap.drop'))
@container.clear_config_item('lxc.cap.drop')
@container.set_config_item('lxc.cap.drop', capdrop[0...-1])
@container.set_config_item('lxc.cap.drop', capdrop[-1])
@ -40,6 +41,15 @@ class TestLXCCreated < Test::Unit::TestCase
assert_match(/^00:16:3e:/, @container.config_item('lxc.network.0.hwaddr'))
end
def test_clear_config
assert_not_nil(@container.config_item('lxc.utsname'))
assert(@container.clear_config)
assert_raise(LXC::Error) do
@container.config_item('lxc.utsname').nil?
end
end
def test_container_mount_points
assert_instance_of(Array, @container.config_item('lxc.mount.entry'))
end