diff --git a/tools/shoestring/shoestring/commands/reset_data.py b/tools/shoestring/shoestring/commands/reset_data.py index a190b00a7..bf30360e3 100644 --- a/tools/shoestring/shoestring/commands/reset_data.py +++ b/tools/shoestring/shoestring/commands/reset_data.py @@ -3,7 +3,6 @@ from zenlog import log -from shoestring.internal.NodeFeatures import NodeFeatures from shoestring.internal.ShoestringConfiguration import parse_shoestring_configuration diff --git a/tools/shoestring/shoestring/healthagents/rest_api.py b/tools/shoestring/shoestring/healthagents/rest_api.py index 50a084096..ed3ad2f6f 100644 --- a/tools/shoestring/shoestring/healthagents/rest_api.py +++ b/tools/shoestring/shoestring/healthagents/rest_api.py @@ -2,8 +2,6 @@ from symbollightapi.model.Exceptions import NodeException from zenlog import log -from shoestring.internal.NodeFeatures import NodeFeatures - NAME = 'REST API' diff --git a/tools/shoestring/shoestring/healthagents/websockets.py b/tools/shoestring/shoestring/healthagents/websockets.py index cf563774d..b18580550 100644 --- a/tools/shoestring/shoestring/healthagents/websockets.py +++ b/tools/shoestring/shoestring/healthagents/websockets.py @@ -5,7 +5,6 @@ from zenlog import log from shoestring.internal.ConfigurationManager import parse_time_span -from shoestring.internal.NodeFeatures import NodeFeatures NAME = 'REST websockets' diff --git a/tools/shoestring/shoestring/internal/Preparer.py b/tools/shoestring/shoestring/internal/Preparer.py index 3fad2359d..8316d5516 100644 --- a/tools/shoestring/shoestring/internal/Preparer.py +++ b/tools/shoestring/shoestring/internal/Preparer.py @@ -257,7 +257,6 @@ def configure_resources(self, user_patches=None): ] }) - if NodeFeatures.HARVESTER in self.config.node.features: self.harvester_configurator.patch_configuration() else: @@ -279,7 +278,7 @@ def configure_resources(self, user_patches=None): def configure_rest(self, rest_overrides_filename=None): """Copies mongo and rest files.""" - if not NodeFeatures.API in self.config.node.features: + if NodeFeatures.API not in self.config.node.features: return rest_file_name = 'rest' if self.config.node.full_api else 'rest-light' diff --git a/tools/shoestring/tests/commands/test_reset_data.py b/tools/shoestring/tests/commands/test_reset_data.py index 88c92931d..17be7eaa6 100644 --- a/tools/shoestring/tests/commands/test_reset_data.py +++ b/tools/shoestring/tests/commands/test_reset_data.py @@ -58,6 +58,7 @@ async def test_can_reset_data_peer_node(): async def test_can_reset_data_api_node(): await _assert_reset_data(NodeFeatures.API, ['data', 'logs', 'dbdata']) + async def test_can_reset_data_light_api_node(): await _assert_reset_data(NodeFeatures.API, ['data', 'logs'], light_api=True) diff --git a/tools/shoestring/tests/commands/test_upgrade.py b/tools/shoestring/tests/commands/test_upgrade.py index a05f8889e..479f73b00 100644 --- a/tools/shoestring/tests/commands/test_upgrade.py +++ b/tools/shoestring/tests/commands/test_upgrade.py @@ -13,9 +13,9 @@ from ..test.TestPackager import prepare_testnet_package from .test_setup import ( API_OUTPUT_FILES, - LIGHT_API_OUTPUT_FILES, HARVESTER_OUTPUT_FILES, HTTPS_OUTPUT_FILES, + LIGHT_API_OUTPUT_FILES, PEER_OUTPUT_FILES, STATE_CHANGE_OUTPUT_FILES, VOTER_OUTPUT_FILES @@ -215,16 +215,19 @@ async def test_can_upgrade_api_node_with_https(server): # pylint: disable=redef expected_changed_files = sorted(PEER_CHANGED_FILES + API_CHANGED_FILES + HTTPS_CHANGED_FILES) await _assert_can_upgrade_node(server, NodeFeatures.API, expected_output_files, expected_changed_files, api_https=True) + async def test_can_upgrade_light_api_node(server): # pylint: disable=redefined-outer-name expected_output_files = {**PEER_OUTPUT_FILES, **LIGHT_API_OUTPUT_FILES} expected_changed_files = sorted(PEER_CHANGED_FILES + LIGHT_API_CHANGED_FILES) await _assert_can_upgrade_node(server, NodeFeatures.API, expected_output_files, expected_changed_files, light_api=True) + async def test_can_upgrade_light_api_node_with_https(server): # pylint: disable=redefined-outer-name expected_output_files = {**PEER_OUTPUT_FILES, **LIGHT_API_OUTPUT_FILES, **HTTPS_OUTPUT_FILES} expected_changed_files = sorted(PEER_CHANGED_FILES + LIGHT_API_CHANGED_FILES + HTTPS_CHANGED_FILES) await _assert_can_upgrade_node(server, NodeFeatures.API, expected_output_files, expected_changed_files, api_https=True, light_api=True) + async def test_can_upgrade_harvester_node(server): # pylint: disable=redefined-outer-name expected_output_files = {**PEER_OUTPUT_FILES, **HARVESTER_OUTPUT_FILES, **STATE_CHANGE_OUTPUT_FILES} expected_changed_files = sorted(PEER_CHANGED_FILES + HARVESTER_CHANGED_FILES) diff --git a/tools/shoestring/tests/healthagents/test_rest_api.py b/tools/shoestring/tests/healthagents/test_rest_api.py index 6e936b90a..e537e8bd4 100644 --- a/tools/shoestring/tests/healthagents/test_rest_api.py +++ b/tools/shoestring/tests/healthagents/test_rest_api.py @@ -60,6 +60,7 @@ def test_should_run_for_api_role(): for features in (NodeFeatures.PEER, NodeFeatures.HARVESTER, NodeFeatures.VOTER): assert not should_run(NodeConfiguration(features, *([None] * 7))), str(features) + def test_should_run_skip_for_light_api(): # Act + Assert: assert not should_run(NodeConfiguration(NodeFeatures.API, None, None, None, None, False, None, None)) diff --git a/tools/shoestring/tests/healthagents/test_websockets.py b/tools/shoestring/tests/healthagents/test_websockets.py index 065942d76..3e0148b9e 100644 --- a/tools/shoestring/tests/healthagents/test_websockets.py +++ b/tools/shoestring/tests/healthagents/test_websockets.py @@ -27,6 +27,7 @@ def test_should_run_for_api_role(): for features in (NodeFeatures.PEER, NodeFeatures.HARVESTER, NodeFeatures.VOTER): assert not should_run(NodeConfiguration(features, *([None] * 7))), str(features) + def test_should_run_skip_for_light_api(): # Act + Assert: assert not should_run(NodeConfiguration(NodeFeatures.API, None, None, None, None, False, None, None)) diff --git a/tools/shoestring/tests/internal/test_Preparer.py b/tools/shoestring/tests/internal/test_Preparer.py index fdfdbcd28..a363d1175 100644 --- a/tools/shoestring/tests/internal/test_Preparer.py +++ b/tools/shoestring/tests/internal/test_Preparer.py @@ -40,7 +40,7 @@ def _create_configuration(node_features, api_https=True, light_api=False, import None, TransactionConfiguration(234, 3, 0, 0, 0, 0), imports_config if imports_config else ImportsConfiguration(None, None), - NodeConfiguration(node_features, None, None, None, api_https, (NodeFeatures.API in node_features and not light_api) , 'CA CN', 'NODE CN')) + NodeConfiguration(node_features, *([None] * 3), api_https, (NodeFeatures.API in node_features and not light_api), 'CA CN', 'NODE CN')) def _assert_readonly(self, directory, filenames): self.assertEqual(0o700, directory.stat().st_mode & 0o777)