File tree Expand file tree Collapse file tree 3 files changed +74
-0
lines changed Expand file tree Collapse file tree 3 files changed +74
-0
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,23 @@ var CGroup = &test.Requirement{
171171 },
172172}
173173
174+ var CgroupsAccessible = test .Require (
175+ CGroup ,
176+ & test.Requirement {
177+ Check : func (data test.Data , helpers test.Helpers ) (ret bool , mess string ) {
178+ isRootLess := getTarget () == targetNerdctl && rootlessutil .IsRootless ()
179+ if isRootLess {
180+ stdout := helpers .Capture ("info" , "--format" , "{{ json . }}" )
181+ var dinf dockercompat.Info
182+ err := json .Unmarshal ([]byte (stdout ), & dinf )
183+ assert .NilError (helpers .T (), err , "failed to parse docker info" )
184+ return dinf .CgroupVersion == "2" , "we are rootless, and cgroup version is not 2"
185+ }
186+ return true , ""
187+ },
188+ },
189+ )
190+
174191// Soci requires that the soci snapshotter is enabled
175192var Soci = & test.Requirement {
176193 Check : func (data test.Data , helpers test.Helpers ) (ret bool , mess string ) {
Original file line number Diff line number Diff line change 1+ //go:build !windows
2+
3+ /*
4+ Copyright The containerd Authors.
5+
6+ Licensed under the Apache License, Version 2.0 (the "License");
7+ you may not use this file except in compliance with the License.
8+ You may obtain a copy of the License at
9+
10+ http://www.apache.org/licenses/LICENSE-2.0
11+
12+ Unless required by applicable law or agreed to in writing, software
13+ distributed under the License is distributed on an "AS IS" BASIS,
14+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+ See the License for the specific language governing permissions and
16+ limitations under the License.
17+ */
18+
19+ package nerdtest
20+
21+ import (
22+ "github.com/containerd/nerdctl/v2/pkg/testutil/test"
23+ )
24+
25+ var HyperV = & test.Requirement {
26+ Check : func (data test.Data , helpers test.Helpers ) (ret bool , mess string ) {
27+ return false , "HyperV is a windows-only feature"
28+ },
29+ }
Original file line number Diff line number Diff line change 1+ /*
2+ Copyright The containerd Authors.
3+
4+ Licensed under the Apache License, Version 2.0 (the "License");
5+ you may not use this file except in compliance with the License.
6+ You may obtain a copy of the License at
7+
8+ http://www.apache.org/licenses/LICENSE-2.0
9+
10+ Unless required by applicable law or agreed to in writing, software
11+ distributed under the License is distributed on an "AS IS" BASIS,
12+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ See the License for the specific language governing permissions and
14+ limitations under the License.
15+ */
16+
17+ package nerdtest
18+
19+ import (
20+ "github.com/containerd/nerdctl/v2/pkg/testutil"
21+ "github.com/containerd/nerdctl/v2/pkg/testutil/test"
22+ )
23+
24+ var HyperV = & test.Requirement {
25+ Check : func (data test.Data , helpers test.Helpers ) (ret bool , mess string ) {
26+ return testutil .HyperVSupported (), "HyperV is not enabled, skipping test"
27+ },
28+ }
You can’t perform that action at this time.
0 commit comments