github.com/vrothberg/storage@v1.12.13/tests/mount-layer.bats (about) 1 #!/usr/bin/env bats 2 3 load helpers 4 5 @test "mount-layer" { 6 # Create a layer. 7 run storage --debug=false create-layer 8 [ "$status" -eq 0 ] 9 [ "$output" != "" ] 10 layer="$output" 11 12 # Mount the layer. 13 run storage --debug=false mount $layer 14 [ "$status" -eq 0 ] 15 [ "$output" != "" ] 16 # Check if layer is mounted. 17 run storage --debug=false mounted $layer 18 [ "$status" -eq 0 ] 19 [ "$output" == "$layer mounted" ] 20 # Unmount the layer. 21 run storage --debug=false unmount $layer 22 [ "$status" -eq 0 ] 23 [ "$output" != "" ] 24 # Make sure layer is not mounted. 25 run storage --debug=false mounted $layer 26 [ "$status" -eq 0 ] 27 [ "$output" == "" ] 28 29 # Mount the layer twice. 30 run storage --debug=false mount $layer 31 [ "$status" -eq 0 ] 32 [ "$output" != "" ] 33 run storage --debug=false mount $layer 34 [ "$status" -eq 0 ] 35 [ "$output" != "" ] 36 # Check if layer is mounted. 37 run storage --debug=false mounted $layer 38 [ "$status" -eq 0 ] 39 [ "$output" == "$layer mounted" ] 40 # Unmount the second layer. 41 run storage --debug=false unmount $layer 42 [ "$status" -eq 0 ] 43 [ "$output" == "" ] 44 # Check if layer is mounted. 45 run storage --debug=false mounted $layer 46 [ "$status" -eq 0 ] 47 [ "$output" == "$layer mounted" ] 48 # Unmount the first layer. 49 run storage --debug=false unmount $layer 50 [ "$status" -eq 0 ] 51 [ "$output" != "" ] 52 # Make sure layer is not mounted. 53 run storage --debug=false mounted $layer 54 [ "$status" -eq 0 ] 55 [ "$output" == "" ] 56 57 58 # Mount the layer twice and force umount. 59 run storage --debug=false mount $layer 60 [ "$status" -eq 0 ] 61 [ "$output" != "" ] 62 run storage --debug=false mount $layer 63 [ "$status" -eq 0 ] 64 [ "$output" != "" ] 65 # Check if layer is mounted. 66 run storage --debug=false mounted $layer 67 [ "$status" -eq 0 ] 68 [ "$output" == "$layer mounted" ] 69 # Unmount all layers. 70 run storage --debug=false unmount --force $layer 71 [ "$status" -eq 0 ] 72 [ "$output" != "" ] 73 # Make sure no layers are mounted. 74 run storage --debug=false mounted $layer 75 [ "$status" -eq 0 ] 76 [ "$output" == "" ] 77 78 # Mount the layer with nosuid 79 run storage --debug=false mount --option nosuid $layer 80 [ "$status" -ne 0 ] 81 82 # Delete the first layer 83 run storage delete-layer $layer 84 [ "$status" -eq 0 ] 85 }