-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsnapshot_test.py
48 lines (42 loc) · 955 Bytes
/
snapshot_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from time import sleep
from util import (
read,
put,
partition,
clear,
new_session,
snapshot,
collect_results,
wing_gong,
get_availability,
print_availability,
)
futures_list = []
trace = []
try:
session = new_session()
# partition the network
partition(session, [["etcd1"],["etcd2","etcd3"]])
sleep(1)
put(session, futures_list, 2, "k1", "v1")
put(session, futures_list, 3, "k2", "v2")
sleep(1)
snapshot(session, 2)
sleep(1)
# un-partition the network
partition(session, [["etcd1","etcd2","etcd3"]])
sleep(1)
# try to read it
read(session, futures_list, 1, "k1")
read(session, futures_list, 2, "k2")
sleep(1)
# cleanup
clear(session, futures_list, 3)
sleep(3)
trace = collect_results(futures_list)
except Exception as e:
print(e)
pass
# check linearizability
wing_gong(trace)
print_availability(get_availability(trace))