summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-15 06:29:08 +0000
committerLars Wirzenius <liw@liw.fi>2021-09-15 06:29:08 +0000
commit036fa96e9dce91de6b07a427d56c22eadb838016 (patch)
tree020b525c2eabeab98e38e9a1b8104bd491a53f62
parent2107fccc5a82216263e5b2d90b40b0e1db0e5430 (diff)
parentd0b1e2c845fb0b63e4611c2806c7d038c6ef775d (diff)
downloadobnam2-036fa96e9dce91de6b07a427d56c22eadb838016.tar.gz
Merge branch 'fix-subplot' into 'main'
fix Subplot bindings for new Subplot See merge request obnam/obnam!178
-rw-r--r--obnam.md66
-rw-r--r--subplot/client.yaml50
-rw-r--r--subplot/data.yaml80
-rw-r--r--subplot/server.yaml76
4 files changed, 183 insertions, 89 deletions
diff --git a/obnam.md b/obnam.md
index 1a24d7a..e314e6d 100644
--- a/obnam.md
+++ b/obnam.md
@@ -1,3 +1,33 @@
+---
+title: "Obnam2&mdash;a backup system"
+author: Lars Wirzenius
+documentclass: report
+bindings:
+ - subplot/server.yaml
+ - subplot/client.yaml
+ - subplot/data.yaml
+ - lib/files.yaml
+ - lib/runcmd.yaml
+template: python
+functions:
+ - subplot/server.py
+ - subplot/client.py
+ - subplot/data.py
+ - lib/daemon.py
+ - lib/files.py
+ - lib/runcmd.py
+classes:
+ - json
+abstract: |
+ Obnam is a backup system, consisting of a not very smart server for
+ storing chunks of backup data, and a client that splits the user's
+ data into chunks. They communicate via HTTP.
+
+ This document describes the architecture and acceptance criteria for
+ Obnam, as well as how the acceptance criteria are verified.
+...
+
+
# Introduction
Obnam2 is a backup system.
@@ -1803,39 +1833,3 @@ made, the passphrase is not stored in cleartext on the server.
Verify that the backup repository does not contain the backed up data
in cleartext.
-
-
-<!-- -------------------------------------------------------------------- -->
-
-# Colophon
-
-This manual is edited in Markdown and typeset using [Subplot][].
-
----
-title: "Obnam2&mdash;a backup system"
-author: Lars Wirzenius
-documentclass: report
-bindings:
- - subplot/server.yaml
- - subplot/client.yaml
- - subplot/data.yaml
- - lib/files.yaml
- - lib/runcmd.yaml
-template: python
-functions:
- - subplot/server.py
- - subplot/client.py
- - subplot/data.py
- - lib/daemon.py
- - lib/files.py
- - lib/runcmd.py
-classes:
- - json
-abstract: |
- Obnam is a backup system, consisting of a not very smart server for
- storing chunks of backup data, and a client that splits the user's
- data into chunks. They communicate via HTTP.
-
- This document describes the architecture and acceptance criteria for
- Obnam, as well as how the acceptance criteria are verified.
-...
diff --git a/subplot/client.yaml b/subplot/client.yaml
index d660089..9817186 100644
--- a/subplot/client.yaml
+++ b/subplot/client.yaml
@@ -1,36 +1,60 @@
- given: "an installed obnam"
- function: install_obnam
- cleanup: uninstall_obnam
+ impl:
+ python:
+ function: install_obnam
+ cleanup: uninstall_obnam
- given: "a client config based on {filename}"
- function: configure_client_with_init
+ impl:
+ python:
+ function: configure_client_with_init
- given: "a client config, without passphrase, based on {filename}"
- function: configure_client_without_init
+ impl:
+ python:
+ function: configure_client_without_init
- when: "I invoke obnam restore <{genid}> {todir}"
- function: run_obnam_restore
+ impl:
+ python:
+ function: run_obnam_restore
- when: "I invoke obnam get-chunk <{gen_id}>"
- function: run_obnam_get_chunk
+ impl:
+ python:
+ function: run_obnam_get_chunk
- then: "backup generation is {varname}"
- function: capture_generation_id
+ impl:
+ python:
+ function: capture_generation_id
- then: "generation list contains <{gen_id}>"
- function: generation_list_contains
+ impl:
+ python:
+ function: generation_list_contains
- then: "file {filename} was backed up because it was new"
- function: file_was_new
+ impl:
+ python:
+ function: file_was_new
- then: "file {filename} was backed up because it was changed"
- function: file_was_changed
+ impl:
+ python:
+ function: file_was_changed
- then: "file {filename} was not backed up because it was unchanged"
- function: file_was_unchanged
+ impl:
+ python:
+ function: file_was_unchanged
- then: "stdout matches file {filename}"
- function: stdout_matches_file
+ impl:
+ python:
+ function: stdout_matches_file
- then: "stdout contains home directory followed by {path}"
- function: stdout_contains_home_dir_path
+ impl:
+ python:
+ function: stdout_contains_home_dir_path
diff --git a/subplot/data.yaml b/subplot/data.yaml
index 46be6bc..533237f 100644
--- a/subplot/data.yaml
+++ b/subplot/data.yaml
@@ -1,59 +1,99 @@
- given: a file {filename} containing "{data:text}"
- function: create_file_with_given_data
+ impl:
+ python:
+ function: create_file_with_given_data
- given: "a file {filename} containing some random data"
- function: create_file_with_random_data
+ impl:
+ python:
+ function: create_file_with_random_data
- given: "a Unix socket {filename}"
- function: create_unix_socket
+ impl:
+ python:
+ function: create_unix_socket
- given: "a named pipe {filename}"
- function: create_fifo
+ impl:
+ python:
+ function: create_fifo
- given: a cache directory tag in {dirpath}
- function: create_cachedir_tag_in
+ impl:
+ python:
+ function: create_cachedir_tag_in
- given: "a file in {dirname} with a non-UTF8 filename"
- function: create_nonutf8_filename
+ impl:
+ python:
+ function: create_nonutf8_filename
- given: file {filename} has mode {mode}
- function: chmod_file
+ impl:
+ python:
+ function: chmod_file
- given: symbolink link {linkname} that points at {target}
- function: create_symlink
+ impl:
+ python:
+ function: create_symlink
- given: a manifest of the directory {dirname} in {manifest}
- function: create_manifest_of_live
+ impl:
+ python:
+ function: create_manifest_of_live
- given: a manifest of the directory {dirname} restored in {restored} in {manifest}
- function: create_manifest_of_restored
+ impl:
+ python:
+ function: create_manifest_of_restored
- given: "JSON file {json_name} converted from YAML file {yaml_name}"
- function: convert_yaml_to_json
+ impl:
+ python:
+ function: convert_yaml_to_json
- then: "stdout, as JSON, exactly matches file {filename}"
- function: match_stdout_to_json_file_exactly
+ impl:
+ python:
+ function: match_stdout_to_json_file_exactly
- then: "stdout, as JSON, has all the values in file {filename}"
- function: match_stdout_to_json_file_superset
+ impl:
+ python:
+ function: match_stdout_to_json_file_superset
- then: "file {filename} is restored to {restored}"
- function: file_is_restored
+ impl:
+ python:
+ function: file_is_restored
- then: "file {filename} is not restored to {restored}"
- function: file_is_not_restored
+ impl:
+ python:
+ function: file_is_not_restored
- then: "manifests {expected} and {actual} match"
- function: manifests_match
+ impl:
+ python:
+ function: manifests_match
- then: "file {filename} is only readable by owner"
- function: file_is_readable_by_owner
+ impl:
+ python:
+ function: file_is_readable_by_owner
- then: "file {filename} does not contain \"{pattern:text}\""
- function: file_does_not_contain
+ impl:
+ python:
+ function: file_does_not_contain
- then: "files {filename1} and {filename2} are different"
- function: files_are_different
+ impl:
+ python:
+ function: files_are_different
- then: "files {filename1} and {filename2} are identical"
- function: files_are_identical
+ impl:
+ python:
+ function: files_are_identical
diff --git a/subplot/server.yaml b/subplot/server.yaml
index fad749a..faf8f49 100644
--- a/subplot/server.yaml
+++ b/subplot/server.yaml
@@ -1,58 +1,94 @@
- given: "a running chunk server"
- function: start_chunk_server
- cleanup: stop_chunk_server
+ impl:
+ python:
+ function: start_chunk_server
+ cleanup: stop_chunk_server
- given: "a running chunk server with environment {env:text}"
- function: start_chunk_server
- cleanup: stop_chunk_server
+ impl:
+ python:
+ function: start_chunk_server
+ cleanup: stop_chunk_server
- when: "the chunk server is stopped"
- function: stop_chunk_server
+ impl:
+ python:
+ function: stop_chunk_server
- when: "I POST (?P<filename>\\S+) to (?P<path>\\S+), with (?P<header>\\S+): (?P<json>.*)"
regex: true
- function: post_file
+ impl:
+ python:
+ function: post_file
- when: "I GET /chunks/<{var}>"
- function: get_chunk_via_var
+ impl:
+ python:
+ function: get_chunk_via_var
- when: "I try to GET /chunks/{chunk_id}"
- function: get_chunk_by_id
+ impl:
+ python:
+ function: get_chunk_by_id
- when: "I GET /chunks?sha256={sha}"
regex: false
- function: find_chunks_with_sha
+ impl:
+ python:
+ function: find_chunks_with_sha
- when: "I DELETE /chunks/<{var}>"
- function: delete_chunk_via_var
+ impl:
+ python:
+ function: delete_chunk_via_var
- when: "I try to DELETE /chunks/{chunk_id}"
- function: delete_chunk_by_id
+ impl:
+ python:
+ function: delete_chunk_by_id
- when: "chunk <{chunk_id}> on chunk server is replaced by an empty file"
- function: make_chunk_file_be_empty
+ impl:
+ python:
+ function: make_chunk_file_be_empty
- then: "HTTP status code is {status}"
- function: status_code_is
+ impl:
+ python:
+ function: status_code_is
- then: "{header} is {value}"
- function: header_is
+ impl:
+ python:
+ function: header_is
- then: "the JSON body has a field {field}, henceforth {var}"
- function: remember_json_field
+ impl:
+ python:
+ function: remember_json_field
- then: "the JSON body matches (?P<wanted>.*)"
regex: true
- function: json_body_matches
+ impl:
+ python:
+ function: json_body_matches
- then: "the body matches file {filename}"
- function: body_matches_file
+ impl:
+ python:
+ function: body_matches_file
- then: "server has {n:int} chunks"
- function: server_has_n_chunks
+ impl:
+ python:
+ function: server_has_n_chunks
- then: chunk server's stderr contains "{wanted:text}"
- function: server_stderr_contains
+ impl:
+ python:
+ function: server_stderr_contains
- then: chunk server's stderr doesn't contain "{wanted:text}"
- function: server_stderr_doesnt_contain
+ impl:
+ python:
+ function: server_stderr_doesnt_contain