@@ -263,26 +263,26 @@ EOF
263
263
runc run -d --console-socket " $CONSOLE_SOCKET " test_update
264
264
[ " $status " -eq 0 ]
265
265
266
- # check that initial values were properly set
267
- check_cpu_quota 500000 1000000 " 500ms "
266
+ # Check that initial values were properly set.
267
+ check_cpu_quota 500000 1000000
268
268
check_cpu_shares 100
269
269
270
- # update cpu period
270
+ # Update cpu period.
271
271
runc update test_update --cpu-period 900000
272
272
[ " $status " -eq 0 ]
273
- check_cpu_quota 500000 900000 " 560ms "
273
+ check_cpu_quota 500000 900000
274
274
275
- # update cpu quota
275
+ # Update cpu quota.
276
276
runc update test_update --cpu-quota 600000
277
277
[ " $status " -eq 0 ]
278
- check_cpu_quota 600000 900000 " 670ms "
278
+ check_cpu_quota 600000 900000
279
279
280
- # remove cpu quota
280
+ # Remove cpu quota.
281
281
runc update test_update --cpu-quota -1
282
282
[ " $status " -eq 0 ]
283
- check_cpu_quota -1 900000 " infinity "
283
+ check_cpu_quota -1 900000
284
284
285
- # update cpu-shares
285
+ # Update cpu-shares.
286
286
runc update test_update --cpu-share 200
287
287
[ " $status " -eq 0 ]
288
288
check_cpu_shares 200
@@ -298,21 +298,21 @@ EOF
298
298
}
299
299
EOF
300
300
[ " $status " -eq 0 ]
301
- check_cpu_quota 500000 1000000 " 500ms "
301
+ check_cpu_quota 500000 1000000
302
302
303
- # redo all the changes at once
303
+ # Redo all the changes at once.
304
304
runc update test_update \
305
305
--cpu-period 900000 --cpu-quota 600000 --cpu-share 200
306
306
[ " $status " -eq 0 ]
307
- check_cpu_quota 600000 900000 " 670ms "
307
+ check_cpu_quota 600000 900000
308
308
check_cpu_shares 200
309
309
310
- # remove cpu quota and reset the period
310
+ # Remove cpu quota and reset the period.
311
311
runc update test_update --cpu-quota -1 --cpu-period 100000
312
312
[ " $status " -eq 0 ]
313
- check_cpu_quota -1 100000 " infinity "
313
+ check_cpu_quota -1 100000
314
314
315
- # reset to initial test value via json file
315
+ # Reset to initial test values via json file.
316
316
cat << EOF >"$BATS_RUN_TMPDIR "/runc-cgroups-integration-test.json
317
317
{
318
318
"cpu": {
326
326
327
327
runc update -r " $BATS_RUN_TMPDIR " /runc-cgroups-integration-test.json test_update
328
328
[ " $status " -eq 0 ]
329
- check_cpu_quota 500000 1000000 " 500ms "
329
+ check_cpu_quota 500000 1000000
330
330
check_cpu_shares 100
331
331
}
332
332
363
363
runc run -d --console-socket " $CONSOLE_SOCKET " test_update
364
364
[ " $status " -eq 0 ]
365
365
366
- check_cpu_quota -1 1000000 " infinity "
366
+ check_cpu_quota -1 1000000
367
367
}
368
368
369
369
@test " set cpu period with no quota (invalid period)" {
382
382
383
383
runc run -d --console-socket " $CONSOLE_SOCKET " test_update
384
384
[ " $status " -eq 0 ]
385
- check_cpu_quota 5000 100000 " 50ms "
385
+ check_cpu_quota 5000 100000
386
386
}
387
387
388
388
@test " update cpu period with no previous period/quota set" {
@@ -393,10 +393,10 @@ EOF
393
393
runc run -d --console-socket " $CONSOLE_SOCKET " test_update
394
394
[ " $status " -eq 0 ]
395
395
396
- # update the period alone, no old values were set
396
+ # Update the period alone, no old values were set.
397
397
runc update --cpu-period 50000 test_update
398
398
[ " $status " -eq 0 ]
399
- check_cpu_quota -1 50000 " infinity "
399
+ check_cpu_quota -1 50000
400
400
}
401
401
402
402
@test " update cpu quota with no previous period/quota set" {
@@ -407,10 +407,10 @@ EOF
407
407
runc run -d --console-socket " $CONSOLE_SOCKET " test_update
408
408
[ " $status " -eq 0 ]
409
409
410
- # update the quota alone, no old values were set
410
+ # Update the quota alone, no old values were set.
411
411
runc update --cpu-quota 30000 test_update
412
412
[ " $status " -eq 0 ]
413
- check_cpu_quota 30000 100000 " 300ms "
413
+ check_cpu_quota 30000 100000
414
414
}
415
415
416
416
@test " update cpu period in a pod cgroup with pod limit set" {
445
445
# Finally, the test itself: set 30% limit but with lower period.
446
446
runc update --cpu-period 10000 --cpu-quota 3000 test_update
447
447
[ " $status " -eq 0 ]
448
- check_cpu_quota 3000 10000 " 300ms "
448
+ check_cpu_quota 3000 10000
449
449
}
450
450
451
451
@test " update cgroup cpu.idle" {
545
545
runc run -d --console-socket " $CONSOLE_SOCKET " test_update
546
546
[ " $status " -eq 0 ]
547
547
548
- # check that initial values were properly set
549
- check_cpu_quota 500000 1000000 " 500ms "
550
- # initial cpu shares of 100 corresponds to weight of 4
548
+ # Check that initial values were properly set.
549
+ check_cpu_quota 500000 1000000
550
+ # Initial cpu shares of 100 corresponds to weight of 4.
551
551
check_cpu_weight 4
552
552
check_systemd_value " TasksMax" 20
553
553
561
561
}
562
562
EOF
563
563
564
- # check the updated systemd unit properties
565
- check_cpu_quota -1 100000 " infinity "
564
+ # Check the updated systemd unit properties.
565
+ check_cpu_quota -1 100000
566
566
check_cpu_weight 16
567
567
check_systemd_value " TasksMax" 10
568
568
}
0 commit comments