Skip to content

Commit 328f5fe

Browse files
Merge branch 'master' into build_method_test_conway
2 parents 05340f2 + 5a3981e commit 328f5fe

File tree

3 files changed

+49
-29
lines changed

3 files changed

+49
-29
lines changed

cardano_node_tests/tests/test_pools.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,9 +2470,9 @@ def test_stake_pool_metadata_long_homepage(
24702470

24712471
@allure.link(helpers.get_vcs_link())
24722472
@hypothesis.given(
2473-
metadata_url=st.text(alphabet=st.characters(blacklist_categories=["C"]), min_size=25)
2473+
url_part=st.text(alphabet=st.characters(blacklist_categories=["C"]), min_size=89)
24742474
)
2475-
@common.hypothesis_settings()
2475+
@common.hypothesis_settings(max_examples=500)
24762476
@pytest.mark.smoke
24772477
@pytest.mark.testnets
24782478
def test_stake_pool_long_metadata_url(
@@ -2482,22 +2482,25 @@ def test_stake_pool_long_metadata_url(
24822482
gen_pool_registration_cert_data: tuple[
24832483
str, str, clusterlib.KeyPair, clusterlib.ColdKeyPair
24842484
],
2485-
metadata_url: str,
2485+
url_part: str,
24862486
):
24872487
"""Try to create pool registration cert when the *metadata-url* is longer than allowed.
24882488
24892489
Expect failure. Property-based test.
24902490
"""
24912491
common.get_test_id(cluster)
24922492

2493+
pool_metadata_url = f"https://gist.githubusercontent.com/{url_part}.json"
2494+
assert len(pool_metadata_url) >= 129
2495+
24932496
pool_name, pool_metadata_hash, node_vrf, node_cold = gen_pool_registration_cert_data
24942497

24952498
pool_data = clusterlib.PoolData(
24962499
pool_name=pool_name,
24972500
pool_pledge=1_000,
24982501
pool_cost=500_000_000,
24992502
pool_margin=0.2,
2500-
pool_metadata_url=f"https://gist.githubusercontent.com/{metadata_url}.json",
2503+
pool_metadata_url=pool_metadata_url,
25012504
pool_metadata_hash=pool_metadata_hash,
25022505
)
25032506

@@ -2509,8 +2512,13 @@ def test_stake_pool_long_metadata_url(
25092512
cold_vkey_file=node_cold.vkey_file,
25102513
owner_stake_vkey_files=[p.stake.vkey_file for p in pool_users],
25112514
)
2512-
assert "option --metadata-url: The provided string must have at most 64 characters" in str(
2513-
excinfo.value
2515+
err_str = str(excinfo.value)
2516+
assert (
2517+
"option --metadata-url: The provided string must have at most 128 characters" in err_str
2518+
or "invalid url" in err_str
2519+
# In cardano-node <= 10.6.0
2520+
or "option --metadata-url: The provided string must have at most 64 characters"
2521+
in err_str
25142522
)
25152523

25162524

cardano_node_tests/tests/tests_conway/test_conway.py

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _run_test_action_unreg_deposit_addr(
7373
cluster: clusterlib.ClusterLib,
7474
temp_template: str,
7575
pool_user: clusterlib.PoolUser,
76-
build_method: str,
76+
use_build_cmd: bool,
7777
submit_method: str = submit_utils.SubmitMethods.CLI,
7878
):
7979
"""Run the actual scenario of the 'test_action_unreg_deposit_addr*' tests."""
@@ -104,50 +104,62 @@ def _run_test_action_unreg_deposit_addr(
104104
name_template=f"{temp_template}_action",
105105
src_address=pool_user.payment.address,
106106
submit_method=submit_method,
107-
build_method=build_method,
107+
use_build_cmd=use_build_cmd,
108108
tx_files=tx_files_action,
109109
)
110110
err_str = str(excinfo.value)
111-
if build_method in (
112-
clusterlib_utils.BuildMethods.BUILD,
113-
clusterlib_utils.BuildMethods.BUILD_EST,
114-
):
111+
if use_build_cmd:
115112
assert (
116113
"Stake credential specified in the proposal is not registered on-chain" in err_str
117-
or "ProposalReturnAccountDoesNotExist" in err_str # For node <= 10.1.4
114+
or "ProposalReturnAccountDoesNotExist" in err_str # In node <= 10.1.4
118115
), err_str
119-
elif build_method == clusterlib_utils.BuildMethods.BUILD_RAW:
120-
assert "ProposalReturnAccountDoesNotExist" in err_str, err_str
121116
else:
122-
msg = f"Unsupported build method: {build_method}"
123-
raise ValueError(msg)
117+
assert "ProposalReturnAccountDoesNotExist" in err_str, err_str
124118

125119
@allure.link(helpers.get_vcs_link())
126-
@common.PARAM_BUILD_METHOD_NO_EST
127120
@submit_utils.PARAM_SUBMIT_METHOD
128121
@pytest.mark.smoke
129-
def test_action_unreg_deposit_addr(
122+
def test_action_submit_unreg_deposit_addr(
130123
self,
131124
cluster: clusterlib.ClusterLib,
132125
pool_user: clusterlib.PoolUser,
133-
build_method: str,
134126
submit_method: str,
135127
):
136-
"""Test creating or submitting an action with an unregistered deposit return address.
128+
"""Test submitting an action with an unregistered deposit return address.
137129
138130
Expect failure.
139131
140-
* `transaction build` - fails at build time because the deposit return stake credential
141-
is not registered.
142-
* `transaction build-estimate` - behaves like `build`, fails at build time.
143-
* `transaction build-raw` - does not check during build; transaction is expected
144-
to fail on submission.
132+
The transaction is built using `transaction build-raw`, which does not check
133+
deposit return address registration. The transaction is expected to fail on submission.
145134
"""
146135
temp_template = common.get_test_id(cluster)
147136
return self._run_test_action_unreg_deposit_addr(
148137
cluster=cluster,
149138
temp_template=temp_template,
150139
pool_user=pool_user,
151-
build_method=build_method,
140+
use_build_cmd=False,
152141
submit_method=submit_method,
153142
)
143+
144+
@allure.link(helpers.get_vcs_link())
145+
@common.SKIPIF_BUILD_UNUSABLE
146+
@pytest.mark.smoke
147+
def test_action_build_unreg_deposit_addr(
148+
self,
149+
cluster: clusterlib.ClusterLib,
150+
pool_user: clusterlib.PoolUser,
151+
):
152+
"""Test building a Tx when deposit return address is unregistered.
153+
154+
Expect failure.
155+
156+
The `transaction build` command checks deposit return address registration
157+
during Tx building, causing the build to fail.
158+
"""
159+
temp_template = common.get_test_id(cluster)
160+
return self._run_test_action_unreg_deposit_addr(
161+
cluster=cluster,
162+
temp_template=temp_template,
163+
pool_user=pool_user,
164+
use_build_cmd=True,
165+
)

cardano_node_tests/tests/tests_conway/test_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def test_info(
110110
cluster_obj=cluster,
111111
name_template=f"{temp_template}_action",
112112
src_address=pool_user_ug.payment.address,
113-
use_build_cmd=True,
113+
build_method=clusterlib_utils.BuildMethods.BUILD,
114114
tx_files=tx_files_action,
115115
)
116116
reqc.cli023.success()
@@ -202,7 +202,7 @@ def test_info(
202202
payment_addr=pool_user_ug.payment,
203203
votes=votes,
204204
keys=vote_keys,
205-
use_build_cmd=True,
205+
build_method=clusterlib_utils.BuildMethods.BUILD,
206206
)
207207
reqc.cli024.success()
208208

0 commit comments

Comments
 (0)