summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2013-12-06 14:09:53 +0000
committerLars Wirzenius <liw@liw.fi>2013-12-06 14:09:53 +0000
commit83ab008674af1a1240111fa806517b73f23b1b23 (patch)
tree7292a7a87fbcfe286ff52c2b8423b7948f503944
parentcfb79fc07a9c0ba3ec93a0f25b5e02369b281cc8 (diff)
downloadobnam-83ab008674af1a1240111fa806517b73f23b1b23.tar.gz
Add a scenario test for "obnam forget"
-rw-r--r--yarns/0040-generations.yarn19
-rw-r--r--yarns/9000-implements.yarn13
2 files changed, 30 insertions, 2 deletions
diff --git a/yarns/0040-generations.yarn b/yarns/0040-generations.yarn
index a5ac5fa2..ccf9994f 100644
--- a/yarns/0040-generations.yarn
+++ b/yarns/0040-generations.yarn
@@ -103,7 +103,24 @@ We'll assume the diff works, we'll just check whether it's empty.
Forgetting a specific generation (`obnam forget`)
--------------------------------
-FIXME.
+We need to be able to remove any generation. As a corner case, we
+should be able to remove the only generation. We'll test by making two
+generations, then removing both, and after removing the first one,
+checking that the remaining one is the one we want.
+
+ SCENARIO remove specific generations
+ GIVEN 1kB of new data in directory L
+ AND a manifest of directory L in M1
+ WHEN user backs up directory L
+ GIVEN 1kB of new data in directory L
+ AND a manifest of directory L in M2
+ WHEN user backs up directory L
+ AND user forgets the oldest generation
+ THEN user sees 1 generation
+ WHEN user restores their latest generation into X
+ THEN L, restored to X, matches manifest M2
+ WHEN user forgets the oldest generation
+ THEN user sees 0 generations
Forgetting generations according to a schedule (`obnam forget --keep`)
-------------------------------------------------------------
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn
index 956e8df5..57abe745 100644
--- a/yarns/9000-implements.yarn
+++ b/yarns/9000-implements.yarn
@@ -110,6 +110,17 @@ that is unpredictable.
id=$(run_obnam -r "$REPO" genids | awk -v "n=$MATCH_1" 'NR == n')
run_obnam restore -r "$REPO" --to "$DATADIR/$MATCH_2" --generation "$id"
+Removing (forgetting) generations
+---------------------------------
+
+Remove the oldest generation.
+
+ IMPLEMENTS WHEN user forgets the oldest generation
+ # 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"
+
List generations
----------------
@@ -128,7 +139,7 @@ Checks on generations
Check that number of generations is correct.
- IMPLEMENTS THEN user sees (\d+) generations
+ IMPLEMENTS THEN user sees (\d+) generation(s?)
run_obnam generations -r "$REPO" > "$DATADIR/generation.list"
n=$(wc -l < "$DATADIR/generation.list")
test "$MATCH_1" = "$n"