Skip to content

Commit d5f5569

Browse files
committed
fix(tests): update error assertions for CLI 10.1.1.0+
Updated error assertions in various test files to accommodate new error messages introduced in CLI version 10.1.1.0+. This ensures compatibility with both older and newer versions of the CLI. - Updated test_tx_unbalanced.py to check for "Value must be positive in UTxO" - Updated test_mint_negative_build.py to check for new error messages - Updated test_spend_build.py to handle new execution failure messages - Updated test_spend_negative_build.py to include new error assertions - Updated test_spend_ref_scripts_build.py to check for new error messages
1 parent 77e46fc commit d5f5569

File tree

5 files changed

+35
-13
lines changed

5 files changed

+35
-13
lines changed

cardano_node_tests/tests/test_tx_unbalanced.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ def _build_transfer_amount_bellow_minimum(
5757

5858
if amount < 0:
5959
assert (
60-
"Negative quantity" in err_str
61-
or "Illegal Value in TxOut" in err_str # In node version 9.2.0+
60+
"Value must be positive in UTxO" in err_str # In cli 10.1.1.0+
61+
or "Illegal Value in TxOut" in err_str # In node 9.2.0+
62+
or "Negative quantity" in err_str
6263
), err_str
6364
else:
6465
assert "Minimum UTxO threshold not met for tx output" in err_str, err_str
@@ -491,6 +492,7 @@ def test_transfer_negative_amount(
491492
cluster.cli(build_args)
492493
err_str_build = str(excinfo_build.value)
493494
assert (
494-
"Negative quantity" in err_str_build
495+
"Value must be positive in UTxO" in err_str_build # In cli 10.1.1.0+
495496
or "Illegal Value in TxOut" in err_str_build # In node 9.2.0+
497+
or "Negative quantity" in err_str_build
496498
), err_str_build

cardano_node_tests/tests/tests_plutus/test_mint_negative_build.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,10 @@ def test_redeemer_with_simple_minting_script(
279279

280280
err_str = str(excinfo.value)
281281
assert (
282-
"expected a script in the Plutus script language, but it is actually "
283-
"using SimpleScriptLanguage" in err_str
282+
'Error in $: key "description" not found' in err_str # In cli 10.1.1.0+
283+
or "expected a script in the Plutus script language, but it is actually "
284+
"using SimpleScriptLanguage"
285+
in err_str
284286
), err_str
285287

286288
@allure.link(helpers.get_vcs_link())
@@ -463,7 +465,10 @@ def test_time_range_missing_tx_validity(
463465
txins=mint_utxos,
464466
txouts=txouts_step2,
465467
mint=plutus_mint_data,
466-
invalid_hereafter=None, # required validity interval is missing here
468+
invalid_hereafter=None, # Required validity interval is missing here
467469
)
468470
err_str = str(excinfo.value)
469-
assert "Plutus script evaluation failed" in err_str, err_str
471+
assert (
472+
"following scripts have execution failures" in err_str # In cli 10.1.1.0+
473+
or "Plutus script evaluation failed" in err_str
474+
), err_str

cardano_node_tests/tests/tests_plutus/test_spend_build.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,10 @@ def test_always_fails(
691691
amount=2_000_000,
692692
expect_failure=True,
693693
)
694-
assert "The Plutus script evaluation failed" in err, err
694+
assert (
695+
"following scripts have execution failures" in err # In cli 10.1.1.0+
696+
or "The Plutus script evaluation failed" in err
697+
), err
695698

696699
# Check expected fees
697700
expected_fee_fund = 168_845

cardano_node_tests/tests/tests_plutus/test_spend_negative_build.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,10 @@ def test_invalid_guessing_game(
384384
)
385385

386386
err_str = str(excinfo.value)
387-
assert "The Plutus script evaluation failed" in err_str, err_str
387+
assert (
388+
"following scripts have execution failures" in err_str # In cli 10.1.1.0+
389+
or "Plutus script evaluation failed" in err_str
390+
), err_str
388391

389392
@allure.link(helpers.get_vcs_link())
390393
@common.PARAM_PLUTUS3_VERSION
@@ -538,7 +541,10 @@ def test_two_scripts_spending_one_fail(
538541
)
539542

540543
err_str = str(excinfo.value)
541-
assert "The Plutus script evaluation failed" in err_str, err_str
544+
assert (
545+
"following scripts have execution failures" in err_str # In cli 10.1.1.0+
546+
or "Plutus script evaluation failed" in err_str
547+
), err_str
542548

543549

544550
class TestNegativeRedeemer:
@@ -716,7 +722,10 @@ def test_wrong_value_inside_range(
716722
)
717723

718724
err_str = str(excinfo.value)
719-
assert "The Plutus script evaluation failed" in err_str, err_str
725+
assert (
726+
"following scripts have execution failures" in err_str # In cli 10.1.1.0+
727+
or "Plutus script evaluation failed" in err_str
728+
), err_str
720729

721730
@allure.link(helpers.get_vcs_link())
722731
@hypothesis.given(redeemer_value=st.integers(min_value=common.MAX_UINT64 + 1))
@@ -846,7 +855,7 @@ def test_wrong_type(
846855
)
847856

848857
err_str = str(excinfo.value)
849-
assert "Script debugging logs: Incorrect datum. Expected 42." in err_str, err_str
858+
assert "logs: Incorrect datum. Expected 42." in err_str, err_str
850859

851860
@allure.link(helpers.get_vcs_link())
852861
@hypothesis.given(redeemer_value=st.binary(min_size=65))

cardano_node_tests/tests/tests_plutus_v2/test_spend_ref_scripts_build.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,10 @@ def test_two_scripts_one_fail(
891891
script_txins=plutus_txins,
892892
)
893893
err_str = str(excinfo.value)
894-
assert "The Plutus script evaluation failed" in err_str, err_str
894+
assert (
895+
"following scripts have execution failures" in err_str # In cli 10.1.1.0+
896+
or "Plutus script evaluation failed" in err_str
897+
), err_str
895898

896899
@allure.link(helpers.get_vcs_link())
897900
@pytest.mark.smoke

0 commit comments

Comments
 (0)