diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-12-04 15:27:11 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-12-04 15:27:11 +0000 |
commit | 4640a881c2263cc2cfcb6a0ed3f75170e93284da (patch) | |
tree | 380772642233794e697fd7d3d558a6196c98420a | |
parent | a3f3f96bf7abb4baa254055d746f6ac62aafef4f (diff) | |
download | obnam-4640a881c2263cc2cfcb6a0ed3f75170e93284da.tar.gz |
Add basic backup test
-rw-r--r-- | yarns/0010-introduction.yarn | 6 | ||||
-rw-r--r-- | yarns/0030-basics.yarn | 24 | ||||
-rw-r--r-- | yarns/9000-implements.yarn | 61 | ||||
-rw-r--r-- | yarns/obnam.sh | 7 |
4 files changed, 91 insertions, 7 deletions
diff --git a/yarns/0010-introduction.yarn b/yarns/0010-introduction.yarn index c305f1de..e65c8824 100644 --- a/yarns/0010-introduction.yarn +++ b/yarns/0010-introduction.yarn @@ -43,9 +43,6 @@ FIXME: Outline of test suite This chapter will be removed, later, when all the outlined parts have been implemented. -* Basic operation: backup, restore, verify - - all types, sizes of files with all kinds of metadata - - single generation * Multiple generations - multiple generations - forget, individual generations @@ -78,9 +75,6 @@ been implemented. - list clients * System administration - nagios-last-backup-age -* Test implementation - - shell library - - generic implements for all tests Open questions: diff --git a/yarns/0030-basics.yarn b/yarns/0030-basics.yarn new file mode 100644 index 00000000..7cdc3ba7 --- /dev/null +++ b/yarns/0030-basics.yarn @@ -0,0 +1,24 @@ +Basic operation: backup and restore +=================================== + +This chapter tests the basic operation of Obnam: backing up and +restoring data. Tests in this chapter only concern themselves with a +single generation; see later for tests for multiple generations. + +The goal of this chapter is to test Obnam with every kind of data, +every kind of file, and every kind of metadata. + +Backup simple data +------------------ + +This is the simplest of all simple backup tests: generate a small +amount of data in regular files, in a single directory, and backup +that. No symlinks, no empty files, no extended attributes, no nothing. +Just a few files with a bit of data in each. This is what every backup +program must be able to handle. + + SCENARIO backup simple data + GIVEN 100kB of live data + WHEN user backs up live data + THEN user can restore their data correctly + AND user can fsck the repository diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn new file mode 100644 index 00000000..41b6db4d --- /dev/null +++ b/yarns/9000-implements.yarn @@ -0,0 +1,61 @@ +Test implementation +=================== + +This chapter documents the generic, shared IMPLEMENTS sections for +steps that are used in a variety of scenarios. It also discusses the +shell library that may be used by all IMPLEMENTS sections. + +The shell library +----------------- + +The shell library contains shell functions and sets some shell +variables that can be used by any IMPLEMENTS sections. + +Variables: + +* `LIVEDATA`: the pathname of the directory where live data is stored + (for single-client scenarios). +* `REPO`: the pathname of the backup repository. + +Functions: + +* `run_obnam`: run Obnam from the source tree, ignoring any + system-wide or user configuration and using only the configuration + specified by the test suite itself (`--no-default-config`). Run in + quiet mode (`--quiet`). + +Live data generation +-------------------- + +The simplest way to generate test live data is to just generate the +necessary number of bytes, split over some number of files. This works +for single-client scenarios. + + IMPLEMENTS GIVEN (\S+) of live data + genbackupdata --quiet --create "$MATCH_1" "$LIVEDATA" + +Backing up and verifying a backup +--------------------------------- + +The simplest way to run a backup, for single-client scenarios. In +addition to backing up, this makes a manifest of the data. + + IMPLEMENTS WHEN user backs up live data + manifest "$LIVEDATA" > "$DATADIR/manifest" + run_obnam backup -r "$REPO" "$LIVEDATA" + +Verifying a backup requires restoring the data, and checking that the +restored data matches the backed up data. The check generates a new +manifest, and compares that with the one from the time of the backup. + + IMPLEMENTS THEN user can restore their data correctly + rm -rf "$DATADIR/restored" + run_obnam restore -r "$REPO" --to "$DATADIR/restored" + manifest "$LIVEDATA" > "$DATADIR/restored.manifest" + diff -u "$DATADIR/manifest" "$DATADIR/restored.manifest" + +We further verify that the repository itself is OK, by running +`obnam fsck` on it. + + IMPLEMENTS THEN user can fsck the repository + run_obnam fsck -r "$REPO" diff --git a/yarns/obnam.sh b/yarns/obnam.sh index eafc8b8d..2375db0a 100644 --- a/yarns/obnam.sh +++ b/yarns/obnam.sh @@ -16,12 +16,17 @@ # =*= License: GPL-3+ =*= +# Set variables to help referring to common things in $DATADIR. +LIVEDATA="$DATADIR/live-data" +REPO="$DATADIR/repo" + + # Run Obnam in a safe way that ignore's any configuration files outside # the test. run_obnam() { - "$SRCDIR/obnam" --no-default-config "$@" + "$SRCDIR/obnam" --no-default-config --quiet "$@" } |