Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gltest_cli/config/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

GLTEST_CONFIG_FILE = "gltest.config.yaml"
DEFAULT_NETWORK = "localnet"
PRECONFIGURED_NETWORKS = ["localnet", "studionet", "testnet_asimov"]
CHAINS = ["localnet", "studionet", "testnet_asimov"]
PRECONFIGURED_NETWORKS = ["localnet", "studionet", "testnet_asimov", "testnet_bradbury"]
CHAINS = ["localnet", "studionet", "testnet_asimov", "testnet_bradbury"]
DEFAULT_RPC_URL = SIMULATOR_JSON_RPC_URL
DEFAULT_ENVIRONMENT = ".env"
DEFAULT_CONTRACTS_DIR = Path("contracts")
Expand Down
6 changes: 3 additions & 3 deletions gltest_cli/config/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def pytest_configure(config):
)
user_config = get_default_user_config()

# Special handling for testnet_asimov - check if accounts are configured
if network_name == "testnet_asimov":
# Special handling for remote testnets - check if accounts are configured
if network_name in ("testnet_asimov", "testnet_bradbury"):
logger.error(
"For testnet_asimov, you need to configure accounts in gltest.config.yaml, see https://docs.genlayer.com/api-references/genlayer-test"
f"For {network_name}, you need to configure accounts in gltest.config.yaml, see https://docs.genlayer.com/api-references/genlayer-test"
)
pytest.exit("gltest configuration error")
else:
Expand Down
3 changes: 2 additions & 1 deletion gltest_cli/config/types.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass, field
from pathlib import Path
from typing import Dict, List, Optional
from genlayer_py.chains import localnet, studionet, testnet_asimov
from genlayer_py.chains import localnet, studionet, testnet_asimov, testnet_bradbury
from genlayer_py.types import GenLayerChain
from gltest_cli.config.constants import PRECONFIGURED_NETWORKS
from gltest_cli.config.constants import (
Expand Down Expand Up @@ -189,6 +189,7 @@ def get_chain(self) -> GenLayerChain:
"localnet": localnet,
"studionet": studionet,
"testnet_asimov": testnet_asimov,
"testnet_bradbury": testnet_bradbury,
}
chain_type = self.get_chain_type()
return chain_map[chain_type]
Expand Down
14 changes: 12 additions & 2 deletions gltest_cli/config/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
DEFAULT_LEADER_ONLY,
CHAINS,
)
from genlayer_py.chains import localnet, studionet, testnet_asimov
from genlayer_py.chains import localnet, studionet, testnet_asimov, testnet_bradbury
from gltest_cli.config.types import UserConfig, NetworkConfigData, PathConfig

VALID_ROOT_KEYS = ["networks", "paths", "environment"]
Expand Down Expand Up @@ -71,6 +71,16 @@ def get_default_user_config() -> UserConfig:
default_wait_retries=DEFAULT_WAIT_RETRIES,
chain_type="testnet_asimov",
),
"testnet_bradbury": NetworkConfigData(
id=testnet_bradbury.id,
url=testnet_bradbury.rpc_urls["default"]["http"][0],
accounts=None,
from_account=None,
leader_only=DEFAULT_LEADER_ONLY,
default_wait_interval=DEFAULT_WAIT_INTERVAL,
default_wait_retries=DEFAULT_WAIT_RETRIES,
chain_type="testnet_bradbury",
),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

return UserConfig(
Expand Down Expand Up @@ -176,7 +186,7 @@ def validate_network_config(network_name: str, network_config: dict):
raise ValueError(f"network {network_name} must have accounts")
if "chain_type" not in network_config:
raise ValueError(
f"network {network_name} must have a chain_type. Valid values: localnet, studionet, testnet_asimov"
f"network {network_name} must have a chain_type. Valid values: {', '.join(CHAINS)}"
)


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"pytest",
"genlayer-py==0.9.0",
"genlayer-py>=0.11.0,<0.12.0",
"colorama>=0.4.6",
"pyyaml",
"python-dotenv"
Expand Down
23 changes: 21 additions & 2 deletions tests/gltest_cli/config/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_help_message(pytester):
" --leader-only Run contracts in leader-only mode",
" --chain-type=CHAIN_TYPE",
" Chain type (possible values: localnet, studionet,",
" testnet_asimov)",
" testnet_asimov, testnet_bradbury)",
]
)

Expand Down Expand Up @@ -129,6 +129,25 @@ def test_network():
assert result.ret != 0


def test_network_testnet_bradbury(pytester):
pytester.makepyfile(
"""
from gltest_cli.config.general import get_general_config

def test_network():
general_config = get_general_config()
assert general_config.get_network_name() == "testnet_bradbury"
"""
)

result = pytester.runpytest(
"--network=testnet_bradbury", "--rpc-url=http://test.example.com:9151", "-v"
)

# The test should exit with an error code when testnet_bradbury is used without accounts
assert result.ret != 0


def test_artifacts_dir(pytester):
"""Test that artifacts directory CLI parameter works correctly."""
pytester.makepyfile(
Expand Down Expand Up @@ -346,7 +365,7 @@ def test_chain_type():
assert general_config.plugin_config.chain_type is None
# get_chain_type should still work using network config
chain_type = general_config.get_chain_type()
assert chain_type in ["localnet", "studionet", "testnet_asimov"]
assert chain_type in ["localnet", "studionet", "testnet_asimov", "testnet_bradbury"]
"""
)

Expand Down
Loading