From 291849a432aca95c05ee1e68f73b3d8b9fd87ac5 Mon Sep 17 00:00:00 2001 From: Kim Fehrs <122281269+kofrdx@users.noreply.github.com> Date: Thu, 30 May 2024 12:30:35 +0200 Subject: [PATCH] fix / object comparisson always results in no differences (#124) * fix object comparisson * clean up test * reformat everything --- node-runner-cli/api/CustomAPIClient.py | 6 +- node-runner-cli/commands/dockercommand.py | 6 +- node-runner-cli/config/BaseConfig.py | 12 +- node-runner-cli/config/Genesis.py | 2 +- node-runner-cli/config/Renderer.py | 2 +- node-runner-cli/config/SystemDConfig.py | 2 +- node-runner-cli/setup/DockerSetup.py | 38 +++-- node-runner-cli/setup/SystemDSetup.py | 8 +- node-runner-cli/tests/unit/test_config.py | 10 ++ node-runner-cli/tests/unit/test_docker.py | 32 ++-- .../tests/unit/test_gateway_setup.py | 2 +- node-runner-cli/tests/unit/test_monitoring.py | 14 +- .../tests/unit/test_prompt_feeder_local.py | 156 +++++++++--------- node-runner-cli/tests/unit/test_systemd.py | 116 ++++++------- node-runner-cli/tests/unit/test_validator.py | 6 +- node-runner-cli/utils/Prompts.py | 4 +- node-runner-cli/version/__init__.py | 4 +- 17 files changed, 224 insertions(+), 196 deletions(-) diff --git a/node-runner-cli/api/CustomAPIClient.py b/node-runner-cli/api/CustomAPIClient.py index eea2975a..3ea4c7ab 100644 --- a/node-runner-cli/api/CustomAPIClient.py +++ b/node-runner-cli/api/CustomAPIClient.py @@ -19,9 +19,9 @@ def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value def prepare( - self, - http_method, - http_path, + self, + http_method, + http_path, ): req = requests.Request( http_method, f"{self._base_path}{http_path}", headers=self.default_headers diff --git a/node-runner-cli/commands/dockercommand.py b/node-runner-cli/commands/dockercommand.py index 27b4747a..80e333c4 100644 --- a/node-runner-cli/commands/dockercommand.py +++ b/node-runner-cli/commands/dockercommand.py @@ -242,6 +242,9 @@ def install(args): ########## Update existing Config docker_config: DockerConfig = DockerSetup.load_settings(argument_object.config_file) + + original_config_dict = docker_config.to_dict() + docker_config_updated_versions = ( DockerSetup.update_versions(docker_config, argument_object.autoapprove) if argument_object.update @@ -251,8 +254,9 @@ def install(args): docker_config_updated_versions = DockerSetup.check_set_passwords( docker_config_updated_versions ) + DockerSetup.confirm_config_changes( - argument_object, docker_config, docker_config_updated_versions + argument_object, original_config_dict, docker_config_updated_versions ) ########## Install dependent services diff --git a/node-runner-cli/config/BaseConfig.py b/node-runner-cli/config/BaseConfig.py index 8ac7e69d..e1c4987b 100644 --- a/node-runner-cli/config/BaseConfig.py +++ b/node-runner-cli/config/BaseConfig.py @@ -2,6 +2,8 @@ import yaml +from deepdiff import DeepDiff + class BaseConfig: def __iter__(self): @@ -52,8 +54,8 @@ def to_dict(self): for attr, value in class_variables.items(): returning_dict[attr] = "" if ( - type(self.__getattribute__(attr)) not in (str, int, bool, dict) - and self.__getattribute__(attr) is not None + type(self.__getattribute__(attr)) not in (str, int, bool, dict) + and self.__getattribute__(attr) is not None ): returning_dict[attr] = self.__getattribute__(attr).to_dict() else: @@ -79,6 +81,12 @@ def to_file(self, config_file): f.write("# than manually edit this file\n") yaml.dump(config_to_dump, f, sort_keys=True, default_flow_style=False) + def compare_to_dict(self, config_as_dict: dict) -> dict: + return dict(DeepDiff(config_as_dict, self.to_dict())) + + def compare_to_object(self, config_object: BaseConfig) -> dict: + return dict(DeepDiff(config_object.to_dict(), self.to_dict())) + class SetupMode: _instance = None diff --git a/node-runner-cli/config/Genesis.py b/node-runner-cli/config/Genesis.py index 70ac27a2..a1611d30 100644 --- a/node-runner-cli/config/Genesis.py +++ b/node-runner-cli/config/Genesis.py @@ -15,7 +15,7 @@ def create_genesis_file(genesis_json_location: str, genesis: str): @staticmethod def copy_genesis_file( - genesis_bin_data_file: str, genesis_files="testnet-genesis" + genesis_bin_data_file: str, genesis_files="testnet-genesis" ) -> str: bundle_dir = getattr(sys, "_MEIPASS", os.getcwd()) path_to_genesis_bin_file = getenv( diff --git a/node-runner-cli/config/Renderer.py b/node-runner-cli/config/Renderer.py index 7e1deeff..55ddaae5 100644 --- a/node-runner-cli/config/Renderer.py +++ b/node-runner-cli/config/Renderer.py @@ -6,7 +6,7 @@ class Renderer: def load_file_based_template( - self, template_file_name: str, templates_dir="templates" + self, template_file_name: str, templates_dir="templates" ): templates_path = join(dirname(dirname(__file__)), templates_dir) self.env = Environment( diff --git a/node-runner-cli/config/SystemDConfig.py b/node-runner-cli/config/SystemDConfig.py index 0259d850..0da75efb 100644 --- a/node-runner-cli/config/SystemDConfig.py +++ b/node-runner-cli/config/SystemDConfig.py @@ -111,7 +111,7 @@ def append_advanced_user_config(self, config_file: str, advanced_config_file: st f1.write(f2.read()) def create_service_file( - self, service_file_path="/etc/systemd/system/radixdlt-node.service" + self, service_file_path="/etc/systemd/system/radixdlt-node.service" ): # This may need to be moved to jinja template tmp_service: str = "/tmp/radixdlt-node.service" diff --git a/node-runner-cli/setup/DockerSetup.py b/node-runner-cli/setup/DockerSetup.py index 84d7a53c..6201dc04 100644 --- a/node-runner-cli/setup/DockerSetup.py +++ b/node-runner-cli/setup/DockerSetup.py @@ -1,5 +1,4 @@ import getpass -import json import os import sys @@ -36,6 +35,7 @@ def print_questionary_header(config_file): class DockerSetup(BaseSetup): + @staticmethod def save_config(config: DockerConfig, config_file: str, autoapprove=False): to_update = "" @@ -330,8 +330,9 @@ def questionary(argument_object: DockerConfigArguments) -> DockerConfig: docker_config.common_config.ask_enable_nginx_for_core( argument_object.nginx_on_core ) - docker_config.core_node.engine_state_enabled = BaseSetup.ask_engine_state_api( - argument_object.autoapprove) + docker_config.core_node.engine_state_enabled = ( + BaseSetup.ask_engine_state_api(argument_object.autoapprove) + ) else: del docker_config.core_node @@ -345,7 +346,6 @@ def questionary(argument_object: DockerConfigArguments) -> DockerConfig: else: del docker_config.gateway - if ( "MIGRATION" in argument_object.setupmode.mode and docker_config.core_node is not None @@ -372,11 +372,12 @@ def compare_config_file_with_config_object( if os.path.exists(config_file): old_config: DockerConfig = DockerSetup.load_settings(config_file) if old_config is not None: + differences = config_object.compare_to_object(old_config) logger.info( f""" {Helpers.section_headline("Differences")} Difference between existing config file and new config that you are creating - {dict(DeepDiff(old_config, config_object.to_dict()))} + {differences} """ ) @@ -400,23 +401,20 @@ def render_docker_compose(docker_config: DockerConfig): @staticmethod def confirm_config_changes( argument_object: DockerInstallArguments, - docker_config, - docker_config_updated_versions, + original_config_dict: dict, + updated_config_object: DockerConfig, ): - config_differences = dict( - DeepDiff(docker_config, docker_config_updated_versions) - ) + config_differences = updated_config_object.compare_to_dict(original_config_dict) if len(config_differences) != 0: print( f""" {Helpers.section_headline("Differences in config file with updated software versions")} Difference between existing config file and new config that you are creating - {config_differences} - """ + {config_differences} """ ) DockerSetup.save_config( - docker_config_updated_versions, + updated_config_object, argument_object.config_file, argument_object.autoapprove, ) @@ -425,13 +423,17 @@ def confirm_config_changes( def confirm_docker_compose_file_changes( docker_config: DockerConfig, autoapprove: bool ): - docker_compose_yaml: yaml = DockerSetup.render_docker_compose(docker_config) + docker_compose_yaml_rendered: yaml = DockerSetup.render_docker_compose( + docker_config + ) backup_time = Helpers.get_current_date_time() - compose_file_yaml = DockerSetup.get_existing_compose_file( + docker_compose_yaml_from_file = DockerSetup.get_existing_compose_file( docker_config.common_config.docker_compose ) compose_file = docker_config.common_config.docker_compose - compose_file_difference = dict(DeepDiff(compose_file_yaml, docker_compose_yaml)) + compose_file_difference = dict( + DeepDiff(docker_compose_yaml_from_file, docker_compose_yaml_rendered) + ) if len(compose_file_difference) != 0: logger.info( f""" @@ -451,7 +453,9 @@ def confirm_docker_compose_file_changes( if Helpers.check_Yes(to_update) or autoapprove: if os.path.exists(compose_file): Helpers.backup_file(compose_file, f"{compose_file}_{backup_time}") - DockerSetup.save_compose_file(compose_file, docker_compose_yaml) + DockerSetup.save_compose_file( + compose_file, docker_compose_yaml_rendered + ) run_shell_command(f"cat {compose_file}", shell=True) return compose_file diff --git a/node-runner-cli/setup/SystemDSetup.py b/node-runner-cli/setup/SystemDSetup.py index 7b0b1968..254c9bb0 100644 --- a/node-runner-cli/setup/SystemDSetup.py +++ b/node-runner-cli/setup/SystemDSetup.py @@ -399,14 +399,14 @@ def load_settings(config_file) -> SystemDConfig: def compare_old_and_new_config(config_file: str, systemd_config: SystemDConfig): old_config_object = SystemDSetup.load_settings(config_file) old_config = old_config_object.to_dict() - config_to_dump = systemd_config.to_dict() if old_config is not None: if len(old_config) != 0: + differences = systemd_config.compare_to_dict(old_config) print( f""" {Helpers.section_headline("Differences")} Difference between existing config file and new config that you are creating - {dict(DeepDiff(old_config, config_to_dump))} + {differences} """ ) @@ -513,7 +513,9 @@ def ask_core_node(argument_object: SystemDConfigArguments) -> CoreSystemdConfig: systemd_config.core_node.keydetails = BaseSetup.ask_keydetails( argument_object.keystore_password, argument_object.new_keystore ) - systemd_config.core_node.engine_state_enabled = BaseSetup.ask_engine_state_api(argument_object.auto_approve) + systemd_config.core_node.engine_state_enabled = BaseSetup.ask_engine_state_api( + argument_object.auto_approve + ) return systemd_config.core_node @staticmethod diff --git a/node-runner-cli/tests/unit/test_config.py b/node-runner-cli/tests/unit/test_config.py index 019d0f47..1dd30b56 100644 --- a/node-runner-cli/tests/unit/test_config.py +++ b/node-runner-cli/tests/unit/test_config.py @@ -3,7 +3,9 @@ import yaml from yaml import UnsafeLoader +from deepdiff import DeepDiff +from config.DockerConfig import DockerConfig from config.Nginx import SystemdNginxConfig from config.SystemDConfig import SystemDConfig from utils.Network import Network @@ -39,6 +41,14 @@ def test_network_id_can_be_parsed(self): self.assertEqual(Network.validate_network_id("S"), 2) self.assertEqual(Network.validate_network_id("stokenet"), 2) + def test_compare_to_dict(self): + config: DockerConfig = DockerConfig({}) + config_dict = config.to_dict() + config.core_node.core_release = "randomvalue" + self.assertTrue(len(config.compare_to_dict(config_dict)) != 0) + config_dict = config.to_dict() + self.assertTrue(len(config.compare_to_dict(config_dict)) == 0) + def suite(): """This defines all the tests of a module""" diff --git a/node-runner-cli/tests/unit/test_docker.py b/node-runner-cli/tests/unit/test_docker.py index d2043595..802a8ad9 100644 --- a/node-runner-cli/tests/unit/test_docker.py +++ b/node-runner-cli/tests/unit/test_docker.py @@ -15,24 +15,24 @@ class DockerUnitTests(unittest.TestCase): def test_docker_config(self, mockout): urllib3.disable_warnings() with patch( - "builtins.input", - side_effect=["N", "N", "/home/runner/docker-compose.yml", "N"], + "builtins.input", + side_effect=["N", "N", "/home/runner/docker-compose.yml", "N"], ): with patch( - "sys.argv", - [ - "main", - "docker", - "config", - "-m", - "DETAILED", - "-n", - "2", - "-k", - "radix", - "-nk", - "-a", - ], + "sys.argv", + [ + "main", + "docker", + "config", + "-m", + "DETAILED", + "-n", + "2", + "-k", + "radix", + "-nk", + "-a", + ], ): main() diff --git a/node-runner-cli/tests/unit/test_gateway_setup.py b/node-runner-cli/tests/unit/test_gateway_setup.py index ee1a47ba..9ef46168 100644 --- a/node-runner-cli/tests/unit/test_gateway_setup.py +++ b/node-runner-cli/tests/unit/test_gateway_setup.py @@ -209,7 +209,7 @@ def test_setup_gateway_compose_file_fixture_test(self, mockout): self.assertEqual(f1.read(), f2.read()) def expect_ask_gateway_inputs_get_inserted_into_object( - self, config, questionary_keyboard_input + self, config, questionary_keyboard_input ): self.assertEqual( questionary_keyboard_input[0], diff --git a/node-runner-cli/tests/unit/test_monitoring.py b/node-runner-cli/tests/unit/test_monitoring.py index 55b4cdf4..aa0c01bd 100644 --- a/node-runner-cli/tests/unit/test_monitoring.py +++ b/node-runner-cli/tests/unit/test_monitoring.py @@ -67,24 +67,24 @@ def test_template_failure(self, mock_stdout): @mock.patch("sys.stdout", new_callable=StringIO) def test_monitoring_config(self, mock_out): with mock.patch( - "builtins.input", - side_effect=["Y", "https://45.152.180.182", "metrics", "testpassword", "n"], + "builtins.input", + side_effect=["Y", "https://45.152.180.182", "metrics", "testpassword", "n"], ): with mock.patch("sys.argv", ["main", "monitoring", "config"]): main() with mock.patch( - "sys.argv", - ["main", "monitoring", "config", "-m", "MONITOR_CORE", "-cm", "test"], + "sys.argv", + ["main", "monitoring", "config", "-m", "MONITOR_CORE", "-cm", "test"], ): main() with mock.patch( - "builtins.input", - side_effect=["Y", "https://45.152.180.182", "metrics", "testpassword", "n"], + "builtins.input", + side_effect=["Y", "https://45.152.180.182", "metrics", "testpassword", "n"], ): with mock.patch( - "sys.argv", ["main", "monitoring", "config", "-m", "DETAILED"] + "sys.argv", ["main", "monitoring", "config", "-m", "DETAILED"] ): main() diff --git a/node-runner-cli/tests/unit/test_prompt_feeder_local.py b/node-runner-cli/tests/unit/test_prompt_feeder_local.py index 6cbdef50..9d405bbe 100644 --- a/node-runner-cli/tests/unit/test_prompt_feeder_local.py +++ b/node-runner-cli/tests/unit/test_prompt_feeder_local.py @@ -38,48 +38,48 @@ def test_docker_config_gateway_external_postgres(self, mockout): PROMPT_NGINX_IMAGE_VERSION = "" PROMPT_CONFIRM_CONFIG = "Y" with patch( - "builtins.input", - side_effect=[ - PROMPT_NETWORKID, - PROMPT_FULLNODE_YES_NO, - # PROMPT_SEEDNODES, - PROMPT_VALIDATOR_ADDRESS, - PROMPT_EXISTING_KEYSTORE, - PROMPT_KEYSTORE_LOCATION, - PROMPT_KEYSTORE_FILE_NAME, - PROMPT_LEDGER_LOCATION, - PROMPT_NGINX_PROTECT_CORE_API, - PROMPT_ENABLE_GATEWAY, - PROMPT_GATEWAY_CORE_API_URL, - PROMPT_GATEWAY_CORE_API_NAME, - PROMPT_POSTGRES_LOCAL_REMOTE, - PROMPT_POSTGRES_REMOTE_URL, - PROMPT_POSTGRES_REMOTE_PORT, - PROMPT_POSTGRES_DATABASE_NAME, - PROMPT_POSTGRES_USERNAME, - PROMPT_POSTGRES_PASSWORD, - PROMPT_GATEWAY_IMAGE_VERSION, - PROMPT_MIGRATION_IMAGE_VERSION, - PROMPT_AGGREGATOR_IMAGE_VERSION, - PROMPT_NGINX_PROTECT_GATEWAY, - PROMPT_NGINX_IMAGE_VERSION, - PROMPT_CONFIRM_CONFIG, - ], + "builtins.input", + side_effect=[ + PROMPT_NETWORKID, + PROMPT_FULLNODE_YES_NO, + # PROMPT_SEEDNODES, + PROMPT_VALIDATOR_ADDRESS, + PROMPT_EXISTING_KEYSTORE, + PROMPT_KEYSTORE_LOCATION, + PROMPT_KEYSTORE_FILE_NAME, + PROMPT_LEDGER_LOCATION, + PROMPT_NGINX_PROTECT_CORE_API, + PROMPT_ENABLE_GATEWAY, + PROMPT_GATEWAY_CORE_API_URL, + PROMPT_GATEWAY_CORE_API_NAME, + PROMPT_POSTGRES_LOCAL_REMOTE, + PROMPT_POSTGRES_REMOTE_URL, + PROMPT_POSTGRES_REMOTE_PORT, + PROMPT_POSTGRES_DATABASE_NAME, + PROMPT_POSTGRES_USERNAME, + PROMPT_POSTGRES_PASSWORD, + PROMPT_GATEWAY_IMAGE_VERSION, + PROMPT_MIGRATION_IMAGE_VERSION, + PROMPT_AGGREGATOR_IMAGE_VERSION, + PROMPT_NGINX_PROTECT_GATEWAY, + PROMPT_NGINX_IMAGE_VERSION, + PROMPT_CONFIRM_CONFIG, + ], ): with patch( - "sys.argv", - [ - "main", - "docker", - "config", - "-m", - "DETAILED", - "-k", - "radix", - "-nk", - "-t", - "asdasd", - ], + "sys.argv", + [ + "main", + "docker", + "config", + "-m", + "DETAILED", + "-k", + "radix", + "-nk", + "-t", + "asdasd", + ], ): main() @@ -112,46 +112,46 @@ def test_docker_config_all_local(self, mockout): PROMPT_NGINX_IMAGE_VERSION = "" PROMPT_CONFIRM_CONFIG = "Y" with patch( - "builtins.input", - side_effect=[ - PROMPT_NETWORKID, - PROMPT_FULLNODE_YES_NO, - PROMPT_SEEDNODES, - PROMPT_VALIDATOR_ADDRESS, - PROMPT_EXISTING_KEYSTORE, - PROMPT_KEYSTORE_LOCATION, - PROMPT_KEYSTORE_FILE_NAME, - PROMPT_LEDGER_LOCATION, - PROMPT_NGINX_PROTECT_CORE_API, - PROMPT_ENABLE_GATEWAY, - PROMPT_GATEWAY_CORE_API_URL, - PROMPT_GATEWAY_CORE_API_NAME, - PROMPT_POSTGRES_LOCAL_REMOTE, - PROMPT_POSTGRES_USERNAME, - PROMPT_POSTGRES_DATABASE_NAME, - PROMPT_POSTGRES_PASSWORD, - PROMPT_GATEWAY_IMAGE_VERSION, - PROMPT_MIGRATION_IMAGE_VERSION, - PROMPT_AGGREGATOR_IMAGE_VERSION, - PROMPT_NGINX_PROTECT_GATEWAY, - PROMPT_NGINX_IMAGE_VERSION, - ], + "builtins.input", + side_effect=[ + PROMPT_NETWORKID, + PROMPT_FULLNODE_YES_NO, + PROMPT_SEEDNODES, + PROMPT_VALIDATOR_ADDRESS, + PROMPT_EXISTING_KEYSTORE, + PROMPT_KEYSTORE_LOCATION, + PROMPT_KEYSTORE_FILE_NAME, + PROMPT_LEDGER_LOCATION, + PROMPT_NGINX_PROTECT_CORE_API, + PROMPT_ENABLE_GATEWAY, + PROMPT_GATEWAY_CORE_API_URL, + PROMPT_GATEWAY_CORE_API_NAME, + PROMPT_POSTGRES_LOCAL_REMOTE, + PROMPT_POSTGRES_USERNAME, + PROMPT_POSTGRES_DATABASE_NAME, + PROMPT_POSTGRES_PASSWORD, + PROMPT_GATEWAY_IMAGE_VERSION, + PROMPT_MIGRATION_IMAGE_VERSION, + PROMPT_AGGREGATOR_IMAGE_VERSION, + PROMPT_NGINX_PROTECT_GATEWAY, + PROMPT_NGINX_IMAGE_VERSION, + ], ): with patch( - "sys.argv", - [ - "main", - "docker", - "config", - "-m", - "DETAILED", - "-k", - "radix", - "-nk", - "-a", - "-d", - "/tmp", - ], + "sys.argv", + [ + "main", + "docker", + "config", + "-m", + "DETAILED", + "-k", + "radix", + "-nk", + "-a", + "-d", + "/tmp", + ], ): main() diff --git a/node-runner-cli/tests/unit/test_systemd.py b/node-runner-cli/tests/unit/test_systemd.py index 3e1a080e..6ae16e40 100644 --- a/node-runner-cli/tests/unit/test_systemd.py +++ b/node-runner-cli/tests/unit/test_systemd.py @@ -33,34 +33,34 @@ def file_contains_regular_expression(re_str: str, file: str) -> bool: class SystemdUnitTests(unittest.TestCase): @unittest.skip("Tests with PROMPT_FEEDS can only be run individually") def test_systemd_install_continue_prompt_feed(self): - os.environ[ - "PROMPT_FEEDS" - ] = "test-prompts/individual-prompts/systemd_install_continue.yml" + os.environ["PROMPT_FEEDS"] = ( + "test-prompts/individual-prompts/systemd_install_continue.yml" + ) PromptFeeder.instance().load_prompt_feeds() SystemDSetup.confirm_config("dummy1", "dummy2", "dummy3", "dummy4") @unittest.skip("Can only be executed on Ubuntu") def test_systemd_config_can_run_without_prompt(self): with patch( - "sys.argv", - [ - "main", - "systemd", - "config", - "-a", - "-t", - "somenode", - "-i", - "123.123.123.123", - "-k", - "password", - "-n", - "S", - "-d", - "/tmp/config", - "-dd", - "/tmp/babylon-ledger", - ], + "sys.argv", + [ + "main", + "systemd", + "config", + "-a", + "-t", + "somenode", + "-i", + "123.123.123.123", + "-k", + "password", + "-n", + "S", + "-d", + "/tmp/config", + "-dd", + "/tmp/babylon-ledger", + ], ): main() @@ -111,48 +111,48 @@ def test_systemd_config(self, mockout): ) with patch("builtins.input", side_effect=["Y"]): with patch( - "sys.argv", - [ - "main", - "systemd", - "config", - "-m", - "CORE", - "-i", - "18.133.170.30", - "-t", - "radix://tn1q28eygvxshszxk48jhjxdmyne06m3x6hfyvxg7a45qt8cksffx6z7uu6392@15.236.228.96", - "-n", - "2", - "-k", - "radix", - "-d", - "/tmp", - "-dd", - "/tmp", - "-v", - "randomvalidatoraddress", - "-nk", - "-a", - "-r", - "1", - ], - ): - main() - - @unittest.skip("For verification only") - def test_systemd_install_manual(self): - with patch( "sys.argv", [ "main", "systemd", - "install", - "-a", + "config", "-m", - "-f", - "/tmp/babylon-node/test-config.yaml", + "CORE", + "-i", + "18.133.170.30", + "-t", + "radix://tn1q28eygvxshszxk48jhjxdmyne06m3x6hfyvxg7a45qt8cksffx6z7uu6392@15.236.228.96", + "-n", + "2", + "-k", + "radix", + "-d", + "/tmp", + "-dd", + "/tmp", + "-v", + "randomvalidatoraddress", + "-nk", + "-a", + "-r", + "1", ], + ): + main() + + @unittest.skip("For verification only") + def test_systemd_install_manual(self): + with patch( + "sys.argv", + [ + "main", + "systemd", + "install", + "-a", + "-m", + "-f", + "/tmp/babylon-node/test-config.yaml", + ], ): main() diff --git a/node-runner-cli/tests/unit/test_validator.py b/node-runner-cli/tests/unit/test_validator.py index 714afa83..93f91939 100644 --- a/node-runner-cli/tests/unit/test_validator.py +++ b/node-runner-cli/tests/unit/test_validator.py @@ -84,9 +84,9 @@ def test_validator_address_included_in_dict_from_object(self): @mock.patch("sys.stdout", new_callable=StringIO) def test_validator_promptfeed(self, mock_out): - os.environ[ - "PROMPT_FEEDS" - ] = "test-prompts/individual-prompts/validator_address.yml" + os.environ["PROMPT_FEEDS"] = ( + "test-prompts/individual-prompts/validator_address.yml" + ) PromptFeeder.prompts_feed = PromptFeeder.instance().load_prompt_feeds() address = Prompts.ask_validator_address() self.assertEqual("validator_mock", address) diff --git a/node-runner-cli/utils/Prompts.py b/node-runner-cli/utils/Prompts.py index 86acfac4..a4dc12d1 100644 --- a/node-runner-cli/utils/Prompts.py +++ b/node-runner-cli/utils/Prompts.py @@ -254,7 +254,7 @@ def ask_engine_state_api(auto_approve: bool) -> bool: return False answer = Helpers.input_guestion( "Do you want to enable the engine state api? (Y/N) (default: false):", - QuestionKeys.enable_engine_state_api + QuestionKeys.enable_engine_state_api, ) if answer == "": return False @@ -404,7 +404,7 @@ def warn_slow_command(): @staticmethod def confirm_version_updates( - config_version, latest_version, software="CORE", autoapprove=False + config_version, latest_version, software="CORE", autoapprove=False ): if autoapprove: return latest_version diff --git a/node-runner-cli/version/__init__.py b/node-runner-cli/version/__init__.py index 023c1f47..1f0d4930 100644 --- a/node-runner-cli/version/__init__.py +++ b/node-runner-cli/version/__init__.py @@ -1,2 +1,2 @@ -__version__= "2.1.2-5-g67e404b" -__base_version__= "2.1.2" +__version__ = "2.1.2-5-g67e404b" +__base_version__ = "2.1.2"