Skip to content

Commit

Permalink
Merge pull request #2781 from IntersectMBO/gov_testnet_tests
Browse files Browse the repository at this point in the history
Fix governance tests when running on long running testnets
  • Loading branch information
mkoura authored Nov 20, 2024
2 parents 145113e + 0f93c64 commit d86bce6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 4 additions & 5 deletions cardano_node_tests/tests/tests_conway/test_committee.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,15 @@ class TestCommittee:
@pytest.mark.smoke
def test_register_hot_key_no_cc_member(
self,
cluster_use_committee: governance_utils.GovClusterT,
payment_addr_comm: clusterlib.AddressRecord,
cluster: clusterlib.ClusterLib,
pool_user: clusterlib.PoolUser,
use_build_cmd: bool,
submit_method: str,
):
"""Try to submit a Hot Credential Authorization certificate without being a CC member.
Expect failure.
"""
cluster, __ = cluster_use_committee
temp_template = common.get_test_id(cluster)

cc_auth_record = governance_utils.get_cc_member_auth_record(
Expand All @@ -124,15 +123,15 @@ def test_register_hot_key_no_cc_member(

tx_files_auth = clusterlib.TxFiles(
certificate_files=[cc_auth_record.auth_cert],
signing_key_files=[payment_addr_comm.skey_file, cc_auth_record.cold_key_pair.skey_file],
signing_key_files=[pool_user.payment.skey_file, cc_auth_record.cold_key_pair.skey_file],
)

# Try to submit a Hot Credential Authorization certificate without being a CC member
with pytest.raises((clusterlib.CLIError, submit_api.SubmitApiError)) as excinfo:
clusterlib_utils.build_and_submit_tx(
cluster_obj=cluster,
name_template=f"{temp_template}_auth",
src_address=payment_addr_comm.address,
src_address=pool_user.payment.address,
submit_method=submit_method,
use_build_cmd=use_build_cmd,
tx_files=tx_files_auth,
Expand Down
1 change: 0 additions & 1 deletion cardano_node_tests/tests/tests_conway/test_guardrails.py
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,6 @@ def cost_models(cluster_with_constitution: ClusterWithConstitutionRecord):
class TestGovernanceGuardrails:
@allure.link(helpers.get_vcs_link())
@pytest.mark.long
@pytest.mark.testnets
def test_guardrails(
self,
cluster_with_constitution: ClusterWithConstitutionRecord,
Expand Down
5 changes: 5 additions & 0 deletions cardano_node_tests/utils/governance_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ def get_default_governance(
cluster_manager: cluster_management.ClusterManager,
cluster_obj: clusterlib.ClusterLib,
) -> governance_utils.GovernanceRecords:
"""Get default governance data for CC members, DReps and SPOs."""
if cluster_nodes.get_cluster_type().type == cluster_nodes.ClusterType.TESTNET:
err = "Default governance is not available on testnets"
raise ValueError(err)

cluster_env = cluster_nodes.get_cluster_env()
gov_data_dir = cluster_env.state_dir / GOV_DATA_DIR
gov_data_store = gov_data_dir / GOV_DATA_STORE
Expand Down

0 comments on commit d86bce6

Please sign in to comment.