github.com/opencontainers/runc@v1.2.0-rc.1.0.20240520010911-492dc558cdd6/tests/integration/scheduler.bats (about)

     1  #!/usr/bin/env bats
     2  
     3  load helpers
     4  
     5  function setup() {
     6  	requires root
     7  	setup_debian
     8  }
     9  
    10  function teardown() {
    11  	teardown_bundle
    12  }
    13  
    14  @test "scheduler is applied" {
    15  	update_config ' .process.scheduler = {"policy": "SCHED_DEADLINE", "nice": 19, "priority": 0, "runtime": 42000, "deadline": 1000000, "period": 1000000, }'
    16  
    17  	runc run -d --console-socket "$CONSOLE_SOCKET" test_scheduler
    18  	[ "$status" -eq 0 ]
    19  
    20  	runc exec test_scheduler chrt -p 1
    21  	[ "$status" -eq 0 ]
    22  
    23  	[[ "${lines[0]}" == *"scheduling policy: SCHED_DEADLINE" ]]
    24  	[[ "${lines[1]}" == *"priority: 0" ]]
    25  	[[ "${lines[2]}" == *"runtime/deadline/period parameters: 42000/1000000/1000000" ]]
    26  }
    27  
    28  @test "scheduler vs cpus" {
    29  	update_config ' .linux.resources.cpu.cpus = "0"
    30  		| .process.scheduler = {"policy": "SCHED_DEADLINE", "nice": 19, "runtime": 42000, "deadline": 1000000, "period": 1000000, }'
    31  
    32  	runc run -d --console-socket "$CONSOLE_SOCKET" test_scheduler
    33  	[ "$status" -eq 1 ]
    34  }