github.com/openshift/installer@v1.4.17/scripts/openstack/manifest-tests/dual-stack/test_machine-config.py (about) 1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 4 import unittest 5 import xmlrunner 6 7 import os 8 import sys 9 import glob 10 import yaml 11 12 ASSETS_DIR = "" 13 14 class GenerateMachineConfig(unittest.TestCase): 15 def setUp(self): 16 self.machine_configs = [] 17 for machine_config_path in glob.glob( 18 f'{ASSETS_DIR}/openshift/99_openshift-machineconfig_99-dual-stack-*.yaml' 19 ): 20 with open(machine_config_path) as f: 21 self.machine_configs.append(yaml.load(f, Loader=yaml.FullLoader)) 22 23 def test_kernel_args(self): 24 """Assert there are machine configs configuring the kernel args for masters and workers""" 25 for machine_config in self.machine_configs: 26 kernel_args = machine_config["spec"]["kernelArguments"] 27 self.assertIn("ip=dhcp,dhcp6", kernel_args) 28 29 30 if __name__ == '__main__': 31 ASSETS_DIR = sys.argv.pop() 32 with open(os.environ.get('JUNIT_FILE', '/dev/null'), 'wb') as output: 33 unittest.main(testRunner=xmlrunner.XMLTestRunner(output=output), failfast=False, buffer=False, catchbreak=False, verbosity=2)