This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable json serializer in crossbar router
- Loading branch information
Showing
9 changed files
with
101 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from golemapp import start | ||
from golem.client import Client | ||
from golem.rpc import utils as rpc_utils | ||
|
||
|
||
@rpc_utils.expose('test.bignum') | ||
def _get_bignum(self): | ||
return 2**64 + 1337 | ||
|
||
|
||
# using setattr silences mypy complaining about "has no attribute" | ||
setattr(Client, "_get_bignum", _get_bignum) | ||
|
||
|
||
start() |
Empty file.
26 changes: 26 additions & 0 deletions
26
scripts/node_integration_tests/playbooks/golem/json_serializer/playbook.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from functools import partial | ||
|
||
from ...base import NodeTestPlaybook | ||
from ...test_config_base import NodeId | ||
|
||
|
||
class Playbook(NodeTestPlaybook): | ||
def step_check_bignum(self): | ||
def on_success(result): | ||
if result != (2**64 + 1337): | ||
self.fail() | ||
return | ||
print("transferring bigints works correctly") | ||
self.next() | ||
|
||
def on_error(error): | ||
print(f"Error: {error}") | ||
self.fail() | ||
|
||
return self.call(NodeId.requestor, 'test.bignum', on_success=on_success, | ||
on_error=on_error) | ||
|
||
steps = ( | ||
partial(NodeTestPlaybook.step_get_key, node_id=NodeId.requestor), | ||
step_check_bignum, | ||
) + NodeTestPlaybook.steps |
13 changes: 13 additions & 0 deletions
13
scripts/node_integration_tests/playbooks/golem/json_serializer/test_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from ...test_config_base import TestConfigBase, NodeId | ||
|
||
|
||
class TestConfig(TestConfigBase): | ||
def __init__(self): | ||
super().__init__() | ||
self.nodes[NodeId.requestor].script = 'json_serializer' | ||
# if you remove crossbar-serializer flag below, test should fail with | ||
# "WAMP message serialization error: huge unsigned int". | ||
for node_config in self.nodes.values(): | ||
node_config.additional_args = { | ||
'--crossbar-serializer': 'json', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters