forked from vmware/concord-bft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_skvbc_long_running.py
68 lines (61 loc) · 2.5 KB
/
test_skvbc_long_running.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Concord
#
# Copyright (c) 2020 VMware, Inc. All Rights Reserved.
#
# This product is licensed to you under the Apache 2.0 license (the "License").
# You may not use this product except in compliance with the Apache 2.0 License.
#
# This product may include a number of subcomponents with separate copyright
# notices and license terms. Your use of these subcomponents is subject to the
# terms and conditions of the subcomponent's license, as noted in the LICENSE
# file.
import itertools
import os.path
import unittest
import trio
import time
from os import environ
from util.bft import with_trio, with_bft_network, KEY_FILE_PREFIX
from test_skvbc import SkvbcTest
from test_skvbc_fast_path import SkvbcFastPathTest
from test_skvbc_view_change import SkvbcViewChangeTest
# Time consts
EIGHT_HOURS_IN_SECONDS = 8 * 60 * 60
ONE_HOUR_IN_SECONDS = 1 * 60 * 60
def start_replica_cmd(builddir, replica_id):
"""
Return a command that starts an skvbc replica when passed to
subprocess.Popen.
Note each arguments is an element in a list.
"""
statusTimerMilli = "500"
viewChangeTimeoutMilli = "10000"
path = os.path.join(builddir, "tests", "simpleKVBC", "TesterReplica", "skvbc_replica")
return [path,
"-k", KEY_FILE_PREFIX,
"-i", str(replica_id),
"-s", statusTimerMilli,
"-v", viewChangeTimeoutMilli,
"-p",
"-t", os.environ.get('STORAGE_TYPE')]
class SkvbcLongRunningTest(unittest.TestCase):
@with_trio
@with_bft_network(start_replica_cmd,
selected_configs=lambda n, f, c: n == 7)
async def test_stability(self, bft_network):
bft_network.start_all_replicas()
start = time.time()
with trio.move_on_after(seconds=ONE_HOUR_IN_SECONDS*72):
for i in itertools.count():
await SkvbcTest().test_get_block_data\
(bft_network=bft_network, already_in_trio=True)
await trio.sleep(seconds=120)
await SkvbcTest().test_conflicting_write\
(bft_network=bft_network, already_in_trio=True)
await trio.sleep(seconds=120)
end = time.time()
if end - start >= ONE_HOUR_IN_SECONDS*2:
await SkvbcViewChangeTest().test_single_vc_only_primary_down \
(bft_network=bft_network, already_in_trio=True, disable_linearizability_checks=True)
await trio.sleep(seconds=180)
start = time.time()