summaryrefslogtreecommitdiff
path: root/yarns/0040-generations.yarn
blob: 61de6ce43eb1a1bcf3c97598de17cf6d52e30365 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Multiple backup generations
===========================

This chapter contains tests for Obnam's handling of multiple
generations: making incremental backups, forgetting generations, and
so on. We assume that backing up any individual directory tree works
fine, regardless of whether it is for the initial generation or an
incremental one. In the previous chapter for basic backups, we've
already dealt with those. This chapter focuses on generation handling
only.

Incremental backup generations (`obnam backup`)
------------------------------

First of all, most importantly, we must be able to make more than one
backup generation, and restore them. The live data in each generation
is different, but there are unchanged parts as well. For simplicity,
we'll assume that if we can do two generations, we can do any number.
It's possible that the 12765th generation might break, but that's
unlikely, and it's even less likely we'll guess it. (If it turns out
to actually happen, we'll add a regression test when we find the
problem.)

    SCENARIO backup two generations
    GIVEN 1MB of live data
    AND a manifest of live data in G1
    WHEN user backs up live data
    GIVEN 2MB of live data
    AND a manifest of live data in G2
    WHEN user backs up live data
    AND user restores generation 1 to R1
    AND user restores generation 2 to R2
    THEN live data, restored to R1, matches manifest G1
    AND live data, restored to R2, matches manifest G2

Listing generations (`obnam generations`, `obnam genids`)
-------------------

When we make some number of generations, the Obnam generation listing
commands should show that number of generations.

    SCENARIO list generations
    GIVEN 1MB of live data
    WHEN user backs up live data
    AND user backs up live data
    AND user backs up live data
    THEN user sees 3 generations
    AND user sees 3 generation ids

Listing contents of a generation (`obnam ls`)
--------------------------------

We'll assume the `obnam ls` command shows any generation.
However, there's a couple of ways of using it: either listing
everything, or only a specific directory to list.

    SCENARIO list generation content
    GIVEN 1MB of new data in directory D
    WHEN user backs up directory D
    AND user lists latest generation into all.txt
    THEN all.txt matches /.*/D/.
    WHEN user lists D in latest generation into some.txt
    THEN all lines in some.txt match (/D|Generation)

The first line of the generation listing contains the word
"Generation". Every other line should contain the directory we
requested as part of the pathname.

There was a bug in Obnam 1.5 (and possibly other versions) that
listing contents of a directory that ends in a slash (but isn't the
root directory) fails. The following is a test for that bug by
requesting `D/` to be listed, and verifying that we get at least one
line for that.

    WHEN user lists D/ in latest generation into bug.txt
    THEN some.txt matches /D

Comparing generations (`obnam diff`)
------------------------------------

FIXME.

Forgetting a specific generation (`obnam forget`)
--------------------------------

FIXME.

Forgetting generations according to a schedule (`obnam forget --keep`)
-------------------------------------------------------------

FIXME.