Commit 11535376 authored by Lisa Velden's avatar Lisa Velden Committed by Hrvoje Ribicic
Browse files

Test presence of public and private parameters

Make sure that there is an environment variable for each parameter
with the correct value.
Signed-off-by: default avatarLisa Velden <>
Reviewed-by: default avatarHrvoje Ribicic <>
parent 2d90596b
......@@ -44,7 +44,9 @@ from ganeti import hypervisor
from ganeti import netutils
from ganeti import objects
from ganeti import pathutils
from ganeti import serializer
from ganeti import utils
from cmdlib.testsupport.config_mock import ConfigMock
class TestX509Certificates(unittest.TestCase):
......@@ -948,5 +950,38 @@ class TestSpaceReportingConstants(unittest.TestCase):
self.assertEqual(None, backend._STORAGE_TYPE_INFO_FN[storage_type])
class TestOSEnvironment(unittest.TestCase):
"""Ensure the presence of public and private parameters.
They have to be present inside os environment variables.
def _CreateEnv(self):
"""Create and return an environment."""
config_mock = ConfigMock()
inst = config_mock.AddNewInstance(
osparams={"public_param": "public_info"},
nics = [])
inst.disks_info = ""
inst.secondary_nodes = []
return backend.OSEnvironment(inst, config_mock.CreateOs())
def testParamPresence(self):
env = self._CreateEnv()
env_keys = env.keys()
self.assertIn("OSP_PUBLIC_PARAM", env)
self.assertIn("OSP_PRIVATE_PARAM", env)
self.assertIn("OSP_ANOTHER_PRIVATE_PARAM", env)
self.assertEqual("public_info", env["OSP_PUBLIC_PARAM"])
self.assertEqual("private_info", env["OSP_PRIVATE_PARAM"])
self.assertEqual("more_privacy", env["OSP_ANOTHER_PRIVATE_PARAM"])
if __name__ == "__main__":
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment