Skip to content

Commit eaebf6a

Browse files
committed
fix(tests): handle Conway era in negative datum tests
Update `TestNegativeDatum` to account for changes in the Conway era. Adjust assertions and test logic to conditionally handle behavior based on the transaction era.
1 parent 49829b7 commit eaebf6a

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

cardano_node_tests/tests/tests_plutus/test_spend_datum_build.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from cardano_node_tests.utils import clusterlib_utils
2020
from cardano_node_tests.utils import dbsync_utils
2121
from cardano_node_tests.utils import helpers
22+
from cardano_node_tests.utils.versions import VERSIONS
2223

2324
LOGGER = logging.getLogger(__name__)
2425

@@ -196,14 +197,15 @@ def test_no_datum_txout(
196197
):
197198
"""Test using UTxO without datum hash in place of locked UTxO.
198199
199-
Expect failure.
200+
Expect failure, unless in era >= Conway.
200201
201202
* create a Tx output without a datum hash
202203
* try to spend the UTxO like it was locked Plutus UTxO
203204
* check that the expected error was raised
204205
"""
205206
temp_template = common.get_test_id(cluster)
206207
amount = 2_000_000
208+
in_conway_plus = VERSIONS.transaction_era >= VERSIONS.CONWAY
207209

208210
payment_addr = payment_addrs[0]
209211
dst_addr = payment_addrs[1]
@@ -268,15 +270,17 @@ def test_no_datum_txout(
268270
except clusterlib.CLIError as exc:
269271
err_str = str(exc)
270272
else:
271-
issues.cli_800.finish_test()
272-
273-
if address_type == "script_address":
274-
assert "txin does not have a script datum" in err_str, err_str
275-
else:
276-
assert (
277-
"not a Plutus script witnessed tx input" in err_str
278-
or "points to a script hash that is not known" in err_str
279-
), err_str
273+
if not in_conway_plus:
274+
issues.cli_800.finish_test()
275+
276+
if not in_conway_plus:
277+
if address_type == "script_address":
278+
assert "txin does not have a script datum" in err_str, err_str
279+
else:
280+
assert (
281+
"not a Plutus script witnessed tx input" in err_str
282+
or "points to a script hash that is not known" in err_str
283+
), err_str
280284

281285
# Check expected fees
282286
expected_fee_fund = 199_087
@@ -335,7 +339,7 @@ def test_unlock_tx_wrong_datum(
335339
):
336340
"""Test locking a Tx output and try to spend it with a wrong datum.
337341
338-
Expect failure.
342+
Expect failure, unless in era >= Conway.
339343
"""
340344
temp_template = common.get_test_id(cluster)
341345

@@ -378,6 +382,8 @@ def test_unlock_tx_wrong_datum(
378382
except clusterlib.CLIError as exc:
379383
err_str = str(exc)
380384
else:
385+
if VERSIONS.transaction_era >= VERSIONS.CONWAY:
386+
return
381387
issues.cli_800.finish_test()
382388

383389
assert (

0 commit comments

Comments
 (0)