Skip to content

Commit

Permalink
Updating Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBurchLog committed Sep 20, 2024
1 parent 08fd470 commit 6130479
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion brewtils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def load_config(
if "bg_url_prefix" in config:
config.bg_url_prefix = normalize_url_prefix(config.bg_url_prefix)

if "max_concurrent" in config and config.max_concurrent < 0:
if "max_concurrent" not in config or config.max_concurrent < 0:
config.max_concurrent = min(32, os.cpu_count() + 4)

return config
Expand Down
19 changes: 19 additions & 0 deletions test/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ def params():
}


class TestMaxConcurrent(object):

def test_negative_max_concurrent(self, monkeypatch, params):
monkeypatch.setattr(os, "cpu_count", Mock(return_value=2))

cli_args = ["-max_concurrent", "-1"]
config = load_config(cli_args=cli_args)

assert config["max_concurrent"] == 8

def test_positive_max_concurrent(self, monkeypatch, params):
monkeypatch.setattr(os, "cpu_count", Mock(return_value=2))

cli_args = ["-max_concurrent", "3"]
config = load_config(cli_args=cli_args)

assert config["max_concurrent"] == 3


class TestGetConnectionInfo(object):
def test_kwargs(self, params):
assert params == get_connection_info(**params)
Expand Down

0 comments on commit 6130479

Please sign in to comment.