summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-03-19 19:01:59 +0000
committerLars Wirzenius <liw@liw.fi>2014-03-19 19:01:59 +0000
commit8e50f17903c2c173c3b812022c8e3e5633a9ada9 (patch)
treecd8c23851710b747cc9898080eec746eaa6dea0a /yarns
parenta08e9b1b2a892ebafdc627d099766d859c0b8ae2 (diff)
downloadobnam-8e50f17903c2c173c3b812022c8e3e5633a9ada9.tar.gz
Add scenario for testing --keep=4h style schedule
Diffstat (limited to 'yarns')
-rw-r--r--yarns/0040-generations.yarn66
-rw-r--r--yarns/9000-implements.yarn14
2 files changed, 79 insertions, 1 deletions
diff --git a/yarns/0040-generations.yarn b/yarns/0040-generations.yarn
index 69bc4a03..871adcb7 100644
--- a/yarns/0040-generations.yarn
+++ b/yarns/0040-generations.yarn
@@ -158,6 +158,72 @@ The normal way of forgetting generations is with the `obnam forget
WHEN user U restores their latest generation in repository R into X
THEN L, restored to X, matches manifest M
+There has been reports that the "keep N hourly backups" type of
+`--keep` policy doesn't work. Test this by creating several
+generations, pretending the time is something specific, and then check
+that the right ones get kept. For each calendar hour, we make two
+generations, and we create them for every other calendar hour, for
+four such hours (covering a total of eight hours). We then keep two
+hourly backups. This should result in the later of each backup during
+a calendar hour to be kept, for the last two calendar hours.
+
+ SCENARIO keep N hourly generations
+
+The first generation of the first hour.
+
+ GIVEN user U sets configuration pretend-time to 2014-03-19 01:00:00
+ AND 1kB of new data in directory L
+ WHEN user U backs up directory L to repository R
+
+The second generation of the first hour.
+
+ GIVEN user U sets configuration pretend-time to 2014-03-19 01:30:00
+ AND 1kB of new data in directory L
+ WHEN user U backs up directory L to repository R
+
+The first generation of the second hour.
+
+ GIVEN user U sets configuration pretend-time to 2014-03-19 02:00:00
+ AND 1kB of new data in directory L
+ WHEN user U backs up directory L to repository R
+
+The second generation of the second hour.
+
+ GIVEN user U sets configuration pretend-time to 2014-03-19 02:30:00
+ AND 1kB of new data in directory L
+ WHEN user U backs up directory L to repository R
+
+The first generation of the third hour.
+
+ GIVEN user U sets configuration pretend-time to 2014-03-19 03:00:00
+ AND 1kB of new data in directory L
+ WHEN user U backs up directory L to repository R
+
+The second generation of the third hour.
+
+ GIVEN user U sets configuration pretend-time to 2014-03-19 03:30:00
+ AND 1kB of new data in directory L
+ WHEN user U backs up directory L to repository R
+
+The first generation of the fourth hour.
+
+ GIVEN user U sets configuration pretend-time to 2014-03-19 04:00:00
+ AND 1kB of new data in directory L
+ WHEN user U backs up directory L to repository R
+
+The second generation of the fourth hour.
+
+ GIVEN user U sets configuration pretend-time to 2014-03-19 04:30:00
+ AND 1kB of new data in directory L
+ WHEN user U backs up directory L to repository R
+
+Now run the forget and verify.
+
+ WHEN user U forgets according to schedule 2h in repository R
+ THEN user U sees 2 generations in repository R
+ AND user U has 1st generation timestamp 2014-03-19 03:30:00 in repository R
+ AND user U has 2nd generation timestamp 2014-03-19 04:30:00 in repository R
+
Dnn't really forget anything if pretending
------------------------------------------
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn
index f742bdf2..68c852c7 100644
--- a/yarns/9000-implements.yarn
+++ b/yarns/9000-implements.yarn
@@ -190,7 +190,7 @@ someone else.
Add a setting to a client's configuration file.
- IMPLEMENTS GIVEN user (\S+) sets configuration (\S+) to (\S+)
+ IMPLEMENTS GIVEN user (\S+) sets configuration (\S+) to (.*)
add_to_config "$MATCH_1" "$MATCH_2" "$MATCH_3"
Backing up
@@ -332,6 +332,18 @@ Check that there are no checkpoint generations.
exit 1
fi
+Check timestamps of specific generations.
+
+ IMPLEMENTS THEN user (\S+) has (\d+)(st|nd|rd|th) generation timestamp (.*) in repository (\S+)
+ run_obnam "$MATCH_1" generations -r "$DATADIR/$MATCH_5" |
+ sed -n "${MATCH_2}p" |
+ awk -v "T=$MATCH_4" '
+ ($2 " " $3) != T {
+ print "Fail to match: " $0
+ exit 1
+ }
+ '
+
Diffs between generations
-------------------------