def test_good_then_bad(current_actor_context):
    good_config = MultipathConfig(pathname='all_good.conf',
                                  default_path_checker='tur',
                                  reassign_maps=False,
                                  default_detect_checker=True,
                                  default_detect_prio=True,
                                  default_retain_hwhandler=True)
    bad_config = MultipathConfig(pathname='all_bad.conf',
                                 default_path_checker='directio',
                                 reassign_maps=True,
                                 default_detect_checker=False,
                                 default_detect_prio=False,
                                 default_retain_hwhandler=False)
    facts = MultipathConfFacts(configs=[good_config, bad_config])

    current_actor_context.feed(facts)
    current_actor_context.run()
    reports = list(current_actor_context.consume(Report))
    assert reports and len(reports) == 3
    _assert_default_checker_report(reports[0].report, 'all_bad.conf')
    _assert_default_detect_report(reports[1].report, 'all_bad.conf')
    _assert_reassign_maps(reports[2].report, 'all_bad.conf')
Ejemplo n.º 2
0
def test_remove_resume_service(current_actor_context):
    service_name = 'leapp_resume.service'
    service_path = os.path.join('/etc/systemd/system/', service_name)
    symlink_path = os.path.join('/etc/systemd/system/default.target.wants/',
                                service_name)

    # lets make sure there are not leftovers from previous tests
    try:
        os.unlink(service_path)
        os.unlink(symlink_path)
    except OSError as e:
        if e.errno != errno.ENOENT:
            raise

    with open(service_path, 'w'):
        pass

    os.symlink(service_path, symlink_path)

    current_actor_context.run()

    assert not os.path.isfile(service_path)
    assert not os.path.isfile(symlink_path)
def test_same_supported_release(current_actor_context):
    current_actor_context.feed(create_osrelease(id='rhel', version_id='7.6'))
    current_actor_context.run()
    assert not current_actor_context.consume(CheckResult)
def test_not_supported_id(current_actor_context):
    current_actor_context.feed(create_osrelease(id='not_supported_id'))
    current_actor_context.run()
    assert current_actor_context.consume(CheckResult)
    assert current_actor_context.consume(CheckResult)[0].summary == 'Unsupported OS id'
def test_actor_execution(current_actor_context):
    current_actor_context.run()
    assert current_actor_context.consume(FilteredRpmTransactionTasks)
Ejemplo n.º 6
0
def test_actor_execution(current_actor_context):
    current_actor_context.run()
    assert current_actor_context.consume(InstalledRPM)
    assert current_actor_context.consume(InstalledRPM)[0].items
Ejemplo n.º 7
0
def test_actor_with_postfix_package(current_actor_context):
    current_actor_context.feed(create_modulesfacts(installed_rpm=with_postfix))
    current_actor_context.run()
    assert current_actor_context.consume(Report)
Ejemplo n.º 8
0
def test_execution(current_actor_context):
    current_actor_context.run()
    assert current_actor_context.consume(RpmTransactionTasks)
    assert current_actor_context.consume(RpmTransactionTasks)[0].to_install
    assert not current_actor_context.consume(RpmTransactionTasks)[0].to_remove
    assert not current_actor_context.consume(RpmTransactionTasks)[0].to_keep
Ejemplo n.º 9
0
def test_supported_major_version(current_actor_context):
    current_actor_context.feed(create_osrelease(id='rhel', version_id='8.5'))
    current_actor_context.run()
    assert not current_actor_context.consume(Inhibitor)
Ejemplo n.º 10
0
def test_not_supported_major_version(current_actor_context):
    current_actor_context.feed(create_osrelease(id='rhel', version_id='6.6'))
    current_actor_context.run()
    assert current_actor_context.consume(Inhibitor)
    assert current_actor_context.consume(Inhibitor)[0].summary == 'Unsupported OS version'
Ejemplo n.º 11
0
def test_repositoriesblacklist_optional(current_actor_context):
    repo_facts = get_repo_facts(
        ['test', 'rhel-7-server-optional-rpms', 'rhel-7-server-rpms'])
    current_actor_context.feed(repo_facts)
    current_actor_context.run()
    assert not current_actor_context.consume(RepositoriesBlacklisted)
Ejemplo n.º 12
0
def test_repositoriesblacklist_empty(current_actor_context):
    current_actor_context.feed()
    current_actor_context.run()
    assert current_actor_context.consume(RepositoriesBlacklisted)
    repoids = current_actor_context.consume(RepositoriesBlacklisted)[0].repoids
    assert 'codeready-builder-for-rhel-8-x86_64-rpms' in repoids
def test_actor_execution(current_actor_context):
    current_actor_context.run()
    if platform.machine() == 'x86_64':
        assert not current_actor_context.consume(Inhibitor)
    else:
        assert current_actor_context.consume(Inhibitor)
Ejemplo n.º 14
0
def test_update_grub_negative(current_actor_context):
    current_actor_context.run()
    assert not current_actor_context.consume(Report)
Ejemplo n.º 15
0
def test_actor_no_message(current_actor_context):
    current_actor_context.run()
    assert not current_actor_context.consume(Report)
def test_set_selinux_permissive(current_actor_context):
    current_actor_context.feed(SelinuxPermissiveDecision(set_permissive=True))
    current_actor_context.run()
    assert check_permissive_in_conf()
def test_schedule_no_relabel(current_actor_context):
    current_actor_context.feed(SelinuxRelabelDecision(set_relabel=False))
    current_actor_context.run()
    assert not os.path.isfile('/.autorelabel')
def test_actor_execution_choice_n(current_actor_context):
    current_actor_context.feed(FirewallDecisionM(disable_choice='N'))
    current_actor_context.run()
    assert not current_actor_context.consume(CheckResult)
def test_actor_execution(current_actor_context):
    current_actor_context.feed(InstalledUnsignedRPM(items=[]))
    current_actor_context.run()
    assert not current_actor_context.consume(CheckResult)
def test_KDE_Gnome_present(current_actor_context):
    current_actor_context.feed(InstalledRPM(items=[Gnome_RPM, KDE_RPM]))
    current_actor_context.run()
    message = current_actor_context.consume(InstalledDesktopsFacts)[0]
    assert message.gnome_installed and message.kde_installed
def test_actor_execution(current_actor_context):
    current_actor_context.run()
    assert current_actor_context.consume(OSReleaseFacts)
def test_no_desktop_present(current_actor_context):
    current_actor_context.feed(InstalledRPM(items=[]))
    current_actor_context.run()
    message = current_actor_context.consume(InstalledDesktopsFacts)[0]
    assert not message.gnome_installed and not message.kde_installed
Ejemplo n.º 23
0
def test_actor_execution(current_actor_context):
    current_actor_context.run()
    assert current_actor_context.consume(LeftoverPackages)
def test_actor_execution_with_signed_unsigned_data(current_actor_context):
    installed_rpm = [
        RPM(name='sample01',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager=RH_PACKAGER,
            arch='noarch',
            pgpsig=
            'RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51'
            ),
        RPM(name='sample02',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager=RH_PACKAGER,
            arch='noarch',
            pgpsig='SOME_OTHER_SIG_X'),
        RPM(name='sample03',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager=RH_PACKAGER,
            arch='noarch',
            pgpsig=
            'RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 5326810137017186'
            ),
        RPM(name='sample04',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager=RH_PACKAGER,
            arch='noarch',
            pgpsig='SOME_OTHER_SIG_X'),
        RPM(name='sample05',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager=RH_PACKAGER,
            arch='noarch',
            pgpsig=
            'RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 938a80caf21541eb'
            ),
        RPM(name='sample06',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager=RH_PACKAGER,
            arch='noarch',
            pgpsig='SOME_OTHER_SIG_X'),
        RPM(name='sample07',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager=RH_PACKAGER,
            arch='noarch',
            pgpsig=
            'RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID fd372689897da07a'
            ),
        RPM(name='sample08',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager=RH_PACKAGER,
            arch='noarch',
            pgpsig='SOME_OTHER_SIG_X'),
        RPM(name='sample09',
            version='0.1',
            release='1.sm01',
            epoch='1',
            packager=RH_PACKAGER,
            arch='noarch',
            pgpsig=
            'RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 45689c882fa658e0'
            )
    ]

    current_actor_context.feed(InstalledRPM(items=installed_rpm))
    current_actor_context.run()
    assert current_actor_context.consume(InstalledRedHatSignedRPM)
    assert len(
        current_actor_context.consume(InstalledRedHatSignedRPM)[0].items) == 5
    assert current_actor_context.consume(InstalledUnsignedRPM)
    assert len(
        current_actor_context.consume(InstalledUnsignedRPM)[0].items) == 4
def test_no_ipa(current_actor_context):
    current_actor_context.feed(mock_ipa_info(False, False, False))
    current_actor_context.run()
    reports = current_actor_context.consume(Report)

    assert not reports
def test_actor_execution(current_actor_context):
    current_actor_context.run()
    assert current_actor_context.consume(InstalledRedHatSignedRPM)
Ejemplo n.º 27
0
def test_not_supported_minor_version(current_actor_context):
    current_actor_context.feed(create_osrelease(id='rhel', version_id='7.5'))
    current_actor_context.run()
    assert current_actor_context.consume(CheckResult)
    assert current_actor_context.consume(CheckResult)[0].summary == 'Unsupported OS version'
Ejemplo n.º 28
0
def test_supported_minor_version(current_actor_context):
    current_actor_context.feed(create_osrelease(id='rhel', version_id='7.7'))
    current_actor_context.run()
    assert not current_actor_context.consume(Report)
Ejemplo n.º 29
0
def test_actor_execution(current_actor_context):
    current_actor_context.run()
    assert current_actor_context.consume(IfaceResult)
def test_many_apps_present(current_actor_context):
    current_actor_context.feed(InstalledRPM(items=[okular_RPM, kdenetwork_RPM, kate_RPM, epiphany_PRM, polari_RPM]))
    current_actor_context.run()
    message = current_actor_context.consume(InstalledKdeAppsFacts)[0]
    assert len(message.installed_apps) == 3