fix container

This commit is contained in:
anlicheng 2026-04-23 19:26:39 +08:00
parent b7d12aa9d7
commit c51045d667

View File

@ -21,7 +21,6 @@
test_create_container_patches_options/0,
test_check_container_exist/0,
test_check_container_not_exist/0,
test_is_container_running/0,
test_start_container/0,
test_stop_container/0,
test_stop_container_with_timeout/0,
@ -45,7 +44,6 @@ test_all() ->
ok = test_create_container_patches_options(),
ok = test_check_container_exist(),
ok = test_check_container_not_exist(),
ok = test_is_container_running(),
ok = test_start_container(),
ok = test_stop_container(),
ok = test_stop_container_with_timeout(),
@ -132,7 +130,8 @@ test_create_container_patches_options() ->
{ok, _ContainerId} = docker_commands:create_container(ContainerDir, Params),
ok
after
cleanup_container(Name)
ok
%cleanup_container(Name)
end.
-spec test_check_container_exist() -> ok.
@ -148,18 +147,6 @@ test_check_container_not_exist() ->
false = docker_commands:check_container_exist(test_container_name(<<"missing">>)),
ok.
-spec test_is_container_running() -> ok.
test_is_container_running() ->
Name = test_container_name(<<"running">>),
with_created_container(Name, fun(_ContainerDir, ContainerId) ->
false = docker_commands:is_container_running(ContainerId),
ok = docker_commands:start_container(Name),
true = docker_commands:is_container_running(ContainerId),
ok = docker_commands:stop_container(Name),
false = docker_commands:is_container_running(ContainerId),
ok
end).
-spec test_start_container() -> ok.
test_start_container() ->
Name = test_container_name(<<"start">>),
@ -230,6 +217,7 @@ test_get_containers() ->
Name = test_container_name(<<"list">>),
with_created_container(Name, fun(_ContainerDir, ContainerId) ->
{ok, Containers} = docker_commands:get_containers(),
logger:debug("list containers: ~p", [Containers]),
true = is_list(Containers),
true = contains_container(Name, ContainerId, Containers),
ok