summaryrefslogtreecommitdiffstats
path: root/docker/tests/test_discovery.py
diff options
context:
space:
mode:
authorMichael Hwang <mhwang@research.att.com>2018-02-06 14:39:10 -0500
committerMichael Hwang <mhwang@research.att.com>2018-02-19 11:50:04 -0500
commitbc19a3632f8df30e28876418f00cd96caa6dfa91 (patch)
treea20e60cb19c3970c45de3541f7cfbc29177dc881 /docker/tests/test_discovery.py
parent4798e6150c747e3c7d75589239488062f2ddbc91 (diff)
Increase unit test coverage
Update licenses for the files touched Change-Id: Ia8616d37d34ca57246c285eead1378131c5fb8dc Signed-off-by: Michael Hwang <mhwang@research.att.com> Issue-ID: DCAEGEN2-291
Diffstat (limited to 'docker/tests/test_discovery.py')
-rw-r--r--docker/tests/test_discovery.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/docker/tests/test_discovery.py b/docker/tests/test_discovery.py
index cee75b1..f3aed66 100644
--- a/docker/tests/test_discovery.py
+++ b/docker/tests/test_discovery.py
@@ -1,7 +1,7 @@
# ============LICENSE_START=======================================================
# org.onap.dcae
# ================================================================================
-# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -40,6 +40,12 @@ def test_wrap_consul_call():
wrapped_foo("a", "b", "c")
+def test_generate_service_component_name():
+ component_type = "some-component-type"
+ name = dis.generate_service_component_name(component_type)
+ assert name.split("_")[1] == component_type
+
+
def test_find_matching_services():
services = { "component_dockerhost_1": ["foo", "bar"],
"platform_dockerhost": [], "component_dockerhost_2": ["baz"] }
@@ -53,3 +59,11 @@ def test_find_matching_services():
"component_dockerhost", ["foo"])
assert [] == dis._find_matching_services(services, "unknown", ["foo"])
+
+
+def test_is_healthy_pure():
+ def fake_is_healthy(name):
+ return 0, [{ "Checks": [{"Status": "passing"}] }]
+
+ assert True == dis._is_healthy_pure(fake_is_healthy, "some-component")
+