...
1#!/usr/bin/env bats
2
3load helpers
4
5function setup() {
6 # Create a ro fuse-sshfs mount; skip the test if it's not working.
7 local sshfs="sshfs
8 -o UserKnownHostsFile=/dev/null
9 -o StrictHostKeyChecking=no
10 -o PasswordAuthentication=no"
11
12 DIR="$BATS_RUN_TMPDIR/fuse-sshfs"
13 mkdir -p "$DIR"
14
15 if ! $sshfs -o ro rootless@localhost: "$DIR"; then
16 skip "test requires working sshfs mounts"
17 fi
18
19 setup_busybox
20 update_config '.process.args = ["/bin/echo", "Hello World"]'
21}
22
23function teardown() {
24 # New distros (Fedora 35) do not have fusermount installed
25 # as a dependency of fuse-sshfs, and good ol' umount works.
26 fusermount -u "$DIR" || umount "$DIR"
27
28 teardown_bundle
29}
30
31@test "runc run [rw bind mount of a ro fuse sshfs mount]" {
32 update_config ' .mounts += [{
33 type: "bind",
34 source: "'"$DIR"'",
35 destination: "/mnt",
36 options: ["rw", "rprivate", "nosuid", "nodev", "rbind"]
37 }]'
38
39 runc run test_busybox
40 [ "$status" -eq 0 ]
41}
View as plain text