diff options
author | Michael Hwang <mhwang@research.att.com> | 2017-09-06 17:46:45 -0400 |
---|---|---|
committer | Michael Hwang <mhwang@research.att.com> | 2017-09-06 17:50:51 -0400 |
commit | da9cdd6a23d2fa2748795a6c83b14cc4d3fa3d13 (patch) | |
tree | a9e7a8580b992ebec517edb67b8e2e612dd4ecec /docker/tests/test_discovery.py | |
parent | fcb0bb5252f8e90ce065e7e6f9034f9d1a4ef8ce (diff) |
Enhance to query Consul for target docker host
* `SelectedDockerHost` actually queries by a name stem and location
* Shorten name
* Tag components with deployment id
Change-Id: I715f1de25fa047ce70eb26a5cc7615cfd3b408e7
Issue-ID: DCAEGEN2-91
Signed-off-by: Michael Hwang <mhwang@research.att.com>
Diffstat (limited to 'docker/tests/test_discovery.py')
-rw-r--r-- | docker/tests/test_discovery.py | 15 |
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"]) |