-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Enable MQTT clusters (#115)
* Added support for multiple MQTT brokers to enable clustering * Bump version to 4.5.0
1 parent
35b220c
commit 38c4ddf
Showing
4 changed files
with
139 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
Kraken version information. | ||
""" | ||
|
||
__version__ = "4.4.0" | ||
__version__ = "4.5.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
Tests for the input environment variable parser. | ||
""" | ||
|
||
import pytest | ||
from pydantic import ValidationError | ||
|
||
from managers import MQTTParams | ||
|
||
|
||
@pytest.mark.parametrize( | ||
["hosts", "result"], | ||
[ | ||
["example.com", [("example.com", 1883)]], | ||
["example.com:1234", [("example.com", 1234)]], | ||
["example1.com,example2.com", [("example1.com", 1883), ("example2.com", 1883)]], | ||
["example1.com, example2.com", [("example1.com", 1883), ("example2.com", 1883)]], | ||
["example1.com:1234,example2.com", [("example1.com", 1234), ("example2.com", 1883)]], | ||
["example1.com:1234,example2.com:0", [("example1.com", 1234), ("example2.com", 1883)]], | ||
], | ||
) | ||
def test_mqtt_hostnames_pass(hosts, result): | ||
""" | ||
Test parsing hostname(s) from env variables. | ||
""" | ||
env_params = MQTTParams(hosts=hosts, identifier="foo", username="bar", password="12345") | ||
|
||
assert env_params.hosts == result | ||
|
||
|
||
@pytest.mark.parametrize( | ||
["hosts", "expectation"], | ||
[ | ||
["example.com:123456", pytest.raises(ValidationError)], | ||
["e^xample.com", pytest.raises(ValidationError)], | ||
["example.com:-1", pytest.raises(ValidationError)], | ||
], | ||
) | ||
def test_mqtt_hostnames_fail(hosts, expectation): | ||
""" | ||
Test parsing hostname(s) from env variables. Test invalid hostnames. | ||
""" | ||
with expectation: | ||
MQTTParams(hosts=hosts, identifier="foo", username="bar", password="12345") |