Skip to content

Commit

Permalink
Fix failing negative lower bound tests
Browse files Browse the repository at this point in the history
* use `build` command only when `use_build_cmd == True`
* skip on Shelley-era Tx
  • Loading branch information
mkoura committed Feb 4, 2023
1 parent a6575aa commit 528dc00
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions cardano_node_tests/tests/test_tx_negative.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,14 @@ def test_past_ttl(
pool_users=pool_users,
temp_template=temp_template,
invalid_hereafter=cluster.g_query.get_slot_no() - 1,
use_build_cmd=use_build_cmd,
)

@allure.link(helpers.get_vcs_link())
@pytest.mark.skipif(
VERSIONS.transaction_era < VERSIONS.ALLEGRA,
reason="runs only with Allegra+ TX",
)
@common.PARAM_USE_BUILD_CMD
def test_before_negative_overflow(
self,
Expand All @@ -338,7 +343,7 @@ def test_before_negative_overflow(
pool_users=pool_users,
temp_template=temp_template,
invalid_before=before_value,
use_build_cmd=True,
use_build_cmd=use_build_cmd,
)

invalid_before, __ = self._get_validity_range(
Expand All @@ -350,6 +355,10 @@ def test_before_negative_overflow(
pytest.xfail("UINT64 overflow, see node issue #4863")

@allure.link(helpers.get_vcs_link())
@pytest.mark.skipif(
VERSIONS.transaction_era < VERSIONS.ALLEGRA,
reason="runs only with Allegra+ TX",
)
@common.PARAM_USE_BUILD_CMD
def test_before_positive_overflow(
self,
Expand All @@ -376,7 +385,7 @@ def test_before_positive_overflow(
pool_users=pool_users,
temp_template=temp_template,
invalid_before=over_before_value,
use_build_cmd=True,
use_build_cmd=use_build_cmd,
)

invalid_before, __ = self._get_validity_range(
Expand All @@ -388,6 +397,10 @@ def test_before_positive_overflow(
pytest.xfail("UINT64 overflow, see node issue #4863")

@allure.link(helpers.get_vcs_link())
@pytest.mark.skipif(
VERSIONS.transaction_era < VERSIONS.ALLEGRA,
reason="runs only with Allegra+ TX",
)
@common.PARAM_USE_BUILD_CMD
def test_before_too_high(
self,
Expand All @@ -410,13 +423,17 @@ def test_before_too_high(
pool_users=pool_users,
temp_template=temp_template,
invalid_before=before_value,
use_build_cmd=True,
use_build_cmd=use_build_cmd,
)

if "transaction submit" in err_str:
pytest.xfail("Value not checked, see node issue #4863")

@allure.link(helpers.get_vcs_link())
@pytest.mark.skipif(
VERSIONS.transaction_era < VERSIONS.ALLEGRA,
reason="runs only with Allegra+ TX",
)
@hypothesis.given(before_value=st.integers(min_value=1, max_value=common.MAX_INT64))
@hypothesis.example(before_value=1)
@hypothesis.example(before_value=common.MAX_INT64)
Expand All @@ -442,13 +459,18 @@ def test_pbt_before_negative_overflow(
pool_users=pool_users,
temp_template=temp_template,
invalid_before=-before_value,
use_build_cmd=use_build_cmd,
)

# we cannot XFAIL in PBT, so we'll pass on the xfail condition and re-test using
# a regular test `test_before_negative_overflow`
assert slot_no > 0, f"SlotNo: {slot_no}, `before_value`: {before_value}"

@allure.link(helpers.get_vcs_link())
@pytest.mark.skipif(
VERSIONS.transaction_era < VERSIONS.ALLEGRA,
reason="runs only with Allegra+ TX",
)
@hypothesis.given(
before_value=st.integers(min_value=common.MAX_INT64 + 1, max_value=common.MAX_UINT64)
)
Expand Down Expand Up @@ -478,13 +500,18 @@ def test_pbt_before_positive_overflow(
pool_users=pool_users,
temp_template=temp_template,
invalid_before=over_before_value,
use_build_cmd=use_build_cmd,
)

# we cannot XFAIL in PBT, so we'll pass on the xfail condition and re-test using
# a regular test `test_before_positive_overflow`
assert slot_no == before_value - 1, f"SlotNo: {slot_no}, `before_value`: {before_value}"

@allure.link(helpers.get_vcs_link())
@pytest.mark.skipif(
VERSIONS.transaction_era < VERSIONS.ALLEGRA,
reason="runs only with Allegra+ TX",
)
@hypothesis.given(
before_value=st.integers(min_value=common.MAX_INT64 + 1, max_value=common.MAX_UINT64)
)
Expand Down Expand Up @@ -513,6 +540,7 @@ def test_pbt_before_too_high(
pool_users=pool_users,
temp_template=temp_template,
invalid_before=before_value,
use_build_cmd=use_build_cmd,
)

# we cannot XFAIL in PBT, so we'll pass on the xfail condition and re-test using
Expand Down

0 comments on commit 528dc00

Please sign in to comment.