summaryrefslogtreecommitdiffstats
path: root/docker/tests/test_discovery.py
diff options
context:
space:
mode:
Diffstat (limited to 'docker/tests/test_discovery.py')
-rw-r--r--docker/tests/test_discovery.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/docker/tests/test_discovery.py b/docker/tests/test_discovery.py
index 9a18519..cee75b1 100644
--- a/docker/tests/test_discovery.py
+++ b/docker/tests/test_discovery.py
@@ -38,3 +38,18 @@ def test_wrap_consul_call():
wrapped_foo = partial(dis._wrap_consul_call, foo_connection_error)
with pytest.raises(dis.DiscoveryConnectionError):
wrapped_foo("a", "b", "c")
+
+
+def test_find_matching_services():
+ services = { "component_dockerhost_1": ["foo", "bar"],
+ "platform_dockerhost": [], "component_dockerhost_2": ["baz"] }
+ assert sorted(["component_dockerhost_1", "component_dockerhost_2"]) \
+ == sorted(dis._find_matching_services(services, "component_dockerhost", []))
+
+ assert ["component_dockerhost_1"] == dis._find_matching_services(services, \
+ "component_dockerhost", ["foo", "bar"])
+
+ assert ["component_dockerhost_1"] == dis._find_matching_services(services, \
+ "component_dockerhost", ["foo"])
+
+ assert [] == dis._find_matching_services(services, "unknown", ["foo"])