diff options
-rw-r--r-- | yarns/0030-basics.yarn | 44 | ||||
-rw-r--r-- | yarns/0040-generations.yarn | 10 | ||||
-rw-r--r-- | yarns/0050-multiple-clients.yarn | 8 | ||||
-rw-r--r-- | yarns/0060-encryption.yarn | 6 | ||||
-rw-r--r-- | yarns/0100-fuse.yarn | 2 | ||||
-rw-r--r-- | yarns/9000-implements.yarn | 15 | ||||
-rw-r--r-- | yarns/obnam.sh | 2 |
7 files changed, 56 insertions, 31 deletions
diff --git a/yarns/0030-basics.yarn b/yarns/0030-basics.yarn index 34cad9d2..ae553c14 100644 --- a/yarns/0030-basics.yarn +++ b/yarns/0030-basics.yarn @@ -19,7 +19,7 @@ program must be able to handle. SCENARIO backup simple data GIVEN 100kB of new data in directory L - AND a manifest of directory L in M + AND a manifest of L in M WHEN user U backs up directory L to repository R AND user U restores their latest generation in repository R into X THEN L, restored to X, matches manifest M @@ -46,7 +46,7 @@ more disk space than the one in live data. SCENARIO backup a sparse file GIVEN a file S in L, with a hole, data, a hole - AND a manifest of directory L in M + AND a manifest of L in M WHEN user U backs up directory L to repository R AND user U restores their latest generation in repository R into X THEN L, restored to X, matches manifest M @@ -81,7 +81,20 @@ duplication. SCENARIO backup non-basic filesystem objects GIVEN directory L with interesting filesystem objects - AND a manifest of directory L in M + AND a manifest of L in M + WHEN user U backs up directory L to repository R + AND user U restores their latest generation in repository R into X + THEN L, restored to X, matches manifest M + +As a special case, Obnam needs to notice when only an extended +attribute value changes. + + SCENARIO backup notices when extended attribute value changes + GIVEN a file F in L, with data + AND file L/F has extended attribute user.foo set to foo + WHEN user U backs up directory L to repository R + GIVEN file L/F has extended attribute user.foo set to bar + AND a manifest of L in M WHEN user U backs up directory L to repository R AND user U restores their latest generation in repository R into X THEN L, restored to X, matches manifest M @@ -95,8 +108,8 @@ assume that if we can backup two, then it'll all work well. SCENARIO backup two roots GIVEN directory L1 with interesting filesystem objects AND directory L2 with interesting filesystem objects - AND a manifest of directory L1 in M1 - AND a manifest of directory L2 in M2 + AND a manifest of L1 in M1 + AND a manifest of L2 in M2 WHEN user U backs up directories L1 and L2 to repository R AND user U restores their latest generation in repository R into X THEN L1, restored to X, matches manifest M1 @@ -117,16 +130,17 @@ backup, if the backup finishes successfully. Restore a single file --------------------- -We need to be able to restore only a single file. +We need to be able to restore only a single file. Note that when +restoring a single file, we do not set the parent directory's +modification time according to the backup, so we need to manipulate +the manifest to avoid getting an error. SCENARIO restore a single file GIVEN a file F in L, with data - AND a manifest of directory L in M - AND 100kB of new data in directory L - AND manifest M has Mtime for the first entry set from L + AND a manifest of L/F in M WHEN user U backs up directory L to repository R AND user U restores file L/F to X from their latest generation in repository R - THEN L, restored to X, matches manifest M + THEN L/F, restored to X, matches manifest M Pretend backing up: the `--pretend` setting ------------------------------------------- @@ -139,9 +153,9 @@ than a real one. SCENARIO a pretend backup GIVEN directory L with interesting filesystem objects WHEN user U backs up directory L to repository R - GIVEN a manifest of directory R in M1 + GIVEN a manifest of R in M1 WHEN user U pretends to back up directory L to repository R - GIVEN a manifest of directory R in M2 + GIVEN a manifest of R in M2 THEN manifests M1 and M2 match Exclude cache directories @@ -162,7 +176,7 @@ The directory `L` now contains what we want to restore: only the wanted data, no cache directory. This is a good time to create the manifest. - AND a manifest of directory L in M + AND a manifest of L in M We now create the cache directory and tag it. Then we backup, excluding caches, and restore, and verify. However, there's a snag: @@ -203,7 +217,7 @@ create one. Test that such timestamps work. SCENARIO pre-epoch timestamps GIVEN file L/file has Unix timestamp -3600 - AND a manifest of directory L in M + AND a manifest of L in M WHEN user U backs up directory L to repository R AND user U restores their latest generation in repository R into X THEN L, restored to X, matches manifest M @@ -220,7 +234,7 @@ setting to a new size, the backup should still work. AND user U sets configuration node-size to 65536 WHEN user U backs up directory L to repository R GIVEN 100Kb of new data in directory L - AND a manifest of directory L in M + AND a manifest of L in M AND user U sets configuration node-size to 4096 WHEN user U backs up directory L to repository R AND user U restores their latest generation in repository R into X diff --git a/yarns/0040-generations.yarn b/yarns/0040-generations.yarn index 9c741b4d..7da4f1fb 100644 --- a/yarns/0040-generations.yarn +++ b/yarns/0040-generations.yarn @@ -23,10 +23,10 @@ problem.) SCENARIO backup two generations GIVEN 1MB of new data in directory L - AND a manifest of directory L in G1 + AND a manifest of L in G1 WHEN user U backs up directory L to repository R GIVEN 2MB of new data in directory L - AND a manifest of directory L in G2 + AND a manifest of L in G2 WHEN user U backs up directory L to repository R AND user U restores generation 1 to R1 from repository R AND user U restores generation 2 to R2 from repository R @@ -110,10 +110,10 @@ 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 + AND a manifest of L in M1 WHEN user U backs up directory L to repository R GIVEN 1kB of new data in directory L - AND a manifest of directory L in M2 + AND a manifest of L in M2 WHEN user U backs up directory L to repository R AND user U forgets the oldest generation in repository R THEN user U sees 1 generation in repository R @@ -132,7 +132,7 @@ The normal way of forgetting generations is with the `obnam forget GIVEN 1kB of new data in directory L WHEN user U backs up directory L to repository R GIVEN 1kB of new data in directory L - AND a manifest of directory L in M + AND a manifest of L in M WHEN user U backs up directory L to repository R AND user U forgets according to schedule 1y in repository R THEN user U sees 1 generation in repository R diff --git a/yarns/0050-multiple-clients.yarn b/yarns/0050-multiple-clients.yarn index f80ba88a..0cacd464 100644 --- a/yarns/0050-multiple-clients.yarn +++ b/yarns/0050-multiple-clients.yarn @@ -14,8 +14,8 @@ suite we do not test concurrency at all. SCENARIO two clients sharing a repository GIVEN directory L1 with interesting filesystem objects AND directory L2 with interesting filesystem objects - AND a manifest of directory L1 in M1 - AND a manifest of directory L2 in M2 + AND a manifest of L1 in M1 + AND a manifest of L2 in M2 WHEN user U1 backs up directory L1 to repository R WHEN user U2 backs up directory L2 to repository R AND user U1 restores their latest generation in repository R into X1 @@ -28,8 +28,8 @@ a change to both sets of live data, and GIVEN 1kB of new data in directory L1 AND 2kB of new data in directory L2 - AND a manifest of directory L1 in M1A - AND a manifest of directory L2 in M2A + AND a manifest of L1 in M1A + AND a manifest of L2 in M2A WHEN user U1 backs up directory L1 to repository R AND user U2 backs up directory L2 to repository R AND user U1 forgets the oldest generation in repository R diff --git a/yarns/0060-encryption.yarn b/yarns/0060-encryption.yarn index 8f7d9b8e..dbdc4c1d 100644 --- a/yarns/0060-encryption.yarn +++ b/yarns/0060-encryption.yarn @@ -41,7 +41,7 @@ that encryption is done at the I/O abstraction level. SCENARIO basic encrypted backup and restore GIVEN user U uses encryption key "Test Key One" from test-data/keyring-1 AND directory L with interesting filesystem objects - AND a manifest of directory L in M + AND a manifest of L in M WHEN user U backs up directory L to repository R AND user U restores their latest generation in repository R into X THEN L, restored to X, matches manifest M @@ -85,11 +85,11 @@ Then we make a backup as the second client. Let's make sure both clients can still restore their own data. - GIVEN a manifest of directory L1 in M1 + GIVEN a manifest of L1 in M1 WHEN user U1 restores their latest generation in repository R into X1 THEN L1, restored to X1, matches manifest M1 - GIVEN a manifest of directory L2 in M2 + GIVEN a manifest of L2 in M2 WHEN user U2 restores their latest generation in repository R into X2 THEN L2, restored to X2, matches manifest M2 diff --git a/yarns/0100-fuse.yarn b/yarns/0100-fuse.yarn index 8efe3e40..ef6736d9 100644 --- a/yarns/0100-fuse.yarn +++ b/yarns/0100-fuse.yarn @@ -8,7 +8,7 @@ test suite concentrates on verifying that at least the basics work. SCENARIO Browsing backups with FUSE plugin ASSUMING user is in group fuse GIVEN directory L with interesting filesystem objects - AND a manifest of directory L in M + AND a manifest of L in M WHEN user U backs up directory L to repository R AND user U FUSE mounts the repository R at F THEN L, restored to F/latest, matches manifest M diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn index 65a6f2f3..2932373b 100644 --- a/yarns/9000-implements.yarn +++ b/yarns/9000-implements.yarn @@ -82,6 +82,11 @@ UTC format, as is common in Unix. os.utime(filename, (timestamp, timestamp)) ' +We need to manipulate extended attributes. + + IMPLEMENTS GIVEN file (\S+) has extended attribute (\S+) set to (\S+) + mkdir -p $(dirname "$DATADIR/$MATCH_1") + setfattr --name="$MATCH_2" --value "$MATCH_3" "$DATADIR/$MATCH_1" Manifest creation and checking ------------------------------ @@ -91,7 +96,7 @@ that naming of the manifest is explicit. This reduces the need to debug weird test suite bugs, when an automatic or implicit manifest naming goes wrong. - IMPLEMENTS GIVEN a manifest of directory (\S+) in (\S+) + IMPLEMENTS GIVEN a manifest of (\S+) in (\S+) manifest "$DATADIR/$MATCH_1" > "$DATADIR/$MATCH_2" We need to check a directory tree against an existing manifest. We do @@ -101,8 +106,14 @@ see what the temporary manifest actually contains. Being able to look at the actual file is easier than trying to interpret complicated diffs. +We remove the restore directory prefix from the manifest (the `Name:` +field that Summain outputs). This is necessary so that comparisons +with **diff**(1) will work well. + IMPLEMENTS THEN (\S+), restored to (\S+), matches manifest (\S+) - manifest "$DATADIR/$MATCH_2/$DATADIR/$MATCH_1" > "$DATADIR/temp-manifest" + manifest "$DATADIR/$MATCH_2/$DATADIR/$MATCH_1" | + sed "s*$DATADIR/$MATCH_2/**" > "$DATADIR/temp-manifest" + diff -u "$DATADIR/$MATCH_3" "$DATADIR/temp-manifest" rm -f "$DATADIR/temp-manifest" diff --git a/yarns/obnam.sh b/yarns/obnam.sh index f05393b2..55fc2336 100644 --- a/yarns/obnam.sh +++ b/yarns/obnam.sh @@ -121,7 +121,7 @@ normalise_manifest_times() } -# Create a manifest with summain of a directory. +# Create a manifest with summain of a file or a directory. manifest() { |