diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-12-12 08:06:50 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-12-12 08:06:50 +0000 |
commit | 57b85f1d11c8972cd056a339c29e28ab3b91137c (patch) | |
tree | ea211c1abb40cf03645a0cc658dc6878e0af910f | |
parent | 5d30c9bd7f89e0423d0be1e624a5be0f7c7fae2f (diff) | |
parent | d44a1fc45b8f5953f06c13ef3a2936a31fe2a740 (diff) | |
download | obnam2-57b85f1d11c8972cd056a339c29e28ab3b91137c.tar.gz |
Merge branch 'metatests' into 'main'
Metatests
See merge request larswirzenius/obnam!36
-rw-r--r-- | obnam.md | 57 | ||||
-rw-r--r-- | subplot/data.py | 4 | ||||
-rw-r--r-- | subplot/data.yaml | 3 |
3 files changed, 63 insertions, 1 deletions
@@ -488,7 +488,12 @@ then HTTP status code is 404 ~~~ -# Smoke test for Obnam as a whole +# Acceptance criteria for Obnam as a whole + +The scenarios in this chapter apply to Obnam as a whole: the client +and server working together. + +## Smoke test for backup and restore This scenario verifies that a small amount of data in simple files in one directory can be backed up and restored, and the restored files @@ -515,6 +520,56 @@ root: live ~~~ +## Back up regular file + +The scenarios in this section back up a single regular file each, and +verify that is metadata is restored correctly. There is a separate +scenario for each bit of metadata so that it's clear what fails, if +anything. + +All these scenarios use the following configuration file. + +~~~{#metadata.yaml .file .yaml .numberLines} +root: live +~~~ + +### Modification time + +This scenario verifies that the modification time is restored correctly. + +~~~scenario +given an installed obnam +and a running chunk server +and a client config based on metadata.yaml +and a file live/data.dat containing some random data +and a manifest of the directory live in live.yaml +when I run obnam backup metadata.yaml +then backup generation is GEN +when I invoke obnam restore metadata.yaml <GEN> rest +given a manifest of the directory live restored in rest in rest.yaml +then files live.yaml and rest.yaml match +~~~ + +### Mode bits + +This scenario verifies that the mode ("permission") bits are restored +correctly. + +~~~scenario +given an installed obnam +and a running chunk server +and a client config based on metadata.yaml +and a file live/data.dat containing some random data +and file live/data.dat has mode 464 +and a manifest of the directory live in live.yaml +when I run obnam backup metadata.yaml +then backup generation is GEN +when I invoke obnam restore metadata.yaml <GEN> rest +given a manifest of the directory live restored in rest in rest.yaml +then files live.yaml and rest.yaml match +~~~ + + diff --git a/subplot/data.py b/subplot/data.py index 9eadd3f..09df6c5 100644 --- a/subplot/data.py +++ b/subplot/data.py @@ -13,6 +13,10 @@ def create_file_with_random_data(ctx, filename=None): f.write(data) +def chmod_file(ctx, filename=None, mode=None): + os.chmod(filename, int(mode, 8)) + + def create_manifest_of_live(ctx, dirname=None, manifest=None): _create_manifest_of_directory(ctx, dirname=dirname, manifest=manifest) diff --git a/subplot/data.yaml b/subplot/data.yaml index 4f9871a..3b4d938 100644 --- a/subplot/data.yaml +++ b/subplot/data.yaml @@ -6,6 +6,9 @@ - given: "a file {filename} containing some random data" function: create_file_with_random_data +- given: file {filename} has mode {mode} + function: chmod_file + - given: a manifest of the directory {dirname} in {manifest} function: create_manifest_of_live |