diff --git a/tests/integration/dev.bats b/tests/integration/dev.bats index 6d972335095..e1f0b418a15 100644 --- a/tests/integration/dev.bats +++ b/tests/integration/dev.bats @@ -2,15 +2,13 @@ load helpers -function setup() { - setup_busybox -} - function teardown() { teardown_bundle } @test "runc run [redundant default /dev/tty]" { + setup_busybox + update_config ' .linux.devices += [{"path": "/dev/tty", "type": "c", "major": 5, "minor": 0}] | .process.args |= ["ls", "-lLn", "/dev/tty"]' @@ -25,6 +23,8 @@ function teardown() { } @test "runc run [redundant default /dev/ptmx]" { + setup_busybox + update_config ' .linux.devices += [{"path": "/dev/ptmx", "type": "c", "major": 5, "minor": 2}] | .process.args |= ["ls", "-lLn", "/dev/ptmx"]' @@ -36,6 +36,8 @@ function teardown() { @test "runc run/update [device cgroup deny]" { requires root + setup_busybox + update_config ' .linux.resources.devices = [{"allow": false, "access": "rwm"}] | .linux.devices = [{"path": "/dev/kmsg", "type": "c", "major": 1, "minor": 11}] | .process.capabilities.bounding += ["CAP_SYSLOG"] @@ -73,6 +75,8 @@ function teardown() { @test "runc run [device cgroup allow rw char device]" { requires root + setup_busybox + update_config ' .linux.resources.devices = [{"allow": false, "access": "rwm"},{"allow": true, "type": "c", "major": 1, "minor": 11, "access": "rw"}] | .linux.devices = [{"path": "/dev/kmsg", "type": "c", "major": 1, "minor": 11}] | .process.args |= ["sh"] @@ -104,6 +108,8 @@ function teardown() { @test "runc run [device cgroup allow rm block device]" { requires root + setup_busybox + # Get the first block device. IFS=$' \t:' read -r device major minor <<<"$(lsblk -nd -o NAME,MAJ:MIN)" # Could have used -o PATH but lsblk from CentOS 7 does not have it. @@ -133,6 +139,8 @@ function teardown() { @test "runc exec vs systemctl daemon-reload" { requires systemd root + setup_busybox + runc run -d --console-socket "$CONSOLE_SOCKET" test_exec [ "$status" -eq 0 ] @@ -144,3 +152,26 @@ function teardown() { runc exec -t test_exec sh -c "ls -l /proc/self/fd/0; echo 123" [ "$status" -eq 0 ] } + +@test "runc run [hostname domainname]" { + requires root + + setup_debian + + update_config ' .process.args |= ["sh"] + | .hostname = "myhostname" + | .domainname= "mydomainname"' + + runc run -d --console-socket "$CONSOLE_SOCKET" test_allow_char + [ "$status" -eq 0 ] + + # test hostname + runc exec test_allow_char sh -c 'hostname' + [ "$status" -eq 0 ] + [[ "${lines[0]}" == *'myhostname'* ]] + + # test domainname + runc exec test_allow_char sh -c 'domainname' + [ "$status" -eq 0 ] + [[ "${lines[0]}" == *'mydomainname'* ]] +}