Skip to content

Commit

Permalink
[tools/shoestring]: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyLaw committed Nov 22, 2024
1 parent d9c8df5 commit 2434401
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion tools/shoestring/shoestring/commands/reset_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from zenlog import log

from shoestring.internal.NodeFeatures import NodeFeatures
from shoestring.internal.ShoestringConfiguration import parse_shoestring_configuration


Expand Down
2 changes: 0 additions & 2 deletions tools/shoestring/shoestring/healthagents/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from symbollightapi.model.Exceptions import NodeException
from zenlog import log

from shoestring.internal.NodeFeatures import NodeFeatures

NAME = 'REST API'


Expand Down
1 change: 0 additions & 1 deletion tools/shoestring/shoestring/healthagents/websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
3 changes: 1 addition & 2 deletions tools/shoestring/shoestring/internal/Preparer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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'
Expand Down
1 change: 1 addition & 0 deletions tools/shoestring/tests/commands/test_reset_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion tools/shoestring/tests/commands/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tools/shoestring/tests/healthagents/test_rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions tools/shoestring/tests/healthagents/test_websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion tools/shoestring/tests/internal/test_Preparer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2434401

Please sign in to comment.