Skip to content

Commit 1051ef2

Browse files
beena352Ben Hillis
authored andcommitted
Add cleanup
1 parent e22f6a1 commit 1051ef2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,10 +943,16 @@ class WSLCE2EContainerCreateTests
943943
GetPythonHttpServerScript(ContainerTestPort)));
944944
result1.Verify({.Stderr = L"", .ExitCode = 0});
945945

946+
auto containersBefore = ListAllContainers().size();
947+
946948
// Attempt to start another container mapping the same host port
947949
auto result2 = RunWslc(std::format(L"container run -p {}:{} {}", HostTestPort1, ContainerTestPort, DebianImage.NameAndTag()));
948950
result2.Verify({.ExitCode = 1});
949951
VERIFY_IS_TRUE(result2.Stderr.has_value() && result2.Stderr.value().find(L"is already in use") != std::wstring::npos);
952+
953+
// Verify the failed container was not left behind
954+
auto containersAfter = ListAllContainers().size();
955+
VERIFY_ARE_EQUAL(containersBefore, containersAfter);
950956
}
951957

952958
// https://github.com/microsoft/WSL/issues/14433

0 commit comments

Comments
 (0)