Exemplo n.º 1
0
    def test_ignore_invalid_conf_suffix(self):
        with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
            create_dropin(
                runtime_dir, '50_invalid_name', '[test]\nkey = runtime\n')

            cfg = config.load('vdsm')
            self.assertTrue(cfg.get('test', 'key'), 'default value')
Exemplo n.º 2
0
    def test_ignore_invalid_conf_suffix(self):
        with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
            create_dropin(
                runtime_dir, '50_invalid_name', '[test]\nkey = runtime\n')

            cfg = config.load('vdsm')
            self.assertTrue(cfg.get('test', 'key'), 'default value')
Exemplo n.º 3
0
    def test_dropin_override_conf(self):
        with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
            create_conf(admin_dir, '[test]\nkey = default conf\n')
            create_dropin(
                runtime_dir, '51_runtime.conf', '[test]\nkey = runtime\n')

            cfg = config.load('vdsm')
            self.assertEqual(cfg.get('test', 'key'), 'runtime')
Exemplo n.º 4
0
    def test_dropin_override_conf(self):
        with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
            create_conf(admin_dir, '[test]\nkey = default conf\n')
            create_dropin(
                runtime_dir, '51_runtime.conf', '[test]\nkey = runtime\n')

            cfg = config.load('vdsm')
            self.assertEqual(cfg.get('test', 'key'), 'runtime')
Exemplo n.º 5
0
    def test_different_directories_read_proirity(self):
        with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
            create_conf(admin_dir, '[test]\nnum = 1\n')
            create_dropin(admin_dir, '51.conf', '[test]\nnum = 51\n')
            create_dropin(vendor_dir, '52.conf', '[test]\nnum = 52\n')
            create_dropin(runtime_dir, '53.conf', '[test]\nnum = 53\n')

            cfg = config.load('vdsm')
            self.assertEqual(cfg.getint('test', 'num'), 53)
Exemplo n.º 6
0
    def test_different_directories_read_proirity(self):
        with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
            create_conf(admin_dir, '[test]\nnum = 1\n')
            create_dropin(admin_dir, '51.conf', '[test]\nnum = 51\n')
            create_dropin(vendor_dir, '52.conf', '[test]\nnum = 52\n')
            create_dropin(runtime_dir, '53.conf', '[test]\nnum = 53\n')

            cfg = config.load('vdsm')
            self.assertEqual(cfg.getint('test', 'num'), 53)
Exemplo n.º 7
0
    def test_options_not_modified(self):
        """
        make sure unrelated items were not modified by reading default
        values, creating new conf files, running config.load and checking
        the options still exist in ConfigParser
        """
        with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
            create_dropin(
                runtime_dir, '51_runtime.conf', '[test]\nkey = runtime\n')

            cfg = config.load('vdsm')
            self.assertEqual(cfg.getint('test', 'num'), 0)
Exemplo n.º 8
0
    def test_options_not_modified(self):
        """
        make sure unrelated items were not modified by reading default
        values, creating new conf files, running config.load and checking
        the options still exist in ConfigParser
        """
        with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
            create_dropin(
                runtime_dir, '51_runtime.conf', '[test]\nkey = runtime\n')

            cfg = config.load('vdsm')
            self.assertEqual(cfg.getint('test', 'num'), 0)
Exemplo n.º 9
0
    def test_runtime_dropin(self):
        with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
            create_dropin(admin_dir, '54.conf', '[test]\nkey = runtime\n')

            cfg = config.load('vdsm')
            self.assertEqual(cfg.get('test', 'key'), 'runtime')
Exemplo n.º 10
0
    def test_default_conf(self):
        with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
            create_conf(admin_dir, '[test]\nkey = default conf val\n')

            cfg = config.load('vdsm')
            self.assertEqual(cfg.get('test', 'key'), 'default conf val')
Exemplo n.º 11
0
 def test_default(self):
     with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
         cfg = config.load('vdsm')
         self.assertEqual(cfg.get('test', 'key'), 'default value')
Exemplo n.º 12
0
    def test_runtime_dropin(self):
        with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
            create_dropin(admin_dir, '54.conf', '[test]\nkey = runtime\n')

            cfg = config.load('vdsm')
            self.assertEqual(cfg.get('test', 'key'), 'runtime')
Exemplo n.º 13
0
    def test_default_conf(self):
        with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
            create_conf(admin_dir, '[test]\nkey = default conf val\n')

            cfg = config.load('vdsm')
            self.assertEqual(cfg.get('test', 'key'), 'default conf val')
Exemplo n.º 14
0
 def test_default(self):
     with fakedirs() as (admin_dir, vendor_dir, runtime_dir):
         cfg = config.load('vdsm')
         self.assertEqual(cfg.get('test', 'key'), 'default value')