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

     1  #!/usr/bin/env bats
     2  
     3  load helpers
     4  
     5  function setup() {
     6  	requires root
     7  	setup_busybox
     8  }
     9  
    10  function teardown() {
    11  	[ ! -v ROOT ] && return 0 # nothing to teardown
    12  
    13  	# XXX runc does not unmount a container which
    14  	# shares mount namespace with the host.
    15  	umount -R --lazy "$ROOT"/bundle/rootfs
    16  
    17  	teardown_bundle
    18  }
    19  
    20  @test "runc run [host mount ns + hooks]" {
    21  	update_config '	  .process.args = ["/bin/echo", "Hello World"]
    22  			| .hooks |= . + {"createRuntime": [{"path": "/bin/sh", "args": ["/bin/sh", "-c", "touch createRuntimeHook.$$"]}]}
    23  			| .linux.namespaces -= [{"type": "mount"}]
    24  			| .linux.maskedPaths = []
    25  			| .linux.readonlyPaths = []'
    26  	runc run test_host_mntns
    27  	[ "$status" -eq 0 ]
    28  	runc delete -f test_host_mntns
    29  
    30  	# There should be one such file.
    31  	run -0 ls createRuntimeHook.*
    32  	[ "$(echo "$output" | wc -w)" -eq 1 ]
    33  }