Commit 4086cea5 by Dwight Engen Committed by Stéphane Graber

lua: fix return value of attach() method

Add simple test case for attach() method. Add assert for return value from create() method which also returns a boolean. Signed-off-by: 's avatarDwight Engen <dwight.engen@oracle.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 0dcbd624
...@@ -397,7 +397,7 @@ static int container_attach(lua_State *L) ...@@ -397,7 +397,7 @@ static int container_attach(lua_State *L)
return 1; return 1;
} }
lua_pushboolean(L, !!(c->attach_run_wait(c, NULL, argv[0], (const char**)argv))); lua_pushboolean(L, !(c->attach_run_wait(c, NULL, argv[0], (const char**)argv)));
return 1; return 1;
} }
......
...@@ -119,7 +119,7 @@ function test_container_create() ...@@ -119,7 +119,7 @@ function test_container_create()
end end
end end
log(0, "%-20s %s", "Creating rootfs using:", optarg["t"]) log(0, "%-20s %s", "Creating rootfs using:", optarg["t"])
container:create(optarg["t"]) assert(container:create(optarg["t"]) == true)
assert(container:defined() == true) assert(container:defined() == true)
assert(container:name() == optarg["n"]) assert(container:name() == optarg["n"])
end end
...@@ -206,6 +206,12 @@ function test_container_in_cfglist(should_find) ...@@ -206,6 +206,12 @@ function test_container_in_cfglist(should_find)
end end
end end
function test_container_attach()
log(0, "Test attach...")
assert(container:running() == true)
assert(container:attach("/bin/ps") == true)
end
function test_container_cgroup() function test_container_cgroup()
log(0, "Test get/set cgroup items...") log(0, "Test get/set cgroup items...")
...@@ -330,6 +336,7 @@ test_config_network(0) ...@@ -330,6 +336,7 @@ test_config_network(0)
test_container_start() test_container_start()
test_container_started() test_container_started()
test_container_attach()
test_container_cgroup() test_container_cgroup()
test_container_cmd() test_container_cmd()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment