File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,6 +148,27 @@ func TestLinuxSandboxContainerSpec(t *testing.T) {
148148 })
149149 },
150150 },
151+ {
152+ desc : "spec shouldn't have ping_group_range if userns are in use" ,
153+ configChange : func (c * runtime.PodSandboxConfig ) {
154+ c .Linux .SecurityContext = & runtime.LinuxSandboxSecurityContext {
155+ NamespaceOptions : & runtime.NamespaceOption {
156+ UsernsOptions : & runtime.UserNamespace {
157+ Mode : runtime .NamespaceMode_POD ,
158+ Uids : []* runtime.IDMapping {& idMap },
159+ Gids : []* runtime.IDMapping {& idMap },
160+ },
161+ },
162+ }
163+ },
164+ specCheck : func (t * testing.T , spec * runtimespec.Spec ) {
165+ require .NotNil (t , spec .Linux )
166+ assert .Contains (t , spec .Linux .Namespaces , runtimespec.LinuxNamespace {
167+ Type : runtimespec .UserNamespace ,
168+ })
169+ assert .NotContains (t , spec .Linux .Sysctl ["net.ipv4.ping_group_range" ], "0 2147483647" )
170+ },
171+ },
151172 {
152173 desc : "host namespace" ,
153174 configChange : func (c * runtime.PodSandboxConfig ) {
You can’t perform that action at this time.
0 commit comments