diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-01-11 20:26:51 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-01-11 20:26:51 +0000 |
commit | e65bdd1e04d01f3ef1e842f10d52e261050b599e (patch) | |
tree | 64da6264799ada721b40a682c79f9c5500215545 /yarns/9000-implements.yarn | |
parent | 05842d105dca9e20d6c26b50bb78c60ab05e102d (diff) | |
download | obnam-e65bdd1e04d01f3ef1e842f10d52e261050b599e.tar.gz |
Add yarn test for pretend backups
Remove cmdtest test for this.
To make things clearer in the new test, also change all the steps that
use a backup repository to have the user specify it explicitly.
Diffstat (limited to 'yarns/9000-implements.yarn')
-rw-r--r-- | yarns/9000-implements.yarn | 65 |
1 files changed, 39 insertions, 26 deletions
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn index e711c6a3..ee35a4f9 100644 --- a/yarns/9000-implements.yarn +++ b/yarns/9000-implements.yarn @@ -76,14 +76,24 @@ diffs. diff -u "$DATADIR/$MATCH_3" "$DATADIR/temp-manifest" rm -f "$DATADIR/temp-manifest" +We may also need to check two manifests against each other. + + IMPLEMENTS THEN manifests (\S+) and (\S+) match + diff -u "$DATADIR/$MATCH_1" "$DATADIR/$MATCH_2" + 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+) - run_obnam backup -r "$REPO" "$DATADIR/$MATCH_1" + IMPLEMENTS WHEN user backs up directory (\S+) to repository (\S+) + run_obnam backup -r "$DATADIR/$MATCH_2" "$DATADIR/$MATCH_1" + +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" fsck'ing a repository --------------------- @@ -91,68 +101,71 @@ fsck'ing a repository Verify that the repository itself is OK, by running `obnam fsck` on it. - IMPLEMENTS THEN user can fsck the repository - run_obnam fsck -r "$REPO" + IMPLEMENTS THEN user can fsck the repository (\S+) + run_obnam fsck -r "$DATADIR/$MATCH_1" Restoring data -------------- We need a way to restore data from a test backup repository. - IMPLEMENTS WHEN user restores their latest generation into (\S+) - run_obnam restore -r "$REPO" --to "$DATADIR/$MATCH_1" + IMPLEMENTS WHEN user restores their latest generation in repository (\S+) into (\S+) + run_obnam restore -r "$DATADIR/$MATCH_1" --to "$DATADIR/$MATCH_2" 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+) - id=$(run_obnam -r "$REPO" genids | awk -v "n=$MATCH_1" 'NR == n') - run_obnam restore -r "$REPO" --to "$DATADIR/$MATCH_2" --generation "$id" + 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" Removing (forgetting) generations --------------------------------- Remove the oldest generation. - IMPLEMENTS WHEN user forgets the oldest generation + IMPLEMENTS WHEN user 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 "$REPO" genids | head -n1 | grep .) - run_obnam forget -r "$REPO" "$id" + id=$(run_obnam -r "$DATADIR/$MATCH_1" genids | head -n1 | grep .) + run_obnam forget -r "$DATADIR/$MATCH_1" "$id" Remove according to a `--keep` schedule. - IMPLEMENTS WHEN user forgets according to schedule (\S+) - run_obnam forget -r "$REPO" --keep "$MATCH_1" + IMPLEMENTS WHEN user forgets according to schedule (\S+) in repository (\S+) + run_obnam forget -r "$DATADIR/$MATCH_2" --keep "$MATCH_1" List generations ---------------- List everything in a generation. Capture the listing in a named file. - IMPLEMENTS WHEN user lists latest generation into (\S+) - run_obnam ls -r "$REPO" > "$DATADIR/$MATCH_1" + IMPLEMENTS WHEN user lists latest generation in repository (\S+) into (\S+) + run_obnam ls -r "$DATADIR/$MATCH_1" > "$DATADIR/$MATCH_2" List only parts of a generation. Again, capture in a named file. - IMPLEMENTS WHEN user lists (\S+) in latest generation into (\S+) - run_obnam ls -r "$REPO" "$DATADIR/$MATCH_1" > "$DATADIR/$MATCH_2" + 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" Checks on generations --------------------- Check that number of generations is correct. - IMPLEMENTS THEN user sees (\d+) generation(s?) - run_obnam generations -r "$REPO" > "$DATADIR/generation.list" + IMPLEMENTS THEN user sees (\d+) generation(s?) in repository (\S+) + run_obnam generations -r "$DATADIR/$MATCH_3" > "$DATADIR/generation.list" n=$(wc -l < "$DATADIR/generation.list") test "$MATCH_1" = "$n" Ditto for generation ids. - IMPLEMENTS THEN user sees (\d+) generation ids - run_obnam generations -r "$REPO" > "$DATADIR/generation-id.list" + IMPLEMENTS THEN user sees (\d+) generation ids in repository (\S+) + run_obnam generations -r "$DATADIR/$MATCH_2" \ + > "$DATADIR/generation-id.list" n=$(wc -l < "$DATADIR/generation-id.list") test "$MATCH_1" = "$n" @@ -163,10 +176,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+) into (\S+) - id1=$(run_obnam -r "$REPO" genids | awk -v "n=$MATCH_1" 'NR == n') - id2=$(run_obnam -r "$REPO" genids | awk -v "n=$MATCH_2" 'NR == n') - run_obnam diff -r "$REPO" "$id1" "$id2" > "$DATADIR/$MATCH_3" + 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" Checks on files --------------- |