mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Address comments I
- neatpicks - Add tests for sys exit
This commit is contained in:
parent
42af61b1e4
commit
e5d725a96b
@ -284,10 +284,9 @@ def run_start(args):
|
||||
def run_tendermint_version(args):
|
||||
"""Show the supported Tendermint version(s)"""
|
||||
supported_tm_ver = {
|
||||
"description": "BigchainDB supports the following Tendermint version(s)",
|
||||
"tendermint": [],
|
||||
'description': 'BigchainDB supports the following Tendermint version(s)',
|
||||
'tendermint': __tm_supported_versions__,
|
||||
}
|
||||
[supported_tm_ver["tendermint"].append(ver) for ver in __tm_supported_versions__]
|
||||
print(json.dumps(supported_tm_ver, indent=4, sort_keys=True))
|
||||
|
||||
|
||||
|
||||
@ -126,7 +126,8 @@ class App(BaseApplication):
|
||||
f" Currently, BigchainDB only supports {__tm_supported_versions__} .Exiting!")
|
||||
sys.exit(1)
|
||||
except AttributeError:
|
||||
logger.debug("Skipping Tendermint version check.")
|
||||
logger.info("Tendermint version not found. Exiting!")
|
||||
sys.exit(1)
|
||||
|
||||
r = ResponseInfo()
|
||||
block = self.bigchaindb.get_latest_block()
|
||||
|
||||
@ -198,11 +198,10 @@ def check_tendermint_version(running_tm_ver):
|
||||
:rtype: bool
|
||||
"""
|
||||
tm_ver = running_tm_ver.split('-')
|
||||
if len(tm_ver) >= 1:
|
||||
if not tm_ver:
|
||||
return False
|
||||
for ver in __tm_supported_versions__:
|
||||
if version.parse(ver) == version.parse(tm_ver[0]):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
@ -141,3 +141,14 @@ def test_post_transaction_responses(tendermint_ws_url, b):
|
||||
code, message = b.write_transaction(double_spend, mode)
|
||||
assert code == 500
|
||||
assert message == 'Transaction validation failed'
|
||||
|
||||
|
||||
@pytest.mark.bdb
|
||||
def test_exit_when_tm_ver_not_supported(b):
|
||||
from bigchaindb import App
|
||||
|
||||
app = App(b)
|
||||
p = ProtocolHandler(app)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
p.process('info', types.Request(info=types.RequestInfo(version='2')))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user