Skip to content

Commit

Permalink
Merge branch 'develop' into md5_sum_file_chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBurchLog committed Sep 17, 2024
2 parents 9b2bd69 + c7c5972 commit 733a196
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Brewtils Changelog
TBD

- Apply MD5 Check Sum of chunked files to ensure files are loaded into memory properly
- Updated SystemClient to utilize the local Garden name for default Namespace if none can be determined

3.27.2
------
Expand Down
8 changes: 6 additions & 2 deletions brewtils/rest/system_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,14 @@ def __init__(self, *args, **kwargs):
self._system_name = brewtils.plugin.CONFIG.name
self._version_constraint = brewtils.plugin.CONFIG.version
self._default_instance = brewtils.plugin.CONFIG.instance_name
self._system_namespace = brewtils.plugin.CONFIG.namespace or ""
self._system_namespace = brewtils.plugin.CONFIG.namespace or None

else:
self._system_name = kwargs.get("system_name")
self._version_constraint = kwargs.get("version_constraint", "latest")
self._default_instance = kwargs.get("default_instance", "default")
self._system_namespace = kwargs.get(
"system_namespace", brewtils.plugin.CONFIG.namespace or ""
"system_namespace", brewtils.plugin.CONFIG.namespace or None
)
self._system_namespaces = kwargs.get("system_namespaces", [])

Expand Down Expand Up @@ -278,6 +278,10 @@ def __init__(self, *args, **kwargs):
kwargs.setdefault("stacklevel", 5)

self._easy_client = EasyClient(*args, **kwargs)

if self._system_namespace is None:
self._system_namespace = self._easy_client.get_config()["garden_name"]

self._resolver = ResolutionManager(easy_client=self._easy_client)
self.local_request_handler = LocalRequestProcessor(
system=self._system,
Expand Down
7 changes: 4 additions & 3 deletions test/rest/system_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def easy_client(monkeypatch, bg_system):
mock = Mock(name="easy_client")
mock.find_unique_system.return_value = bg_system
mock.find_systems.return_value = [bg_system]
mock.get_config.return_value = {"garden_name": bg_system.namespace}
mock.client.bg_host = "localhost"
mock.client.bg_port = 3000

Expand Down Expand Up @@ -104,7 +105,7 @@ def test_latest(self, client, easy_client, bg_system, bg_system_2):
assert client.bg_system == bg_system_2
assert client.bg_default_instance == "default"
easy_client.find_systems.assert_called_once_with(
name=bg_system.name, namespace="", filter_latest=True
name=bg_system.name, namespace="ns", filter_latest=True
)

@pytest.mark.parametrize(
Expand All @@ -120,7 +121,7 @@ def test_non_latest(self, client, easy_client, bg_system, constraint, systems):
assert client.bg_system == bg_system

easy_client.find_unique_system.assert_called_once_with(
name=bg_system.name, version=constraint, namespace=""
name=bg_system.name, version=constraint, namespace="ns"
)

def test_failure_with_constraint(self, client, easy_client):
Expand Down Expand Up @@ -219,7 +220,7 @@ def test_non_plugin(self):
assert client._system_name is None
assert client._version_constraint == "latest"
assert client._default_instance == "default"
assert client._system_namespace == ""
assert client._system_namespace == "ns"


class TestCreateRequest(object):
Expand Down

0 comments on commit 733a196

Please sign in to comment.