def test_sysconfig_virt_who():
    result = VirtWhoSysconfig(context_wrap(VIRTWHO))
    assert result["VIRTWHO_RHEVM"] == '1'
    assert result["VIRTWHO_RHEVM_OWNER"] == ''
    assert result.get("NO_SUCH_OPTIONS") is None
    assert "NOSUCHOPTIONS" not in result
    assert result.get("TEST_OPT") == 'A TEST'
示例#2
0
def test_sysconfig_doc():
    env = {
            'chronyd_syscfg': ChronydSysconfig(context_wrap(CHRONYDSYSCONFIG)),
            'ntpd_syscfg': NtpdSysconfig(context_wrap(NTPDSYSCONFIG)),
            'docker_syscfg': DockerSysconfig(context_wrap(DOCKERSYSCONFIG)),
            'docker_syscfg_storage': DockerSysconfigStorage(context_wrap(DOCKER_CONFIG_STORAGE)),
            'httpd_syscfg': HttpdSysconfig(context_wrap(HTTPDSYSCONFIG)),
            'irqb_syscfg': IrqbalanceSysconfig(context_wrap(IRQBALANCESYSCONFIG)),
            'vwho_syscfg': VirtWhoSysconfig(context_wrap(VIRTWHOSYSCONFIG)),
            'mongod_syscfg': MongodSysconfig(context_wrap(MONGODSYSCONFIG)),
            'memcached_syscfg': MemcachedSysconfig(context_wrap(MEMCACHEDSYSCONFIG)),
            'libvirt_guests_syscfg': LibvirtGuestsSysconfig(context_wrap(LIBVIRTGUESTSSYSCONFIG)),
            'prelink_syscfg': PrelinkSysconfig(context_wrap(PRELINKSYSCONFIG)),
            'u2d_syscfg': Up2DateSysconfig(context_wrap(UP2DATESYSCONFIG)),
            'netcs_syscfg': NetconsoleSysconfig(context_wrap(NETCONSOLESYSCONFIG)),
            'sshd_syscfg': SshdSysconfig(context_wrap(SSHDSYSCONFIG)),
            'pps_syscfg': PuppetserverSysconfig(context_wrap(PUPPETSERVERCONFIG)),
            'ft_syscfg': ForemanTasksSysconfig(context_wrap(FOREMANTASKSYSCONFG)),
            'dss_syscfg': DockerStorageSetupSysconfig(context_wrap(DOCKERSTORAGESETUPSYSCONFG)),
            'dirsrv_syscfg': DirsrvSysconfig(context_wrap(DIRSRVSYSCONFG)),
            'cs_syscfg': CorosyncSysconfig(context_wrap(COROSYNCSYSCONFIG)),
            'conn_info': IfCFGStaticRoute(context_wrap(STATIC_ROUTE_1, CONTEXT_PATH_DEVICE_1)),
            'net_syscfg': NetworkSysconfig(context_wrap(NETWORK_SYSCONFIG))
          }
    failed, total = doctest.testmod(sysconfig, globs=env)
    assert failed == 0
def test_virt_who_conf_1():
    vw_sysconf = VirtWhoSysconfig(context_wrap(SYS_VIRTWHO))
    vwho_conf = VirtWhoConf(context_wrap(VWHO_CONF))
    vwhod_conf1 = VirtWhoConf(context_wrap(VWHO_D_CONF_HYPER))
    vwhod_conf2 = VirtWhoConf(context_wrap(VWHO_D_CONF_ESX))
    result = AllVirtWhoConf(vw_sysconf, [vwho_conf, vwhod_conf1, vwhod_conf2])
    assert result.background is False
    assert result.oneshot is True
    assert result.interval == 1000
    assert result.sm_type == 'sat6'
    assert sorted(result.hypervisor_types) == sorted(['esx', 'hyperv'])

    expected = [{
        'name': 'esx_1',
        'server': '10.72.32.219',
        'env': 'Satellite',
        'owner': 'Satellite',
        'type': 'esx'
    }, {
        'name': 'hyperv_1',
        'server': '10.72.32.209',
        'env': 'Satellite',
        'owner': 'Satellite',
        'type': 'hyperv'
    }]
    for d in result.hypervisors:
        assert d in expected
示例#4
0
def test_virt_who_conf_2():
    vw_sysconf = VirtWhoSysconfig(context_wrap(SYS_VIRTWHO_SAT_LEGACY))
    vwho_conf = VirtWhoConf(context_wrap(VWHO_CONF))
    result = AllVirtWhoConf(vw_sysconf, [vwho_conf])
    assert result.background is True
    assert result.oneshot is False
    assert result.interval == 3600
    assert result.sm_type == 'sat5'
示例#5
0
def test_virt_who_conf_4():
    vw_sysconf = VirtWhoSysconfig(context_wrap(SYS_VIRTWHO_CP))
    vwho_conf = VirtWhoConf(context_wrap(VWHO_CONF))
    result = AllVirtWhoConf(vw_sysconf, [vwho_conf])
    assert result.sm_type == 'cp'