diff options
-rw-r--r-- | yarns/0030-basics.yarn | 6 | ||||
-rw-r--r-- | yarns/0100-fuse.yarn | 37 | ||||
-rw-r--r-- | yarns/9000-implements.yarn | 17 | ||||
-rw-r--r-- | yarns/fuse.yarn | 85 |
4 files changed, 54 insertions, 91 deletions
diff --git a/yarns/0030-basics.yarn b/yarns/0030-basics.yarn index e6bd85d2..17a21288 100644 --- a/yarns/0030-basics.yarn +++ b/yarns/0030-basics.yarn @@ -85,9 +85,3 @@ duplication. WHEN user backs up live data AND user restores their latest generation into X THEN live data, restored to X, matches manifest M - -The interesting live data generation is a step only used in the above -scenario, so we implement it here. - - IMPLEMENTS GIVEN live data with interesting filesystem objects - "$SRCDIR/mkfunnyfarm" "$LIVEDATA" diff --git a/yarns/0100-fuse.yarn b/yarns/0100-fuse.yarn new file mode 100644 index 00000000..303399d9 --- /dev/null +++ b/yarns/0100-fuse.yarn @@ -0,0 +1,37 @@ +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 is in group fuse + GIVEN live data with interesting filesystem objects + AND a manifest of live data in M + WHEN user backs up live data + AND user FUSE mounts their repository at F + THEN live data, restored to F/latest, matches manifest M + 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 FUSE mounts their repository at (\S+) + mkdir "$DATADIR/$MATCH_1" + run_obnam mount -r "$REPO" --to "$DATADIR/$MATCH_1" --viewmode multiple + +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 diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn index 2b9cccac..d43b8a28 100644 --- a/yarns/9000-implements.yarn +++ b/yarns/9000-implements.yarn @@ -46,6 +46,14 @@ specify that. mkdir -p "$LIVEDATA" "$SRCDIR/mksparse" "$LIVEDATA/$MATCH_1" "$MATCH_2" +Create some _interesting_ data, using the `mkfunnyfarm` utility. +See the utility for details, but this is about creating files and +other filesystem objects that are not the most common easy cases for +backup programs (regular files with data and no holes). + + IMPLEMENTS GIVEN live data with interesting filesystem objects + "$SRCDIR/mkfunnyfarm" "$LIVEDATA" + Manifest creation and checking ------------------------------ @@ -111,3 +119,12 @@ original one in live data. old=$(stat -c %b "$LIVEDATA/$MATCH_1") new=$(stat -c %b "$DATADIR/$MATCH_2/$LIVEDATA/$MATCH_1") test "$old" -lt "$new" + +Check on user group membership +------------------------------ + +Some tests, such as those for the FUSE plugin, require the user to be +in a specific group. + + IMPLEMENTS ASSUMING user is in group (\S+) + groups | tr ' ' '\n' | grep -Fx "$MATCH_1" diff --git a/yarns/fuse.yarn b/yarns/fuse.yarn deleted file mode 100644 index 92253d12..00000000 --- a/yarns/fuse.yarn +++ /dev/null @@ -1,85 +0,0 @@ -Black box testing for the Obnam 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 is in group fuse - GIVEN a live data directory - AND a 0 byte file called empty - AND a 1 byte file called one - AND a 4096 byte file called 4k - AND a 10485760 byte file called 10meg - AND a hardlink to 4k called 4k-hardlink - AND a symlink to 4k called 4k-symlink - AND a directory called some-dir - AND a symlink to ../4k called some-dir/other-symlink - WHEN live data is backed up - AND repository is fuse mounted - THEN latest generation can be copied correctly from fuse mount - FINALLY unmount repository - -The following sections implement the various steps. We use -`$DATADIR/live` for the live data, `$DATADIR/repo` for the repository, -and `$DATADIR/mount` as the FUSE mount point. - -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. - - IMPLEMENTS ASSUMING user is in group (\S+) - groups | tr ' ' '\n' | grep -Fx "$MATCH_1" - - IMPLEMENTS GIVEN a live data directory - mkdir "$DATADIR/live" - - IMPLEMENTS GIVEN a (\d+) byte file called (\S+) - dd if=/dev/zero of="$DATADIR/live/$MATCH_2" bs=1 count="$MATCH_1" - - IMPLEMENTS GIVEN a hardlink to (\S+) called (\S+) - ln "$DATADIR/live/$MATCH_1" "$DATADIR/live/$MATCH_2" - - IMPLEMENTS GIVEN a symlink to (\S+) called (\S+) - ln -s "$DATADIR/live/$MATCH_1" "$DATADIR/live/$MATCH_2" - - IMPLEMENTS GIVEN a directory called (\S+) - mkdir "$DATADIR/live/$MATCH_1" - -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. - -`manifest` (a shell function in `obnam.sh`) runs summain with useful -parameters. It's used twice, and the parameters need to be the same -so the results can be compared with diff. summain is a manifest tool. -`manifest` additionally mangles the mtime output to be full seconds -only: for whatever reason, the fuse mount only shows full seconds. -This may be a bug (FIXME: find out if it is). - -`run_obnam` is another shell function, which runs Obnam without the -user's configuration files. We don't want the user's configuration to -affect the test suite. - - IMPLEMENTS WHEN live data is backed up - manifest "$DATADIR/live" > "$DATADIR/live.summain" - run_obnam backup -r "$DATADIR/repo" "$DATADIR/live" - - IMPLEMENTS WHEN repository is fuse mounted - run_obnam clients -r "$DATADIR/repo" - mkdir "$DATADIR/mount" - run_obnam mount -r "$DATADIR/repo" --to "$DATADIR/mount" --viewmode multiple - - IMPLEMENTS THEN latest generation can be copied correctly from fuse mount - manifest "$DATADIR/mount/latest/$DATADIR/live" > "$DATADIR/latest.summain" - diff -u "$DATADIR/live.summain" "$DATADIR/latest.summain" - -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 - if [ -e "$DATADIR/mount" ] - then - fusermount -u "$DATADIR/mount" - fi |