summaryrefslogtreecommitdiff
path: root/yarns/9000-implements.yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-01-12 10:29:02 +0000
committerLars Wirzenius <liw@liw.fi>2014-01-12 10:29:02 +0000
commitdff58cd5e33003fdf3eb73549c450b76838c6cbe (patch)
tree747c820bab9f2465815971227f3ab51d0335e681 /yarns/9000-implements.yarn
parente65bdd1e04d01f3ef1e842f10d52e261050b599e (diff)
downloadobnam-dff58cd5e33003fdf3eb73549c450b76838c6cbe.tar.gz
Add test for multiple clients sharing a repository
As part of this, make every repository operation step require an explicit client name. The v6 reference formats have a client name embedded that is the hostname of my laptop, so make those tests use that name. This fixes what would not have run previously on any system that isn't named havelock. Oops.
Diffstat (limited to 'yarns/9000-implements.yarn')
-rw-r--r--yarns/9000-implements.yarn73
1 files changed, 40 insertions, 33 deletions
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn
index ee35a4f9..1de44c15 100644
--- a/yarns/9000-implements.yarn
+++ b/yarns/9000-implements.yarn
@@ -20,7 +20,8 @@ Functions:
* `run_obnam`: run Obnam from the source tree, ignoring any
system-wide or user configuration and using only the configuration
specified by the test suite itself (`--no-default-config`). Run in
- quiet mode (`--quiet`).
+ quiet mode (`--quiet`). The first argument to `run_obnam` is the
+ client name.
* `manifest`: run summain in a way that produces a useable manifest,
which can be compared with diff with a later manifest.
@@ -87,13 +88,13 @@ Backing up
The simplest way to run a backup, for single-client scenarios. In
addition to backing up, this makes a manifest of the data.
- IMPLEMENTS WHEN user backs up directory (\S+) to repository (\S+)
- run_obnam backup -r "$DATADIR/$MATCH_2" "$DATADIR/$MATCH_1"
+ IMPLEMENTS WHEN user (\S+) backs up directory (\S+) to repository (\S+)
+ run_obnam "$MATCH_1" backup -r "$DATADIR/$MATCH_3" "$DATADIR/$MATCH_2"
We can also just pretend to make a backup.
- IMPLEMENTS WHEN user pretends to back up directory (\S+) to repository (\S+)
- run_obnam backup --pretend -r "$DATADIR/$MATCH_2" "$DATADIR/$MATCH_1"
+ IMPLEMENTS WHEN user (\S+) pretends to back up directory (\S+) to repository (\S+)
+ run_obnam "$MATCH_1" backup --pretend -r "$DATADIR/$MATCH_3" "$DATADIR/$MATCH_2"
fsck'ing a repository
---------------------
@@ -101,73 +102,79 @@ fsck'ing a repository
Verify that the repository itself is OK, by running `obnam fsck` on
it.
- IMPLEMENTS THEN user can fsck the repository (\S+)
- run_obnam fsck -r "$DATADIR/$MATCH_1"
+ IMPLEMENTS THEN user (\S+) can fsck the repository (\S+)
+ run_obnam "$MATCH_1" fsck -r "$DATADIR/$MATCH_2"
Restoring data
--------------
We need a way to restore data from a test backup repository.
- IMPLEMENTS WHEN user restores their latest generation in repository (\S+) into (\S+)
- run_obnam restore -r "$DATADIR/$MATCH_1" --to "$DATADIR/$MATCH_2"
+ IMPLEMENTS WHEN user (\S+) restores their latest generation in repository (\S+) into (\S+)
+ run_obnam "$MATCH_1" restore -r "$DATADIR/$MATCH_2" --to "$DATADIR/$MATCH_3"
Restore a specific generation. The generation number is an ordinal in
the list of generations, not the "generation id" Obnam assigns, as
that is unpredictable.
- IMPLEMENTS WHEN user restores generation (\d+) to (\S+) from repository (\S+)
- id=$(run_obnam -r "$DATADIR/$MATCH_3" genids |
- awk -v "n=$MATCH_1" 'NR == n')
- run_obnam restore -r "$DATADIR/$MATCH_3" \
- --to "$DATADIR/$MATCH_2" --generation "$id"
+ IMPLEMENTS WHEN user (\S+) restores generation (\d+) to (\S+) from repository (\S+)
+ client="$MATCH_1"
+ gen="$MATCH_2"
+ to="$DATADIR/$MATCH_3"
+ repo="$DATADIR/$MATCH_4"
+ id=$(run_obnam "$client" -r "$repo" genids |
+ awk -v "n=$gen" 'NR == n')
+ run_obnam "$client" restore -r "$repo" \
+ --to "$to" --generation "$id"
Removing (forgetting) generations
---------------------------------
Remove the oldest generation.
- IMPLEMENTS WHEN user forgets the oldest generation in repository (\S+)
+ IMPLEMENTS WHEN user (\S+) forgets the oldest generation in repository (\S+)
# The grep below at the end of pipeline is there to make sure
# the pipeline fails if there were no generations.
- id=$(run_obnam -r "$DATADIR/$MATCH_1" genids | head -n1 | grep .)
- run_obnam forget -r "$DATADIR/$MATCH_1" "$id"
+ id=$(run_obnam "$MATCH_1" -r "$DATADIR/$MATCH_2" genids |
+ head -n1 | grep .)
+ run_obnam "$MATCH_1" forget -r "$DATADIR/$MATCH_2" "$id"
Remove according to a `--keep` schedule.
- IMPLEMENTS WHEN user forgets according to schedule (\S+) in repository (\S+)
- run_obnam forget -r "$DATADIR/$MATCH_2" --keep "$MATCH_1"
+ IMPLEMENTS WHEN user (\S+) forgets according to schedule (\S+) in repository (\S+)
+ run_obnam "$MATCH_1" forget -r "$DATADIR/$MATCH_3" --keep "$MATCH_2"
List generations
----------------
List everything in a generation. Capture the listing in a named file.
- IMPLEMENTS WHEN user lists latest generation in repository (\S+) into (\S+)
- run_obnam ls -r "$DATADIR/$MATCH_1" > "$DATADIR/$MATCH_2"
+ IMPLEMENTS WHEN user (\S+) lists latest generation in repository (\S+) into (\S+)
+ run_obnam "$MATCH_1" ls -r "$DATADIR/$MATCH_2" > "$DATADIR/$MATCH_3"
List only parts of a generation. Again, capture in a named file.
- IMPLEMENTS WHEN user lists (\S+) in latest generation in repository (\S+) into (\S+)
- run_obnam ls -r "$DATADIR/$MATCH_2" "$DATADIR/$MATCH_1" > "$DATADIR/$MATCH_3"
+ IMPLEMENTS WHEN user (\S+) lists (\S+) in latest generation in repository (\S+) into (\S+)
+ run_obnam "$MATCH_1" ls -r "$DATADIR/$MATCH_3" "$DATADIR/$MATCH_2" > "$DATADIR/$MATCH_4"
Checks on generations
---------------------
Check that number of generations is correct.
- IMPLEMENTS THEN user sees (\d+) generation(s?) in repository (\S+)
- run_obnam generations -r "$DATADIR/$MATCH_3" > "$DATADIR/generation.list"
+ IMPLEMENTS THEN user (\S+) sees (\d+) generation(s?) in repository (\S+)
+ run_obnam "$MATCH_1" generations -r "$DATADIR/$MATCH_4" \
+ > "$DATADIR/generation.list"
n=$(wc -l < "$DATADIR/generation.list")
- test "$MATCH_1" = "$n"
+ test "$MATCH_2" = "$n"
Ditto for generation ids.
- IMPLEMENTS THEN user sees (\d+) generation ids in repository (\S+)
- run_obnam generations -r "$DATADIR/$MATCH_2" \
+ IMPLEMENTS THEN user (\S+) sees (\d+) generation ids in repository (\S+)
+ run_obnam "$MATCH_1" generations -r "$DATADIR/$MATCH_3" \
> "$DATADIR/generation-id.list"
n=$(wc -l < "$DATADIR/generation-id.list")
- test "$MATCH_1" = "$n"
+ test "$MATCH_2" = "$n"
Diffs between generations
-------------------------
@@ -176,10 +183,10 @@ Compute the difference between two generations. The generations are
identified by the ordinal, not generation id, since the ids are
unpredictable.
- IMPLEMENTS WHEN user diffs generations (\d+) and (\d+) in repository (\S+) into (\S+)
- id1=$(run_obnam -r "$DATADIR/$MATCH_3" genids | awk -v "n=$MATCH_1" 'NR == n')
- id2=$(run_obnam -r "$DATADIR/$MATCH_3" genids | awk -v "n=$MATCH_2" 'NR == n')
- run_obnam diff -r "$DATADIR/$MATCH_3" "$id1" "$id2" > "$DATADIR/$MATCH_4"
+ IMPLEMENTS WHEN user (\S+) diffs generations (\d+) and (\d+) in repository (\S+) into (\S+)
+ id1=$(run_obnam "$MATCH_1" -r "$DATADIR/$MATCH_4" genids | awk -v "n=$MATCH_2" 'NR == n')
+ id2=$(run_obnam "$MATCH_1" -r "$DATADIR/$MATCH_4" genids | awk -v "n=$MATCH_3" 'NR == n')
+ run_obnam "$MATCH_1" diff -r "$DATADIR/$MATCH_4" "$id1" "$id2" > "$DATADIR/$MATCH_5"
Checks on files
---------------