Example #1
0
def test_negative_check_hammer_ping_assumeyes(ansible_module):
    """Verify hammer ping check once failed restart the services

    :id:

    :setup:
        1. foreman-maintain should be installed.

    :steps:
        1. Run Katello-service stop
        2. Run foreman-maintain health check --label hammer-ping --assumeyes

    :expectedresults: Health check should perform.

    :CaseImportance: Critical
    """
    setup = ansible_module.command(Advanced.run_katello_service_stop())
    for result in setup.values():
        print(result['stdout'])
    contacted = ansible_module.command(
        Health.check({'label': 'hammer-ping'}) + ' -y')
    for result in contacted.values():
        print(result)
        assert "FAIL" in result['stdout']
    verify = ansible_module.command(
        "systemctl is-active foreman-tasks.service")
    for result in verify.values():
        assert "inactive" not in result['stdout']
Example #2
0
def test_negative_check_hammer_ping(ansible_module):
    """Verify hammer ping check

    :id:

    :setup:
        1. foreman-maintain should be installed.

    :steps:
        1. Run Katello-service stop
        2. Run foreman-maintain health check --label hammer-ping
        3. Run Katello-service start

    :expectedresults: Health check should perform.

    :CaseImportance: Critical
    """
    setup = ansible_module.command(Advanced.run_katello_service_stop())
    for result in setup.values():
        assert result['rc'] == 0
    contacted = ansible_module.command(Health.check({'label': 'hammer-ping'}))
    for result in contacted.values():
        print(result['stdout'])
        assert "FAIL" in result['stdout']
    teardown = ansible_module.command(Advanced.run_katello_service_start())
    for result in teardown.values():
        print(result['stdout'])
Example #3
0
def test_positive_check_hammer_ping(ansible_module):
    """Verify hammer ping check

    :id:

    :setup:
        1. foreman-maintain should be installed.

    :steps:
        1. Run foreman-maintain health check --label hammer-ping

    :expectedresults: Health check should perform.

    :CaseImportance: Critical
    """
    contacted = ansible_module.command(Health.check({'label': 'hammer-ping'}))
    for result in contacted.values():
        print(result['stdout'])
        assert "FAIL" not in result['stdout']
Example #4
0
def test_positive_foreman_maintain_health_check(ansible_module):
    """Verify foreman-maintain health check

    :id:

    :setup:
        1. foreman-maintain should be installed.

    :steps:
        1. Run foreman-maintain health check

    :expectedresults: Health check should perform.

    :CaseImportance: Critical
    """
    contacted = ansible_module.command(Health.check())
    for result in contacted.values():
        print(result['stdout'])
        assert "FAIL" not in result['stdout']
Example #5
0
def test_positive_pre_upgrade_health_check(ansible_module):
    """Verify pre-upgrade health checks

    :id:

    :setup:
        1. foreman-maintain should be installed.

    :steps:
        1. Run foreman-maintain health check --tags pre-upgrade

    :expectedresults: Pre-upgrade health checks should perform.

    :CaseImportance: Critical
    """
    contacted = ansible_module.command(Health.check({'tag': 'pre-upgrade'}))
    for result in contacted.values():
        print(result['stdout'])
        assert "FAIL" not in result['stdout']
Example #6
0
def check_health():
    """
    Usage:
    foreman-maintain health check [OPTIONS]

    Options:
        --label label                 Limit only for a specific label.
                                      (Use "list" command to see available
                                       labels)
        --tags tags                   Limit only for specific set of labels.
                                      (Use list-tags command to see available
                                      tags) (comma-separated list)
        -y, --assumeyes               Automatically answer yes for all questions
        -w, --whitelist whitelist     Comma-separated list of labels of steps
                                      to be ignored
        -f, --force                   Force steps that would be skipped as they
                                      were already run
        -h, --help                    print help
    """

    return Health.check()