Fix clear_config method.
This commit is contained in:
parent
323a6519ef
commit
755609c059
|
@ -2121,7 +2121,7 @@ Init_lxc(void)
|
||||||
rb_define_method(Container, "add_device_node",
|
rb_define_method(Container, "add_device_node",
|
||||||
container_add_device_node, -1);
|
container_add_device_node, -1);
|
||||||
rb_define_method(Container, "attach", container_attach, -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",
|
rb_define_method(Container, "clear_config_item",
|
||||||
container_clear_config_item, 1);
|
container_clear_config_item, 1);
|
||||||
rb_define_method(Container, "clone", container_clone, -1);
|
rb_define_method(Container, "clone", container_clone, -1);
|
||||||
|
|
|
@ -28,6 +28,7 @@ class TestLXCCreated < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_container_configuration
|
def test_container_configuration
|
||||||
capdrop = @container.config_item('lxc.cap.drop')
|
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.clear_config_item('lxc.cap.drop')
|
||||||
@container.set_config_item('lxc.cap.drop', capdrop[0...-1])
|
@container.set_config_item('lxc.cap.drop', capdrop[0...-1])
|
||||||
@container.set_config_item('lxc.cap.drop', capdrop[-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'))
|
assert_match(/^00:16:3e:/, @container.config_item('lxc.network.0.hwaddr'))
|
||||||
end
|
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
|
def test_container_mount_points
|
||||||
assert_instance_of(Array, @container.config_item('lxc.mount.entry'))
|
assert_instance_of(Array, @container.config_item('lxc.mount.entry'))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue