2022-08-11 20:49:05 +00:00
|
|
|
from pathlib import Path
|
|
|
|
|
2022-07-27 13:27:07 +00:00
|
|
|
import pytest
|
|
|
|
|
2022-08-11 20:49:05 +00:00
|
|
|
from .network import setup_custom_ethermint, setup_ethermint, setup_geth
|
2022-07-27 13:27:07 +00:00
|
|
|
|
2022-08-02 06:21:03 +00:00
|
|
|
|
2022-07-27 13:27:07 +00:00
|
|
|
@pytest.fixture(scope="session")
|
|
|
|
def ethermint(tmp_path_factory):
|
|
|
|
path = tmp_path_factory.mktemp("ethermint")
|
|
|
|
yield from setup_ethermint(path, 26650)
|
|
|
|
|
|
|
|
|
2022-08-11 20:49:05 +00:00
|
|
|
@pytest.fixture(scope="session")
|
|
|
|
def ethermint_indexer(tmp_path_factory):
|
|
|
|
path = tmp_path_factory.mktemp("indexer")
|
|
|
|
yield from setup_custom_ethermint(
|
|
|
|
path, 26660, Path(__file__).parent / "configs/enable-indexer.jsonnet"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-07-27 13:27:07 +00:00
|
|
|
@pytest.fixture(scope="session")
|
|
|
|
def geth(tmp_path_factory):
|
|
|
|
path = tmp_path_factory.mktemp("geth")
|
|
|
|
yield from setup_geth(path, 8545)
|
|
|
|
|
|
|
|
|
2022-08-11 20:49:05 +00:00
|
|
|
@pytest.fixture(
|
|
|
|
scope="session", params=["ethermint", "geth", "ethermint-ws", "enable-indexer"]
|
|
|
|
)
|
|
|
|
def cluster(request, ethermint, ethermint_indexer, geth):
|
2022-07-27 13:27:07 +00:00
|
|
|
"""
|
|
|
|
run on both ethermint and geth
|
|
|
|
"""
|
|
|
|
provider = request.param
|
|
|
|
if provider == "ethermint":
|
|
|
|
yield ethermint
|
|
|
|
elif provider == "geth":
|
|
|
|
yield geth
|
|
|
|
elif provider == "ethermint-ws":
|
|
|
|
ethermint_ws = ethermint.copy()
|
|
|
|
ethermint_ws.use_websocket()
|
|
|
|
yield ethermint_ws
|
2022-08-11 20:49:05 +00:00
|
|
|
elif provider == "enable-indexer":
|
|
|
|
yield ethermint_indexer
|
2022-07-27 13:27:07 +00:00
|
|
|
else:
|
|
|
|
raise NotImplementedError
|