From b08f1693f7cc5216362c8c4c5061bd1f6019cc96 Mon Sep 17 00:00:00 2001 From: Martin Kourim Date: Wed, 20 Nov 2024 13:46:23 +0100 Subject: [PATCH 1/3] feat(tests): remove testnets mark from guardrails test The @pytest.mark.testnets decorator was removed from the test_guardrails method in the TestGovernanceGuardrails class. The guardrails tests cannot currently run on testnets. We need to modify the tests to not try to update the guardrails script on testnets. --- cardano_node_tests/tests/tests_conway/test_guardrails.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cardano_node_tests/tests/tests_conway/test_guardrails.py b/cardano_node_tests/tests/tests_conway/test_guardrails.py index d00917b5d..d5476af9b 100644 --- a/cardano_node_tests/tests/tests_conway/test_guardrails.py +++ b/cardano_node_tests/tests/tests_conway/test_guardrails.py @@ -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, From 4bcbd074c4f342d30f0b6f29e562991614fb9116 Mon Sep 17 00:00:00 2001 From: Martin Kourim Date: Wed, 20 Nov 2024 13:49:09 +0100 Subject: [PATCH 2/3] refactor(tests): update test to run on testnets Making sure the test can run without setting up governance first. --- cardano_node_tests/tests/tests_conway/test_committee.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cardano_node_tests/tests/tests_conway/test_committee.py b/cardano_node_tests/tests/tests_conway/test_committee.py index f292bd684..0a8a623c1 100644 --- a/cardano_node_tests/tests/tests_conway/test_committee.py +++ b/cardano_node_tests/tests/tests_conway/test_committee.py @@ -105,8 +105,8 @@ 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, ): @@ -114,7 +114,6 @@ def test_register_hot_key_no_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( @@ -124,7 +123,7 @@ 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 @@ -132,7 +131,7 @@ def test_register_hot_key_no_cc_member( 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, From 0f93c647dd7350c6b6d4ba8befca5d2b61fe7956 Mon Sep 17 00:00:00 2001 From: Martin Kourim Date: Wed, 20 Nov 2024 13:55:05 +0100 Subject: [PATCH 3/3] feat(governance): add error for testnet default governance Raise a ValueError when attempting to get default governance on testnets. This ensures that the function does not proceed with unsupported operations on testnet environments. --- cardano_node_tests/utils/governance_setup.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cardano_node_tests/utils/governance_setup.py b/cardano_node_tests/utils/governance_setup.py index 49d44ff8f..87e5fe6ac 100644 --- a/cardano_node_tests/utils/governance_setup.py +++ b/cardano_node_tests/utils/governance_setup.py @@ -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