summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-03-21 07:32:49 +0000
committerLars Wirzenius <liw@liw.fi>2014-03-21 07:32:49 +0000
commitd5973757f5be3704823c36567dba31c04d12b733 (patch)
tree1c44870dd2091d6b1f9b8a7de6714d7e93c1371f
parent8e50f17903c2c173c3b812022c8e3e5633a9ada9 (diff)
downloadobnam-d5973757f5be3704823c36567dba31c04d12b733.tar.gz
Convert verify-notices-changes cmdtest to yarn
-rwxr-xr-xtests/verify-notices-changes.script28
-rw-r--r--tests/verify-notices-changes.stdout1
-rw-r--r--yarns/0080-verify.yarn24
-rw-r--r--yarns/9000-implements.yarn12
4 files changed, 36 insertions, 29 deletions
diff --git a/tests/verify-notices-changes.script b/tests/verify-notices-changes.script
deleted file mode 100755
index 6443c0c0..00000000
--- a/tests/verify-notices-changes.script
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-# Copyright 2011 Lars Wirzenius
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-set -e
-
-echo aaa > "$DATADIR/data/aaa"
-echo ccc > "$DATADIR/data/ccc"
-
-$SRCDIR/tests/backup
-
-touch -d "1970-01-02 03:04:05" "$DATADIR/data/aaa"
-
-$SRCDIR/tests/obnam verify "$(cat $DATADIR/rooturl)" 2>&1 |
- sed "s,$DATADIR,TMP,g" |
- sed '/st_mtime/s/([^)]*)/(...)/'
diff --git a/tests/verify-notices-changes.stdout b/tests/verify-notices-changes.stdout
deleted file mode 100644
index 3f1b241e..00000000
--- a/tests/verify-notices-changes.stdout
+++ /dev/null
@@ -1 +0,0 @@
-verify failure: RDF30DX: TMP/data/aaa: metadata change: st_mtime_sec (...)
diff --git a/yarns/0080-verify.yarn b/yarns/0080-verify.yarn
new file mode 100644
index 00000000..68a508ba
--- /dev/null
+++ b/yarns/0080-verify.yarn
@@ -0,0 +1,24 @@
+Verify backed up data
+=====================
+
+The user may want to verify that all their live data is still intact.
+This is done with `obnam verify`.
+
+ SCENARIO verify live data
+ GIVEN 100kB of new data in directory L
+ AND file L/foo has Unix timestamp 0
+ WHEN user U backs up directory L to repository R
+ AND user U attempts to verify L against repository R
+ THEN the attempt succeeded
+
+However, if there have been any changes, such as for a timestamp, then
+the verification should find a problem.
+
+ GIVEN file L/foo has Unix timestamp 1
+ WHEN user U attempts to verify L against repository R
+ THEN the attempt failed with exit code 1
+
+RDF30DX is the error code for metadata change, of which modification
+time is one.
+
+ THEN the error message matches "RDF30DX.*st_mtime_sec"
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn
index 68c852c7..25400662 100644
--- a/yarns/9000-implements.yarn
+++ b/yarns/9000-implements.yarn
@@ -260,6 +260,15 @@ We may need to restore only a single file.
--to "$DATADIR/$MATCH_3" "$DATADIR/$MATCH_2"
+Verifying live data
+-------------------
+
+Run `obnam verify` and remember the output.
+
+ IMPLEMENTS WHEN user (\S+) attempts to verify (\S+) against repository (\S+)
+ attempt run_obnam "$MATCH_1" \
+ verify -r "$DATADIR/$MATCH_3" "$DATADIR/$MATCH_2"
+
Removing (forgetting) generations
---------------------------------
@@ -413,6 +422,9 @@ The `attempt` shell function in `obnam.sh` runs a command, then
captures its stdout, stderr, and exit code. The scenarios can then
test the results in various ways as separate steps.
+ IMPLEMENTS THEN the attempt succeeded
+ attempt_exit_was 0
+
IMPLEMENTS THEN the attempt failed with exit code (\d+)
attempt_exit_was "$MATCH_1"