Skip to content

Commit ed62b7c

Browse files
benhillisBen HillisCopilot
authored
Fix tmpfs tests to use WSLC_TEST_METHOD macro (#40143)
Replace WSL2_TEST_ONLY() runtime skip macro (removed in #40129) with WSLC_TEST_METHOD metadata macro in tmpfs tests added by #40128. Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9c4dba9 commit ed62b7c

2 files changed

Lines changed: 10 additions & 30 deletions

File tree

test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,10 +1028,8 @@ class WSLCE2EContainerCreateTests
10281028
result.Verify({.Stdout = L"unable to find group badgid: no matching entries in group file\r\n", .ExitCode = 126});
10291029
}
10301030

1031-
TEST_METHOD(WSLCE2E_Container_Create_Tmpfs)
1031+
WSLC_TEST_METHOD(WSLCE2E_Container_Create_Tmpfs)
10321032
{
1033-
WSL2_TEST_ONLY();
1034-
10351033
auto result = RunWslc(std::format(
10361034
L"container create --name {} --tmpfs /wslc-tmpfs {} sh -c \"echo -n 'tmpfs_test' > /wslc-tmpfs/data && cat "
10371035
L"/wslc-tmpfs/data\"",
@@ -1043,10 +1041,8 @@ class WSLCE2EContainerCreateTests
10431041
result.Verify({.Stdout = L"tmpfs_test", .Stderr = L"", .ExitCode = 0});
10441042
}
10451043

1046-
TEST_METHOD(WSLCE2E_Container_Create_Tmpfs_With_Options)
1044+
WSLC_TEST_METHOD(WSLCE2E_Container_Create_Tmpfs_With_Options)
10471045
{
1048-
WSL2_TEST_ONLY();
1049-
10501046
auto result = RunWslc(std::format(
10511047
L"container create --name {} --tmpfs /wslc-tmpfs:size=64k {} sh -c \"mount | grep -q ' on /wslc-tmpfs type tmpfs ' "
10521048
L"&& echo mounted\"",
@@ -1058,10 +1054,8 @@ class WSLCE2EContainerCreateTests
10581054
result.Verify({.Stdout = L"mounted\n", .Stderr = L"", .ExitCode = 0});
10591055
}
10601056

1061-
TEST_METHOD(WSLCE2E_Container_Create_Tmpfs_Multiple_With_Options)
1057+
WSLC_TEST_METHOD(WSLCE2E_Container_Create_Tmpfs_Multiple_With_Options)
10621058
{
1063-
WSL2_TEST_ONLY();
1064-
10651059
auto result = RunWslc(std::format(
10661060
L"container create --name {} --tmpfs /wslc-tmpfs1:size=64k --tmpfs /wslc-tmpfs2:size=128k {} sh -c \"mount | grep -q "
10671061
L"' on /wslc-tmpfs1 type tmpfs ' && mount | grep -q ' on /wslc-tmpfs2 type tmpfs ' && echo mounted\"",
@@ -1073,19 +1067,15 @@ class WSLCE2EContainerCreateTests
10731067
result.Verify({.Stdout = L"mounted\n", .Stderr = L"", .ExitCode = 0});
10741068
}
10751069

1076-
TEST_METHOD(WSLCE2E_Container_Create_Tmpfs_RelativePath_Fails)
1070+
WSLC_TEST_METHOD(WSLCE2E_Container_Create_Tmpfs_RelativePath_Fails)
10771071
{
1078-
WSL2_TEST_ONLY();
1079-
10801072
auto result =
10811073
RunWslc(std::format(L"container create --name {} --tmpfs wslc-tmpfs {}", WslcContainerName, DebianImage.NameAndTag()));
10821074
result.Verify({.Stderr = L"invalid mount path: 'wslc-tmpfs' mount path must be absolute\r\nError code: E_FAIL\r\n", .ExitCode = 1});
10831075
}
10841076

1085-
TEST_METHOD(WSLCE2E_Container_Create_Tmpfs_EmptyDestination_Fails)
1077+
WSLC_TEST_METHOD(WSLCE2E_Container_Create_Tmpfs_EmptyDestination_Fails)
10861078
{
1087-
WSL2_TEST_ONLY();
1088-
10891079
auto result =
10901080
RunWslc(std::format(L"container create --name {} --tmpfs :size=64k {}", WslcContainerName, DebianImage.NameAndTag()));
10911081
result.Verify({.Stderr = L"invalid mount path: '' mount path must be absolute\r\nError code: E_FAIL\r\n", .ExitCode = 1});

test/windows/wslc/e2e/WSLCE2EContainerRunTests.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,51 +131,41 @@ class WSLCE2EContainerRunTests
131131
result.Verify({.Stdout = L"nobody\n65534\n65534\n", .Stderr = L"", .ExitCode = 0});
132132
}
133133

134-
TEST_METHOD(WSLCE2E_Container_Run_Tmpfs)
134+
WSLC_TEST_METHOD(WSLCE2E_Container_Run_Tmpfs)
135135
{
136-
WSL2_TEST_ONLY();
137-
138136
auto result = RunWslc(std::format(
139137
L"container run --rm --tmpfs /wslc-tmpfs {} sh -c \"echo -n 'tmpfs_test' > /wslc-tmpfs/data && cat "
140138
L"/wslc-tmpfs/data\"",
141139
DebianImage.NameAndTag()));
142140
result.Verify({.Stdout = L"tmpfs_test", .Stderr = L"", .ExitCode = 0});
143141
}
144142

145-
TEST_METHOD(WSLCE2E_Container_Run_Tmpfs_With_Options)
143+
WSLC_TEST_METHOD(WSLCE2E_Container_Run_Tmpfs_With_Options)
146144
{
147-
WSL2_TEST_ONLY();
148-
149145
auto result = RunWslc(std::format(
150146
L"container run --rm --tmpfs /wslc-tmpfs:size=64k {} sh -c \"mount | grep -q ' on /wslc-tmpfs type tmpfs ' && echo "
151147
L"mounted\"",
152148
DebianImage.NameAndTag()));
153149
result.Verify({.Stdout = L"mounted\n", .Stderr = L"", .ExitCode = 0});
154150
}
155151

156-
TEST_METHOD(WSLCE2E_Container_Run_Tmpfs_Multiple_With_Options)
152+
WSLC_TEST_METHOD(WSLCE2E_Container_Run_Tmpfs_Multiple_With_Options)
157153
{
158-
WSL2_TEST_ONLY();
159-
160154
auto result = RunWslc(std::format(
161155
L"container run --rm --tmpfs /wslc-tmpfs1:size=64k --tmpfs /wslc-tmpfs2:size=128k {} sh -c \"mount | grep -q ' on "
162156
L"/wslc-tmpfs1 type tmpfs ' && mount | grep -q ' on /wslc-tmpfs2 type tmpfs ' && echo mounted\"",
163157
DebianImage.NameAndTag()));
164158
result.Verify({.Stdout = L"mounted\n", .Stderr = L"", .ExitCode = 0});
165159
}
166160

167-
TEST_METHOD(WSLCE2E_Container_Run_Tmpfs_RelativePath_Fails)
161+
WSLC_TEST_METHOD(WSLCE2E_Container_Run_Tmpfs_RelativePath_Fails)
168162
{
169-
WSL2_TEST_ONLY();
170-
171163
auto result = RunWslc(std::format(L"container run --rm --tmpfs wslc-tmpfs {}", DebianImage.NameAndTag()));
172164
result.Verify({.Stderr = L"invalid mount path: 'wslc-tmpfs' mount path must be absolute\r\nError code: E_FAIL\r\n", .ExitCode = 1});
173165
}
174166

175-
TEST_METHOD(WSLCE2E_Container_Run_Tmpfs_EmptyDestination_Fails)
167+
WSLC_TEST_METHOD(WSLCE2E_Container_Run_Tmpfs_EmptyDestination_Fails)
176168
{
177-
WSL2_TEST_ONLY();
178-
179169
auto result = RunWslc(std::format(L"container run --rm --tmpfs :size=64k {}", DebianImage.NameAndTag()));
180170
result.Verify({.Stderr = L"invalid mount path: '' mount path must be absolute\r\nError code: E_FAIL\r\n", .ExitCode = 1});
181171
}

0 commit comments

Comments
 (0)