Skip to content

Commit 7e3fde8

Browse files
committed
fix eth beacon tests
1 parent eae072c commit 7e3fde8

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

chainbench/test_data/ethereum.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,12 @@ def get_committee(committee: dict[str, t.Any]) -> EthCommittee:
149149
validators=[EthValidator(index=validator["index"]) for validator in committee["validators"]],
150150
)
151151

152-
if isinstance(data, str):
152+
if isinstance(data, (str, bytes)):
153153
data_dict = json.loads(data)
154154
else:
155155
data_dict = data
156+
logger.debug(f"data_dict type {type(data_dict)}")
157+
logger.debug("Data: %s", data_dict)
156158

157159
slot = data_dict["block_number"]
158160
epoch = slot // 32

chainbench/user/protocol/ethereum.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
import logging
22
import typing as t
33

4-
from locust import task
4+
from locust import task, tag
55

66
from chainbench.test_data.ethereum import EthBeaconTestData
77
from chainbench.user.http import HttpUser
88
from chainbench.user.wss import WSSubscription
9+
from chainbench.util.rng import RNGManager
910

1011
logger = logging.getLogger(__name__)
1112

1213

1314
class EthBeaconBaseUser(HttpUser):
1415
abstract = True
1516
test_data = EthBeaconTestData()
17+
rng = RNGManager()
1618

1719
def eth_beacon_blocks_request(
1820
self,
@@ -327,9 +329,11 @@ def eth_v1_node_version_task(self):
327329

328330

329331
class TestEthMethod(EthBeaconUser):
332+
@tag("single")
330333
@task
331334
def run_task(self) -> None:
332-
self.method_to_task_function(self.environment.parsed_options.method)()
335+
self.logger.info(f"Running task {self.environment.parsed_options.method}")
336+
self.method_to_task_function(self.environment.parsed_options.method)(self)
333337

334338

335339
class EthSubscribe(WSSubscription):

0 commit comments

Comments
 (0)