summaryrefslogtreecommitdiffstats
path: root/dovetail/tests/unit/utils
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2019-11-13 03:32:24 -0500
committerDan Xu <xudan16@huawei.com>2019-11-19 10:57:03 +0000
commit88dee82da16683c7796036ae6e20a2d7c1f6b162 (patch)
treed82bb8ead2c4b8bdfe66d817e9159c90f1a6fb6a /dovetail/tests/unit/utils
parentb88e2328f7960d88aa979d01ad6ba6f06519b899 (diff)
Fix exception when running HA tests without pod.yaml
1. use volumes '-v' to map files/directories which may be non-existing 2. use mounts '--mount' to map files/directories which couldn't be non-existing JIRA: DOVETAIL-789 Change-Id: I2184e5baed3d1491a2df4d3a1a77a11e3e9b4fc8 Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'dovetail/tests/unit/utils')
-rw-r--r--dovetail/tests/unit/utils/test_dovetail_utils.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/dovetail/tests/unit/utils/test_dovetail_utils.py b/dovetail/tests/unit/utils/test_dovetail_utils.py
index 7ec177d1..7d1fddc1 100644
--- a/dovetail/tests/unit/utils/test_dovetail_utils.py
+++ b/dovetail/tests/unit/utils/test_dovetail_utils.py
@@ -1380,3 +1380,23 @@ class DovetailUtilsTesting(unittest.TestCase):
logger.debug.assert_not_called()
logger.exception.assert_called_once_with(
"The results cannot be pushed to DB.")
+
+ def test_get_mount_list_error_mount(self):
+ project_cfg = {'mounts': ['aaa']}
+ res, msg = dovetail_utils.get_mount_list(project_cfg)
+ self.assertEqual(None, res)
+ self.assertEqual('Error mount aaa.', msg)
+
+ def test_get_mount_list_keyerror_exception(self):
+ project_cfg = {'mounts': ['aaa=a,bbb=b', '']}
+ res, msg = dovetail_utils.get_mount_list(project_cfg)
+ self.assertEqual(None, res)
+ self.assertEqual("'target'", str(msg))
+
+ def test_get_mount_list(self):
+ project_cfg = {'mounts': ['target=a,source=b', '']}
+ res, msg = dovetail_utils.get_mount_list(project_cfg)
+ expected = [{'Source': 'b', 'Type': 'bind', 'ReadOnly': False,
+ 'Target': 'a'}]
+ self.assertEqual(expected, res)
+ self.assertEqual('Successfully to get mount list.', msg)