diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-07-23 21:53:33 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-07-25 14:26:08 +0300 |
commit | f22994cc99017f5aeab809a406b0c5d1940fd5a8 (patch) | |
tree | e648f8030a960c5b58bba684b24ada96656e8978 /yarns/9000-implements.yarn | |
parent | ae75b2e27545126818a3116b98d1c87a04aeeb5e (diff) | |
download | obnam-f22994cc99017f5aeab809a406b0c5d1940fd5a8.tar.gz |
Add scenario for repo with lost chunks
Diffstat (limited to 'yarns/9000-implements.yarn')
-rw-r--r-- | yarns/9000-implements.yarn | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn index 56f96912..204611cf 100644 --- a/yarns/9000-implements.yarn +++ b/yarns/9000-implements.yarn @@ -114,6 +114,28 @@ Sometimes we need to remove a file. IMPLEMENTS WHEN user (\S+) removes file (\S+) rm -f "$DATADIR/$MATCH_2" +Copy a file. + + IMPLEMENTS GIVEN a copy of (.+) in (.+) + mkdir -p "$DATADIR/$(dirname "$MATCH_2")" + cp -a "$DATADIR/$MATCH_1" "$DATADIR/$MATCH_2" + +Reset a repository's chunk files. + + IMPLEMENTS WHEN repository (.+) resets its chunks to those in (.+) + r1="$DATADIR/$MATCH_1" + r2="$DATADIR/$MATCH_2" + if [ -e "$r1/chunks" ] + then + # format 6 + rm -rf "$r1/chunks" + cp -a "$r2/chunks" "$r1/." + else + rm -rf "$r1/chunk-store" + cp -a "$r2/chunk-store" "$r1/." + fi + + Manifest creation and checking ------------------------------ @@ -327,6 +349,15 @@ Remove the oldest generation. head -n1 | grep .) run_obnam "$MATCH_1" forget -r "$DATADIR/$MATCH_2" "$id" +Remove the newest generation. + + IMPLEMENTS WHEN user (\S+) forgets their latest 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 "$MATCH_1" -r "$DATADIR/$MATCH_2" genids | + tail -n1 | grep .) + run_obnam "$MATCH_1" forget -r "$DATADIR/$MATCH_2" "$id" + Remove according to a `--keep` schedule. IMPLEMENTS WHEN user (\S+) forgets according to schedule (\S+) in repository (\S+) @@ -598,6 +629,12 @@ by the user. IMPLEMENTS WHEN user (\S+) reads file (\S+) cat "$DATADIR/$MATCH_2" +Does a restored file match what's in live data? + + IMPLEMENTS THEN file (.+), restored to (.+), matches live data + cmp "$DATADIR/$MATCH_1" "$DATADIR/$MATCH_2/$DATADIR/$MATCH_1" + + Check on user running test suite -------------------------------- |