summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2022-08-08 22:25:46 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2022-08-08 22:50:27 +0200
commit7aa7649e980ff4b335b41eaea34a9a11820c3e2d (patch)
tree0da4b7c4bf0e80e58d75dcac83b052a22a829985 /test
parent5cfdbc49647b6be943d01e4ab141b705e9e5c86d (diff)
Generation number of stored objects with caching
Diffstat (limited to 'test')
-rw-r--r--test/storage.test75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/storage.test b/test/storage.test
new file mode 100644
index 0000000..2ce87d5
--- /dev/null
+++ b/test/storage.test
@@ -0,0 +1,75 @@
+test:
+ spawn on node1 as p1
+
+ # Diamond history
+ send to p1:
+ "store rec"
+ "text:t First root"
+ ""
+ expect from p1:
+ /store-done (blake2#[0-9a-f]*)/ capture r1
+ guard r1 == "blake2#c4a8c69fbc8398acf76a2ec1e5a191f339c4d03c3eb425af19d6d7d5efac6b8e"
+
+ send to p1:
+ "store rec"
+ "PREV:r $r1"
+ ""
+ expect from p1:
+ /store-done (blake2#[0-9a-f]*)/ capture r2
+
+ send to p1:
+ "store rec"
+ "text:t Second branch"
+ "PREV:r $r1"
+ ""
+ expect from p1:
+ /store-done (blake2#[0-9a-f]*)/ capture r3
+
+ send to p1:
+ "store rec"
+ "PREV:r $r2"
+ "PREV:r $r3"
+ ""
+ expect from p1:
+ /store-done (blake2#[0-9a-f]*)/ capture r4
+
+ send to p1 "stored-generation $r1"
+ expect from p1 /stored-generation $r1 0/
+
+ send to p1 "stored-generation $r2"
+ expect from p1 /stored-generation $r2 1/
+
+ send to p1 "stored-generation $r3"
+ expect from p1 /stored-generation $r3 1/
+
+ send to p1 "stored-generation $r4"
+ expect from p1 /stored-generation $r4 2/
+
+ # Attach second root
+ send to p1:
+ "store rec"
+ "text:t Second root"
+ ""
+ expect from p1:
+ /store-done (blake2#[0-9a-f]*)/ capture r2_1
+
+ send to p1:
+ "store rec"
+ "PREV:r $r2_1"
+ ""
+ expect from p1:
+ /store-done (blake2#[0-9a-f]*)/ capture r2_2
+
+ send to p1:
+ "store rec"
+ "PREV:r $r2_2"
+ "PREV:r $r4"
+ ""
+ expect from p1:
+ /store-done (blake2#[0-9a-f]*)/ capture r2_3
+
+ send to p1 "stored-generation $r2_3"
+ expect from p1 /stored-generation $r2_3 3/
+
+ send to p1 "stored-generation $r2_2"
+ expect from p1 /stored-generation $r2_2 1/