@@ -215,7 +215,9 @@ systemd_cgroup = true
215215[containerd.default_runtime]
216216 runtime_type = "` + linuxRuntime + `"
217217[containerd.runtimes.runc]
218- runtime_type = "` + runcRuntime + `"
218+ runtime_type = "` + runcRuntimeV1 + `"
219+ [containerd.runtimes.runcv2]
220+ runtime_type = "` + runcRuntimeV2 + `"
219221`
220222 nonNilOpts := `
221223systemd_cgroup = true
@@ -227,30 +229,41 @@ systemd_cgroup = true
227229 Runtime = "default"
228230 RuntimeRoot = "/default"
229231[containerd.runtimes.runc]
230- runtime_type = "` + runcRuntime + `"
232+ runtime_type = "` + runcRuntimeV1 + `"
231233[containerd.runtimes.runc.options]
232234 BinaryName = "runc"
233235 Root = "/runc"
234236 NoNewKeyring = true
237+ [containerd.runtimes.runcv2]
238+ runtime_type = "` + runcRuntimeV2 + `"
239+ [containerd.runtimes.runcv2.options]
240+ BinaryName = "runc"
241+ Root = "/runcv2"
242+ NoNewKeyring = true
235243`
236244 var nilOptsConfig , nonNilOptsConfig criconfig.Config
237245 _ , err := toml .Decode (nilOpts , & nilOptsConfig )
238246 require .NoError (t , err )
239247 _ , err = toml .Decode (nonNilOpts , & nonNilOptsConfig )
240248 require .NoError (t , err )
241- require .Len (t , nilOptsConfig .Runtimes , 1 )
242- require .Len (t , nonNilOptsConfig .Runtimes , 1 )
249+ require .Len (t , nilOptsConfig .Runtimes , 2 )
250+ require .Len (t , nonNilOptsConfig .Runtimes , 2 )
243251
244252 for desc , test := range map [string ]struct {
245253 r criconfig.Runtime
246254 c criconfig.Config
247255 expectedOptions interface {}
248256 }{
249- "when options is nil, should return nil option for non legacy runtime " : {
257+ "when options is nil, should return nil option for io.containerd.runc.v1 " : {
250258 r : nilOptsConfig .Runtimes ["runc" ],
251259 c : nilOptsConfig ,
252260 expectedOptions : nil ,
253261 },
262+ "when options is nil, should return nil option for io.containerd.runc.v2" : {
263+ r : nilOptsConfig .Runtimes ["runcv2" ],
264+ c : nilOptsConfig ,
265+ expectedOptions : nil ,
266+ },
254267 "when options is nil, should use legacy fields for legacy runtime" : {
255268 r : nilOptsConfig .DefaultRuntime ,
256269 c : nilOptsConfig ,
@@ -267,6 +280,15 @@ systemd_cgroup = true
267280 NoNewKeyring : true ,
268281 },
269282 },
283+ "when options is not nil, should be able to decode for io.containerd.runc.v2" : {
284+ r : nonNilOptsConfig .Runtimes ["runcv2" ],
285+ c : nonNilOptsConfig ,
286+ expectedOptions : & runcoptions.Options {
287+ BinaryName : "runc" ,
288+ Root : "/runcv2" ,
289+ NoNewKeyring : true ,
290+ },
291+ },
270292 "when options is not nil, should be able to decode for legacy runtime" : {
271293 r : nonNilOptsConfig .DefaultRuntime ,
272294 c : nonNilOptsConfig ,
0 commit comments