Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tests): handle CLI issue 942 in various tests #2682

Merged
merged 1 commit into from
Oct 21, 2024
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
6 changes: 6 additions & 0 deletions cardano_node_tests/tests/issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
fixed_in="9.5.0.0", # Fixed in some release after 9.4.1.0
message="Negative pparam proposal values overflow to positive.",
)
cli_942 = blockers.GH(
issue=942,
repo="IntersectMBO/cardano-cli",
fixed_in="10.0.0.1", # Fixed in some release after 10.0.0.0
message="build command doesn't balance key deposit.",
)

consensus_973 = blockers.GH(
issue=973,
Expand Down
7 changes: 6 additions & 1 deletion cardano_node_tests/tests/test_addr_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ def _build_dereg() -> clusterlib.TxRawOutput:
signing_key_files=tx_files_dereg.signing_key_files,
tx_name=f"{temp_template}_dereg",
)
cluster.g_transaction.submit_tx(tx_file=tx_signed, txins=tx_raw_output_dereg.txins)
try:
cluster.g_transaction.submit_tx(tx_file=tx_signed, txins=tx_raw_output_dereg.txins)
except clusterlib.CLIError as exc:
if "ValueNotConservedUTxO" in str(exc):
issues.cli_942.finish_test()
raise
else:
tx_raw_output_dereg = cluster.g_transaction.send_tx(
src_address=user_payment.address,
Expand Down
8 changes: 7 additions & 1 deletion cardano_node_tests/tests/test_delegation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from cardano_node_tests.cluster_management import resources_management
from cardano_node_tests.tests import common
from cardano_node_tests.tests import delegation
from cardano_node_tests.tests import issues
from cardano_node_tests.utils import clusterlib_utils
from cardano_node_tests.utils import dbsync_utils
from cardano_node_tests.utils import helpers
Expand Down Expand Up @@ -819,7 +820,12 @@ def _build_deleg_dereg() -> clusterlib.TxRawOutput:
signing_key_files=tx_files.signing_key_files,
tx_name=f"{temp_template}_deleg_dereg",
)
cluster.g_transaction.submit_tx(tx_file=tx_signed, txins=tx_raw_output_deleg.txins)
try:
cluster.g_transaction.submit_tx(tx_file=tx_signed, txins=tx_raw_output_deleg.txins)
except clusterlib.CLIError as exc:
if "ValueNotConservedUTxO" in str(exc):
issues.cli_942.finish_test()
raise
else:
tx_raw_output_deleg = cluster.g_transaction.send_tx(
src_address=user_payment.address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def _dereg_stake() -> None:
cluster_obj=cluster,
name_template=f"{temp_template}_dereg",
src_address=pool_users[0].payment.address,
use_build_cmd=True,
use_build_cmd=False, # Workaround for CLI issue 942
tx_files=tx_files,
withdrawals=withdrawals,
deposit=-sum(s.delegation_deposit for __, s in pool_users_info),
Expand Down
15 changes: 9 additions & 6 deletions cardano_node_tests/tests/tests_plutus/test_delegation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import allure
import pytest
from cardano_clusterlib import clusterlib
from packaging import version

from cardano_node_tests.cluster_management import cluster_management
from cardano_node_tests.cluster_management import resources_management
Expand All @@ -29,6 +30,8 @@

LOGGER = logging.getLogger(__name__)

CLI_WITH_ISSUE_942 = version.parse("10.0.0.0")

pytestmark = [
common.SKIPIF_PLUTUS_UNUSABLE,
pytest.mark.plutus,
Expand Down Expand Up @@ -630,7 +633,7 @@ def test_register_deregister(
pool_user=pool_user,
redeemer_file=plutus_common.REDEEMER_42,
reference_script_utxos=reference_script_utxos,
use_build_cmd=use_build_cmd,
use_build_cmd=use_build_cmd and VERSIONS.cli != CLI_WITH_ISSUE_942,
)

if reward_error:
Expand Down Expand Up @@ -839,12 +842,12 @@ def test_delegate_deregister( # noqa: C901
pool_user=pool_user,
redeemer_file=plutus_common.REDEEMER_42,
reference_script_utxos=reference_script_utxos,
use_build_cmd=use_build_cmd,
use_build_cmd=use_build_cmd and VERSIONS.cli != CLI_WITH_ISSUE_942,
)
except clusterlib.CLIError as exc:
if "(MissingRedeemers" not in str(exc):
raise
issues.cli_299.finish_test()
if "(MissingRedeemers" in str(exc):
issues.cli_299.finish_test()
raise

if reward_error:
raise AssertionError(reward_error)
Expand Down Expand Up @@ -1069,7 +1072,7 @@ def test_register_delegate_deregister(
pool_user=pool_user,
redeemer_file=plutus_common.REDEEMER_42,
reference_script_utxos=reference_script_utxos,
use_build_cmd=use_build_cmd,
use_build_cmd=use_build_cmd and VERSIONS.cli != CLI_WITH_ISSUE_942,
)

if reward_error:
Expand Down
Loading