File: 0100-fuse.yarn

package info (click to toggle)
obnam 1.21-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 2,032 kB
  • ctags: 2,505
  • sloc: python: 14,404; sh: 410; ansic: 252; makefile: 66; awk: 5
file content (79 lines) | stat: -rw-r--r-- 2,935 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
FUSE plugin
===========

The FUSE plugin gives read-only access to a backup repository.
There's a lot of potential corner cases here, but for now, this
test suite concentrates on verifying that at least the basics work.

    SCENARIO Browsing backups with FUSE plugin
    ASSUMING user can use FUSE
    AND extended attributes are allowed for users
    GIVEN directory L with interesting filesystem objects
    AND a manifest of L in M
    WHEN user U backs up directory L to repository R
    AND user U FUSE mounts the repository R at F
    THEN L, restored to F/latest, matches manifest M

The FUSE view of the repository won't change while we have it mounted,
even if we make a new backup.

    GIVEN 100k of new data in directory L
    AND a manifest of L in M2
    WHEN user U backs up directory L to repository R
    THEN L, restored to F/latest, matches manifest M

However, if we read the file `F/.pid`, the FUSE plugin refreshes the
view and we can now see the new backup.

    WHEN user U reads file F/.pid
    THEN L, restored to F/latest, matches manifest M2

Clean up.

    FINALLY unmount repository F

In 2014, for Obnam 1.7, a bug was reported that the FUSE plugin would
only read the first 64 kilobytes of a file. Verify that this is no
longer a problem.

    SCENARIO restoring a big file with FUSE
    ASSUMING user can use FUSE
    GIVEN 1M of data in file L/big.dat
    AND a manifest of L in M
    WHEN user U backs up directory L to repository R
    AND user U FUSE mounts the repository R at F
    THEN L, restored to F/latest, matches manifest M
    AND big.dat in L and in mounted F compare equally
    FINALLY unmount repository F

We can only run this test if the user is in the `fuse` group. This may
be a portability concern: this works in Debian GNU/Linux, but might be
different in other Linux distros, or on non-Linux systems. (If it
doesn't work for you, please report a bug.)

We do the backup, and verify that it can be accessed correctly, by
doing a manifest of the live data before the backup, and then
against the FUSE mount, and comparing the two manifests.

    IMPLEMENTS WHEN user (\S+) FUSE mounts the repository (\S+) at (\S+)
    mkdir "$DATADIR/$MATCH_3"
    run_obnam "$MATCH_1" mount -r "$DATADIR/$MATCH_2" \
        --to "$DATADIR/$MATCH_3"

We also check a specific file by comparing it in the mount and in its
original location. We do the comparison with cmp(1) instead of the
usual way, because this triggered a bug.

    IMPLEMENTS THEN (\S+) in (\S+) and in mounted (\S+) compare equally
    cmp \
        "$DATADIR/$MATCH_2/$MATCH_1" \
        "$DATADIR/$MATCH_3/latest/$DATADIR/$MATCH_2/$MATCH_1"

If we did do the fuse mount, **always** unmount it, even when a step
failed. We do not want failed test runs to leavo mounts lying around.

    IMPLEMENTS FINALLY unmount repository (\S+)
    if [ -e "$DATADIR/$MATCH_1" ]
    then
        fusermount -u "$DATADIR/$MATCH_1"
    fi