summaryrefslogtreecommitdiff
path: root/obnam.md
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-09-19 08:12:54 +0300
committerLars Wirzenius <liw@liw.fi>2020-09-19 10:13:49 +0300
commit70b8d232c2b7e2892a117f61e3a9892bf4994ea4 (patch)
tree691804e9e8a63d1f5bb6750a20a0d3c0cd6fa6f7 /obnam.md
parente1c4683b73ec2a207321377636f4ed722d0674dc (diff)
downloadobnam2-70b8d232c2b7e2892a117f61e3a9892bf4994ea4.tar.gz
feat: search, delete chunks on chunk server
Also heavily refactor the now-long scenario by splitting out a happy path and some unhappy paths.
Diffstat (limited to 'obnam.md')
-rw-r--r--obnam.md69
1 files changed, 58 insertions, 11 deletions
diff --git a/obnam.md b/obnam.md
index 7caf0aa..d4a2e35 100644
--- a/obnam.md
+++ b/obnam.md
@@ -241,15 +241,9 @@ These scenarios verify that the chunk server works on its own. The
scenarios start a fresh, empty chunk server, and do some operations on
it, and verify the results, and finally terminate the server.
-### Chunk management
+### Chunk management happy path
-This scenario verifies that a chunk can be uploaded and then
-retrieved, with its metadata, and then deleted. The chunk server has
-an API with just one endpoint, `/chunks`, and accepts the the POST,
-GET, and DELETE operations on it.
-
-To create a chunk, we use POST. We remember the identifier so we can
-retrieve the chunk later.
+We must be able to create a new chunk.
~~~scenario
given a chunk server
@@ -260,7 +254,7 @@ and content-type is application/json
and the JSON body has a field chunk_id, henceforth ID
~~~
-To retrieve a chunk, we use GET.
+We must be able to retrieve it.
~~~scenario
when I GET /chunks/<ID>
@@ -270,10 +264,63 @@ and chunk-meta is {"sha256":"abc","generation":null,"ended":null}
and the body matches file data.dat
~~~
-TODO: fetch non-existent chunk
+We must also be able to find it based on metadata.
+
+~~~scenario
+when I GET /chunks?sha256=abc
+then HTTP status code is 200
+and content-type is application/json
+and the JSON body matches {"<ID>":{"sha256":"abc","generation":null,"ended":null}}
+~~~
+
+Finally, we must be able to delete it. After that, we must not be able
+to retrieve it, or find it using metadata.
+
+~~~scenario
+when I DELETE /chunks/<ID>
+then HTTP status code is 200
+
+when I GET /chunks/<ID>
+then HTTP status code is 404
+
+when I GET /chunks?sha256=abc
+then HTTP status code is 200
+and content-type is application/json
+and the JSON body matches {}
+~~~
+
+### Retrieve a chunk that does not exist
-TODO: delete chunk
+We must get the right error if we try to retrieve a chunk that does
+not exist.
+~~~scenario
+given a chunk server
+when I try to GET /chunks/any.random.string
+then HTTP status code is 404
+~~~
+
+### Search without matches
+
+We must get an empty result if searching for chunks that don't exist.
+
+~~~scenario
+given a chunk server
+when I GET /chunks?sha256=abc
+then HTTP status code is 200
+and content-type is application/json
+and the JSON body matches {}
+~~~
+
+### Delete chunk that does not exist
+
+We must get the right error when deleting a chunk that doesn't exist.
+
+~~~scenario
+given a chunk server
+when I try to DELETE /chunks/any.random.string
+then HTTP status code is 404
+~~~
## Smoke test