Match Docker output for prune operations and container inspection (#41430)

Cleanup various miscellaneous output divergences Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

ggarzia-MSFT committed Aug 26, 2026 at 09:37 UTC 12a861b51c6793e7d3dfe13f9465248b02ed9ee1
16 files changed +108 -49
localization/strings/en-US/Resources.resw
+16 -2
@@ -2687,6 +2687,9 @@ Example: tar -cf - files | wslc container cp - CONTAINER:/path</value>
2687 <data name="WSLCCLI_ContainerLogsLongDesc" xml:space="preserve">
2688 <value>View logs for a container.</value>
2689 </data>
2690 + <data name="WSLCCLI_ContainerPruneDeletedHeader" xml:space="preserve">
2691 + <value>Deleted Containers:</value>
2692 + </data>
2693 <data name="WSLCCLI_ContainerPruneDesc" xml:space="preserve">
2694 <value>Remove all stopped containers.</value>
2695 </data>
@@ -2780,9 +2783,12 @@ Example: tar -cf - files | wslc container cp - CONTAINER:/path</value>
2783 <value>Remove all unused images, not just dangling ones.</value>
2784 </data>
2785 <data name="WSLCCLI_ImagePruneDeleted" xml:space="preserve">
2783 - <value>Deleted: {}</value>
2786 + <value>deleted: {}</value>
2787 <comment>{FixedPlaceholder="{}"}Command line arguments, file names and string inserts should not be translated</comment>
2788 </data>
2789 + <data name="WSLCCLI_ImagePruneDeletedHeader" xml:space="preserve">
2790 + <value>Deleted Images:</value>
2791 + </data>
2792 <data name="WSLCCLI_ImagePruneDesc" xml:space="preserve">
2793 <value>Remove unused images.</value>
2794 </data>
@@ -2795,7 +2801,7 @@ Example: tar -cf - files | wslc container cp - CONTAINER:/path</value>
2801 <comment>{FixedPlaceholder="{}"}Command line arguments, file names and string inserts should not be translated</comment>
2802 </data>
2803 <data name="WSLCCLI_ImagePruneUntagged" xml:space="preserve">
2798 - <value>Untagged: {}</value>
2804 + <value>untagged: {}</value>
2805 <comment>{FixedPlaceholder="{}"}Command line arguments, file names and string inserts should not be translated</comment>
2806 </data>
2807 <data name="WSLCCLI_ImagePushDesc" xml:space="preserve">
@@ -2804,6 +2810,14 @@ Example: tar -cf - files | wslc container cp - CONTAINER:/path</value>
2810 <data name="WSLCCLI_ImagePushLongDesc" xml:space="preserve">
2811 <value>Upload an image to a registry.</value>
2812 </data>
2813 + <data name="WSLCCLI_ImageDeleteDeleted" xml:space="preserve">
2814 + <value>Deleted: {}</value>
2815 + <comment>{FixedPlaceholder="{}"}Command line arguments, file names and string inserts should not be translated</comment>
2816 + </data>
2817 + <data name="WSLCCLI_ImageDeleteUntagged" xml:space="preserve">
2818 + <value>Untagged: {}</value>
2819 + <comment>{FixedPlaceholder="{}"}Command line arguments, file names and string inserts should not be translated</comment>
2820 + </data>
2821 <data name="WSLCCLI_ImageRemoveDesc" xml:space="preserve">
2822 <value>Remove images.</value>
2823 </data>
src/windows/wslc/services/ImageModel.h
+6
@@ -49,6 +49,12 @@ struct ImageOutputInformation
49
50 inline constexpr std::string_view c_none = "<none>";
51
52 +struct DeletedImageEntry
53 +{
54 + std::string Image;
55 + bool Deleted{};
56 +};
57 +
58 struct PruneImagesResult
59 {
60 std::vector<std::string> DeletedImages;
src/windows/wslc/services/ImageService.cpp
+15 -5
@@ -350,7 +350,8 @@ std::string ImageService::Import(Terminal& terminal, wsl::windows::wslc::models:
350 return imageId.get() ? std::string(imageId.get()) : std::string();
351 }
352
353 -void ImageService::Delete(wsl::windows::wslc::models::Session& session, const std::string& image, bool force, bool noPrune)
353 +std::vector<wsl::windows::wslc::models::DeletedImageEntry> ImageService::Delete(
354 + wsl::windows::wslc::models::Session& session, const std::string& image, bool force, bool noPrune)
355 {
356 WSLCDeleteImageOptions options{};
357 options.Image = image.c_str();
@@ -367,6 +368,15 @@ void ImageService::Delete(wsl::windows::wslc::models::Session& session, const st
368
369 wil::unique_cotaskmem_array_ptr<WSLCDeletedImageInformation> deletedImages;
370 THROW_IF_FAILED(session.Get()->DeleteImage(&options, &deletedImages, deletedImages.size_address<ULONG>()));
371 +
372 + std::vector<wsl::windows::wslc::models::DeletedImageEntry> result;
373 + result.reserve(deletedImages.size());
374 + for (const auto& entry : deletedImages)
375 + {
376 + result.push_back({entry.Image, entry.Type == WSLCDeletedImageTypeDeleted});
377 + }
378 +
379 + return result;
380 }
381
382 void ImageService::Pull(Terminal& terminal, wsl::windows::wslc::models::Session& session, const std::string& image, IProgressCallback* callback)
@@ -474,15 +484,15 @@ wsl::windows::wslc::models::PruneImagesResult ImageService::Prune(
484
485 wsl::windows::wslc::models::PruneImagesResult result;
486 result.SpaceReclaimed = spaceReclaimed;
477 - for (auto ptr = deletedImages.get(), end = deletedImages.get() + deletedImages.size(); ptr != end; ++ptr)
487 + for (const auto& entry : deletedImages)
488 {
479 - if (ptr->Type == WSLCDeletedImageTypeDeleted)
489 + if (entry.Type == WSLCDeletedImageTypeDeleted)
490 {
481 - result.DeletedImages.push_back(ptr->Image);
491 + result.DeletedImages.push_back(entry.Image);
492 }
493 else
494 {
485 - result.UntaggedImages.push_back(ptr->Image);
495 + result.UntaggedImages.push_back(entry.Image);
496 }
497 }
498
src/windows/wslc/services/ImageService.h
+2 -1
@@ -70,7 +70,8 @@ public:
70 bool containerCounts = false);
71 static void Load(Terminal& terminal, wsl::windows::wslc::models::Session& session, const std::wstring& input, IImageLoadCallback* callback = nullptr);
72 static std::string Import(Terminal& terminal, wsl::windows::wslc::models::Session& session, const std::wstring& input, const std::string& imageName);
73 - static void Delete(wsl::windows::wslc::models::Session& session, const std::string& image, bool force, bool noPrune);
73 + static std::vector<wsl::windows::wslc::models::DeletedImageEntry> Delete(
74 + wsl::windows::wslc::models::Session& session, const std::string& image, bool force, bool noPrune);
75 static wsl::windows::common::wslc_schema::InspectImage Inspect(wsl::windows::wslc::models::Session& session, const std::string& image);
76 static void Pull(Terminal& terminal, wsl::windows::wslc::models::Session& session, const std::string& image, IProgressCallback* callback);
77 static void Push(Terminal& terminal, wsl::windows::wslc::models::Session& session, const std::string& image, IProgressCallback* callback);
src/windows/wslc/tasks/ContainerTasks.cpp
+8 -3
@@ -1075,12 +1075,17 @@ void PruneContainers(CLIExecutionContext& context)
1075
1076 auto result = ContainerService::Prune(session);
1077
1078 - for (const auto& containerId : result.PrunedContainers)
1078 + if (!result.PrunedContainers.empty())
1079 {
1080 - context.Terminal.Output(L"{}\n", MultiByteToWide(containerId));
1080 + context.Terminal.Output(L"{}\n", Localization::WSLCCLI_ContainerPruneDeletedHeader());
1081 + for (const auto& containerId : result.PrunedContainers)
1082 + {
1083 + context.Terminal.Output(L"{}\n", MultiByteToWide(containerId));
1084 + }
1085 +
1086 + context.Terminal.Output(L"\n");
1087 }
1088
1083 - context.Terminal.Output(L"\n");
1089 context.Terminal.Output(
1090 L"{}\n", Localization::WSLCCLI_ContainerPruneSpaceReclaimedBytes(FormatHumanReadableSize(result.SpaceReclaimed, c_reclaimedSpacePrecision)));
1091 }
src/windows/wslc/tasks/ImageTasks.cpp
+21 -8
@@ -309,7 +309,14 @@ void DeleteImage(CLIExecutionContext& context)
309 bool noPrune = context.Args.GetValue<ArgType::NoPrune>();
310 for (const auto& id : imageIds)
311 {
312 - services::ImageService::Delete(session, WideToMultiByte(id), force, noPrune);
312 + const auto deleted = services::ImageService::Delete(session, WideToMultiByte(id), force, noPrune);
313 + for (const auto& entry : deleted)
314 + {
315 + context.Terminal.Output(
316 + L"{}\n",
317 + entry.Deleted ? Localization::WSLCCLI_ImageDeleteDeleted(entry.Image)
318 + : Localization::WSLCCLI_ImageDeleteUntagged(entry.Image));
319 + }
320 }
321 }
322
@@ -428,17 +435,23 @@ void PruneImages(CLIExecutionContext& context)
435
436 auto result = ImageService::Prune(session, all, filters);
437
431 - for (const auto& image : result.UntaggedImages)
438 + if (!result.UntaggedImages.empty() || !result.DeletedImages.empty())
439 {
433 - context.Terminal.Output(L"{}\n", Localization::WSLCCLI_ImagePruneUntagged(image));
434 - }
440 + context.Terminal.Output(L"{}\n", Localization::WSLCCLI_ImagePruneDeletedHeader());
441
436 - for (const auto& image : result.DeletedImages)
437 - {
438 - context.Terminal.Output(L"{}\n", Localization::WSLCCLI_ImagePruneDeleted(image));
442 + for (const auto& image : result.UntaggedImages)
443 + {
444 + context.Terminal.Output(L"{}\n", Localization::WSLCCLI_ImagePruneUntagged(image));
445 + }
446 +
447 + for (const auto& image : result.DeletedImages)
448 + {
449 + context.Terminal.Output(L"{}\n", Localization::WSLCCLI_ImagePruneDeleted(image));
450 + }
451 +
452 + context.Terminal.Output(L"\n");
453 }
454
441 - context.Terminal.Output(L"\n");
455 context.Terminal.Output(
456 L"{}\n", Localization::WSLCCLI_ImagePruneSpaceReclaimedBytes(FormatHumanReadableSize(result.SpaceReclaimed, c_reclaimedSpacePrecision)));
457 }
src/windows/wslc/tasks/NetworkTasks.cpp
+1 -1
@@ -53,7 +53,7 @@ namespace {
53 entry.Labels += ",";
54 }
55
56 - entry.Labels += value.empty() ? key : std::format("{}={}", key, value);
56 + entry.Labels += std::format("{}={}", key, value);
57 }
58
59 return entry;
src/windows/wslcsession/WSLCContainer.cpp
+2 -2
@@ -1889,9 +1889,9 @@ WslcInspectContainer WSLCContainerImpl::BuildInspectContainer(const DockerInspec
1889 WslcInspectContainer wslcInspect{};
1890
1891 wslcInspect.Id = dockerInspect.Id;
1892 - wslcInspect.Name = CleanContainerName(dockerInspect.Name);
1892 + wslcInspect.Name = dockerInspect.Name;
1893 wslcInspect.Created = dockerInspect.Created;
1894 - wslcInspect.Image = m_image;
1894 + wslcInspect.Image = dockerInspect.Image;
1895
1896 // Map container state.
1897 wslcInspect.State.Status = dockerInspect.State.Status;
test/windows/PluginTests.cpp
+1 -1
@@ -730,7 +730,7 @@ class PluginTests
730 WSLCMountFolder(relative): {}
731 Test completed
732 WSLC Image created, session=*, id=sha256:*, name=debian:latest
733 - WSLC Container started, session=*, id=*, name=wslc-plugin-container, image=debian:latest, state=*
733 + WSLC Container started, session=*, id=*, name=/wslc-plugin-container, image=debian:latest, state=*
734 WSLC Container stopping, session=*, id=*
735 WSLC Image deleted, session=*, id=*
736 WSLC Session stopping, name=plugin-wslc-test, id=*)",
test/windows/WSLCTests.cpp
+8 -6
@@ -9169,8 +9169,9 @@ class WSLCTests
9169
9170 // Verify basic container metadata.
9171 VERIFY_IS_FALSE(details.Id.empty());
9172 - VERIFY_ARE_EQUAL(details.Name, "test-container-inspect");
9173 - VERIFY_ARE_EQUAL(details.Image, "debian:latest");
9172 + VERIFY_ARE_EQUAL(details.Name, "/test-container-inspect");
9173 + VERIFY_IS_TRUE(details.Image.starts_with("sha256:"));
9174 + VERIFY_ARE_EQUAL(details.Config.Image, "debian:latest");
9175 VERIFY_IS_FALSE(details.Created.empty());
9176
9177 // Verify container state.
@@ -9206,8 +9207,9 @@ class WSLCTests
9207
9208 // Verify basic container metadata is present.
9209 VERIFY_IS_FALSE(details.Id.empty());
9209 - VERIFY_ARE_EQUAL(details.Name, "test-container-inspect-exited");
9210 - VERIFY_ARE_EQUAL(details.Image, "debian:latest");
9210 + VERIFY_ARE_EQUAL(details.Name, "/test-container-inspect-exited");
9211 + VERIFY_IS_TRUE(details.Image.starts_with("sha256:"));
9212 + VERIFY_ARE_EQUAL(details.Config.Image, "debian:latest");
9213 VERIFY_IS_FALSE(details.Created.empty());
9214
9215 // Verify exited state is correct.
@@ -11566,7 +11568,7 @@ class WSLCTests
11568
11569 const auto inspect = container.Inspect();
11570 VERIFY_ARE_EQUAL(c_image, inspect.Config.Image);
11569 - VERIFY_ARE_EQUAL(inspect.Image, inspect.Config.Image);
11571 + VERIFY_IS_TRUE(inspect.Image.starts_with("sha256:"));
11572
11573 // Keep the container alive after the handle is dropped so we can validate labels are persisted across sessions.
11574 container.SetDeleteOnClose(false);
@@ -11589,7 +11591,7 @@ class WSLCTests
11591 VERIFY_ARE_EQUAL(inspect.Config.Labels, inspect.Labels);
11592 VERIFY_IS_TRUE(inspect.Config.Labels.find(c_metadataLabel) == inspect.Config.Labels.end());
11593 VERIFY_ARE_EQUAL(c_image, inspect.Config.Image);
11592 - VERIFY_ARE_EQUAL(inspect.Image, inspect.Config.Image);
11594 + VERIFY_IS_TRUE(inspect.Image.starts_with("sha256:"));
11595 }
11596
11597 // Test nullptr key
test/windows/testplugin/Plugin.cpp
+2 -2
@@ -581,8 +581,8 @@ try
581 {
582 auto container = wsl::shared::FromJson<wsl::windows::common::wslc_schema::InspectContainer>(InspectJson);
583
584 - g_logfile << "WSLC Container started, session=" << Session->SessionId << ", id=" << container.Id
585 - << ", name=" << container.Name << ", image=" << container.Image << ", state=" << container.State.Status << std::endl;
584 + g_logfile << "WSLC Container started, session=" << Session->SessionId << ", id=" << container.Id << ", name=" << container.Name
585 + << ", image=" << container.Config.Image << ", state=" << container.State.Status << std::endl;
586
587 if (g_testType == PluginTestType::WslcContainerRejected)
588 {
test/windows/wslc/e2e/WSLCE2EContainerInspectTests.cpp
+5 -5
@@ -76,7 +76,7 @@ class WSLCE2EContainerInspectTests
76 auto inspectData =
77 wsl::shared::FromJson<std::vector<wsl::windows::common::wslc_schema::InspectContainer>>(result.Stdout.value().c_str());
78 VERIFY_ARE_EQUAL(1u, inspectData.size());
79 - VERIFY_ARE_EQUAL(WideToMultiByte(TestContainerName1), inspectData[0].Name);
79 + VERIFY_ARE_EQUAL("/" + WideToMultiByte(TestContainerName1), inspectData[0].Name);
80 }
81
82 WSLC_TEST_METHOD(WSLCE2E_Container_Inspect_FormatJson_IsSingleLine)
@@ -90,7 +90,7 @@ class WSLCE2EContainerInspectTests
90 const auto document = VerifyCompactJsonOutput(result);
91 VERIFY_IS_TRUE(document.is_array());
92 VERIFY_ARE_EQUAL(1u, document.size());
93 - VERIFY_ARE_EQUAL(WideToMultiByte(TestContainerName1), document[0]["Name"].get<std::string>());
93 + VERIFY_ARE_EQUAL("/" + WideToMultiByte(TestContainerName1), document[0]["Name"].get<std::string>());
94 }
95
96 WSLC_TEST_METHOD(WSLCE2E_Container_InspectMultiple_Success)
@@ -107,8 +107,8 @@ class WSLCE2EContainerInspectTests
107 auto inspectData =
108 wsl::shared::FromJson<std::vector<wsl::windows::common::wslc_schema::InspectContainer>>(result.Stdout.value().c_str());
109 VERIFY_ARE_EQUAL(2u, inspectData.size());
110 - VERIFY_ARE_EQUAL(WideToMultiByte(TestContainerName1), inspectData[0].Name);
111 - VERIFY_ARE_EQUAL(WideToMultiByte(TestContainerName2), inspectData[1].Name);
110 + VERIFY_ARE_EQUAL("/" + WideToMultiByte(TestContainerName1), inspectData[0].Name);
111 + VERIFY_ARE_EQUAL("/" + WideToMultiByte(TestContainerName2), inspectData[1].Name);
112 }
113
114 WSLC_TEST_METHOD(WSLCE2E_Container_Inspect_MixedFoundNotFound)
@@ -125,7 +125,7 @@ class WSLCE2EContainerInspectTests
125 auto inspectData =
126 wsl::shared::FromJson<std::vector<wsl::windows::common::wslc_schema::InspectContainer>>(result.Stdout.value().c_str());
127 VERIFY_ARE_EQUAL(1u, inspectData.size());
128 - VERIFY_ARE_EQUAL(WideToMultiByte(TestContainerName1), inspectData[0].Name);
128 + VERIFY_ARE_EQUAL("/" + WideToMultiByte(TestContainerName1), inspectData[0].Name);
129 }
130
131 private:
test/windows/wslc/e2e/WSLCE2EContainerPruneTests.cpp
+6 -3
@@ -52,11 +52,13 @@ class WSLCE2EContainerPruneTests
52
53 WSLC_TEST_METHOD(WSLCE2E_Container_Prune_NoStoppedContainers)
54 {
55 - // Prune when no stopped containers exist should succeed with zero reclaimed space
55 + // Establish a clean baseline first so this does not depend on what other tests left behind.
56 + RunWslc(L"container prune").Verify({.Stderr = L"", .ExitCode = 0});
57 +
58 const auto result = RunWslc(L"container prune");
57 - result.Verify({.Stderr = L"", .ExitCode = 0});
59
59 - VERIFY_IS_TRUE(result.StdoutContainsSubstring(L"Total reclaimed space:"));
60 + // With nothing pruned docker emits only the reclaimed-space line, with no header or leading blank line.
61 + result.Verify({.Stdout = L"Total reclaimed space: 0B\r\n", .Stderr = L"", .ExitCode = 0});
62 }
63
64 WSLC_TEST_METHOD(WSLCE2E_Container_Prune_StoppedContainer)
@@ -74,6 +76,7 @@ class WSLCE2EContainerPruneTests
76
77 // Verify pruned container ID is in output
78 VERIFY_IS_TRUE(result.StdoutContainsSubstring(containerId));
79 + VERIFY_IS_TRUE(result.StdoutContainsSubstring(Localization::WSLCCLI_ContainerPruneDeletedHeader()));
80
81 // Verify the container is actually removed
82 VerifyContainerIsNotListed(L"prune-test-container");
test/windows/wslc/e2e/WSLCE2EImageDeleteTests.cpp
+8 -3
@@ -70,7 +70,9 @@ class WSLCE2EImageDeleteTests
70 VerifyImageIsNotUsed(DebianImage);
71
72 auto result = RunWslc(std::format(L"image delete {}", DebianImage.Name));
73 - result.Verify({.Stdout = L"", .Stderr = L"", .ExitCode = 0});
73 + result.Verify({.Stderr = L"", .ExitCode = 0});
74 + VERIFY_IS_TRUE(result.StdoutContainsSubstring(std::format(L"Untagged: {}", DebianImage.NameAndTag())));
75 + VERIFY_IS_TRUE(result.StdoutContainsSubstring(L"Deleted: sha256:"));
76 }
77
78 WSLC_TEST_METHOD(WSLCE2E_Image_Delete_MultipleUnusedImages_Success)
@@ -81,7 +83,9 @@ class WSLCE2EImageDeleteTests
83 VerifyImageIsNotUsed(AlpineImage);
84
85 auto result = RunWslc(std::format(L"image delete {} {}", DebianImage.Name, AlpineImage.Name));
84 - result.Verify({.Stdout = L"", .Stderr = L"", .ExitCode = 0});
86 + result.Verify({.Stderr = L"", .ExitCode = 0});
87 + VERIFY_IS_TRUE(result.StdoutContainsSubstring(std::format(L"Untagged: {}", DebianImage.NameAndTag())));
88 + VERIFY_IS_TRUE(result.StdoutContainsSubstring(std::format(L"Untagged: {}", AlpineImage.NameAndTag())));
89 }
90
91 WSLC_TEST_METHOD(WSLCE2E_Image_Delete_UsedImage_Failure)
@@ -122,7 +126,8 @@ class WSLCE2EImageDeleteTests
126 VerifyImageIsUsed(DebianImage);
127
128 auto result = RunWslc(std::format(L"image delete --force {}", DebianImage.Name));
125 - result.Verify({.Stdout = L"", .Stderr = L"", .ExitCode = 0});
129 + result.Verify({.Stderr = L"", .ExitCode = 0});
130 + VERIFY_IS_TRUE(result.StdoutContainsSubstring(std::format(L"Untagged: {}", DebianImage.NameAndTag())));
131 }
132
133 WSLC_TEST_METHOD(WSLCE2E_Image_DeleteNoPrune)
test/windows/wslc/e2e/WSLCE2EImagePruneTests.cpp
+4 -4
@@ -77,7 +77,7 @@ class WSLCE2EImagePruneTests
77 bool foundDeleted = false;
78 for (const auto& line : result.GetStdoutLines())
79 {
80 - if (line.find(L"Deleted:") != std::wstring::npos || line.find(L"Untagged:") != std::wstring::npos)
80 + if (line.find(L"deleted:") != std::wstring::npos || line.find(L"untagged:") != std::wstring::npos)
81 {
82 foundDeleted = true;
83 break;
@@ -152,9 +152,9 @@ class WSLCE2EImagePruneTests
152 for (const auto& line : filteredPrune.GetStdoutLines())
153 {
154 VERIFY_IS_FALSE(
155 - line.find(L"Deleted:") != std::wstring::npos, L"Filtered prune should not have deleted the dangling image");
155 + line.find(L"deleted:") != std::wstring::npos, L"Filtered prune should not have deleted the dangling image");
156 VERIFY_IS_FALSE(
157 - line.find(L"Untagged:") != std::wstring::npos, L"Filtered prune should not have untagged the dangling image");
157 + line.find(L"untagged:") != std::wstring::npos, L"Filtered prune should not have untagged the dangling image");
158 }
159
160 // A subsequent unfiltered prune should still find and remove the dangling image,
@@ -165,7 +165,7 @@ class WSLCE2EImagePruneTests
165 bool foundDeleted = false;
166 for (const auto& line : unfilteredPrune.GetStdoutLines())
167 {
168 - if (line.find(L"Deleted:") != std::wstring::npos || line.find(L"Untagged:") != std::wstring::npos)
168 + if (line.find(L"deleted:") != std::wstring::npos || line.find(L"untagged:") != std::wstring::npos)
169 {
170 foundDeleted = true;
171 break;
test/windows/wslc/e2e/WSLCE2EInspectTests.cpp
+3 -3
@@ -154,7 +154,7 @@ class WSLCE2EInspectTests
154 auto inspectData =
155 wsl::shared::FromJson<std::vector<wsl::windows::common::wslc_schema::InspectContainer>>(result.Stdout.value().c_str());
156 VERIFY_ARE_EQUAL(1u, inspectData.size());
157 - VERIFY_ARE_EQUAL(WslcContainerName, wsl::shared::string::MultiByteToWide(inspectData[0].Name));
157 + VERIFY_ARE_EQUAL(std::format(L"/{}", WslcContainerName), wsl::shared::string::MultiByteToWide(inspectData[0].Name));
158
159 // Config.Labels must be present in the emitted JSON even when empty.
160 auto json = nlohmann::json::parse(wsl::shared::string::WideToMultiByte(result.Stdout.value()));
@@ -237,7 +237,7 @@ class WSLCE2EInspectTests
237 auto inspectData =
238 wsl::shared::FromJson<std::vector<wsl::windows::common::wslc_schema::InspectContainer>>(result.Stdout.value().c_str());
239 VERIFY_ARE_EQUAL(1u, inspectData.size());
240 - VERIFY_ARE_EQUAL(DebianImage.Name, wsl::shared::string::MultiByteToWide(inspectData[0].Name));
240 + VERIFY_ARE_EQUAL(std::format(L"/{}", DebianImage.Name), wsl::shared::string::MultiByteToWide(inspectData[0].Name));
241 }
242
243 // With --type container
@@ -247,7 +247,7 @@ class WSLCE2EInspectTests
247 auto inspectData =
248 wsl::shared::FromJson<std::vector<wsl::windows::common::wslc_schema::InspectContainer>>(result.Stdout.value().c_str());
249 VERIFY_ARE_EQUAL(1u, inspectData.size());
250 - VERIFY_ARE_EQUAL(DebianImage.Name, wsl::shared::string::MultiByteToWide(inspectData[0].Name));
250 + VERIFY_ARE_EQUAL(std::format(L"/{}", DebianImage.Name), wsl::shared::string::MultiByteToWide(inspectData[0].Name));
251 }
252
253 // With --type image