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

feat(tests): run test_consensus_reached only on mainnet #2710

Merged
merged 1 commit into from
Oct 30, 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
23 changes: 18 additions & 5 deletions cardano_node_tests/tests/test_rollback.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ def node_wait_for_block(
os.environ["CARDANO_NODE_SOCKET_PATH"] = orig_socket

@allure.link(helpers.get_vcs_link())
# There's a submission delay of 60 sec. Therefore on testnet with low `securityParam`,
# it is not possible to restart the nodes, submit transaction, and still be under
# `securityParam` blocks.
@pytest.mark.skipif(
"mainnet_fast" not in configuration.SCRIPTS_DIRNAME,
reason="cannot run on testnet with low `securityParam`",
)
@pytest.mark.long
def test_consensus_reached(
self,
cluster_manager: cluster_management.ClusterManager,
Expand Down Expand Up @@ -306,11 +314,12 @@ def test_consensus_reached(
), "The Tx number 3 doesn't exist on cluster 2"

# Wait for new block to let chains progress.
# We can't wait for too long, because if both clusters has produced more than
# `securityParam` number of blocks while the topology was fragmented, it would not be
# possible to bring the the clusters back into global consensus. On local cluster,
# the value of `securityParam` is 10.
cluster.wait_for_new_block()
# If both clusters has produced more than `securityParam` number of blocks while
# the topology was fragmented, it would not be possible to bring the the clusters
# back into global consensus.
# On fast epoch local cluster, the value of `securityParam` is 10.
# On mainnet, the value of `securityParam` is 2160.
cluster.wait_for_new_block(new_blocks=15)

if ROLLBACK_PAUSE:
print("PHASE2: cluster with separated into cluster1 and cluster2")
Expand Down Expand Up @@ -361,6 +370,10 @@ def test_consensus_reached(
), "Neither Tx number 2 nor Tx number 3 was rolled back"

@allure.link(helpers.get_vcs_link())
@pytest.mark.skipif(
"mainnet" in configuration.SCRIPTS_DIRNAME,
reason="cannot run on testnet with high `securityParam`",
)
@pytest.mark.long
def test_permanent_fork(
self,
Expand Down
14 changes: 7 additions & 7 deletions scripts/test_rollbacks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ set -euo pipefail

TOP_DIR="$(readlink -m "${0%/*}/..")"

export NUM_POOLS="${NUM_POOLS:-"10"}"
export NUM_POOLS="${NUM_POOLS:-"10"}" CLUSTERS_COUNT=1 TEST_THREADS=0

if [ -n "${INTERACTIVE:-""}" ]; then
export ROLLBACK_PAUSE=1 SCRIPTS_DIRNAME="${SCRIPTS_DIRNAME:-mainnet_fast}" PYTEST_ARGS="-s -k test_consensus_reached"
export ROLLBACK_PAUSE=1 SCRIPTS_DIRNAME="mainnet_fast" PYTEST_ARGS="-s -k test_consensus_reached"
"$TOP_DIR/.github/regression.sh"
else
export SCRIPTS_DIRNAME="${SCRIPTS_DIRNAME:-conway_fast}" PYTEST_ARGS="-k TestRollback"
export SCRIPTS_DIRNAME="conway_fast" PYTEST_ARGS="-k test_permanent_fork"
"$TOP_DIR/.github/regression.sh" || exit "$?"
export SCRIPTS_DIRNAME="mainnet_fast" PYTEST_ARGS="-k test_consensus_reached"
"$TOP_DIR/.github/regression.sh"
fi

export CLUSTERS_COUNT=1 TEST_THREADS=0

"$TOP_DIR/.github/regression.sh"
Loading