Exemplo n.º 1
0
def test_positive_failed_service_status(ansible_module):
    """Verify foreman-maintain service status return error when service stopped

    :id: 74f6e276-1e54-4bf3-9538-19e87059f8b5

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

    :steps:
        1. Run foreman-maintain service stop.
        2. Run foreman-maintain service status.

    :expectedresults: service status should return error code.

    :CaseImportance: Critical
    """
    try:
        setup = ansible_module.command(Service.service_stop())
        for result in setup.values():
            logger.info(result['stdout'])
            assert result['rc'] == 0
        contacted = ansible_module.command(Service.service_status())
        for result in contacted.values():
            logger.info(result)
            assert result['rc'] != 0
    finally:
        teardown = ansible_module.command(Service.service_start())
        for result in teardown.values():
            assert result['rc'] == 0
Exemplo n.º 2
0
def test_positive_backup_stopped_foreman_tasks(setup_backup_tests,
                                               ansible_module):
    """Take online backup of server when foreman-tasks is not running

    :id: 3def9d00-f9be-4817-adf0-acd7cf68460b

    :setup:

        1. foreman-maintain should be installed.

    :steps:
        1. Run foreman-maintain service stop --only foreman-tasks
        2. Run foreman-maintain backup online /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{}backup-{}".format(BACKUP_DIR, gen_string("alpha"))
    try:
        setup = ansible_module.command(
            Service.service_stop({u"only": "foreman-tasks"}))
        for result in setup.values():
            logger.info(result)
            assert result["rc"] == 0
        contacted = ansible_module.command(
            Backup.run_online_backup(["-y", subdir]))
        for result in contacted.values():
            logger.info(result["stdout"])
            assert "FAIL" not in result["stdout"]
            assert result["rc"] == 0
    finally:
        teardown = ansible_module.command(Service.service_start())
        for result in teardown.values():
            assert result["rc"] == 0
Exemplo n.º 3
0
def test_positive_automate_bz1624699(ansible_module):
    """Validate correct service restart on dynflowd stopped

    :id: 36f7ea87-12f3-4c12-817d-0031ce3ad241

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

    :steps:
        1. Stop dynflowd service
        2. Run foreman-maintain health check

    :expectedresults: service should restart correctly.

    :CaseImportance: Critical
    """
    setup = ansible_module.command(Service.service_stop({
        u'only': 'dynflowd'
    }))
    for result in setup.values():
        assert result['rc'] == 0
    contacted = ansible_module.command(Health.check(['-y']))
    for result in contacted.values():
        logger.info(result)
        assert result['rc'] == 0
Exemplo n.º 4
0
def test_positive_failed_service_status(ansible_module):
    """Verify foreman-maintain service status return error when service stopped

    :id: 74f6e276-1e54-4bf3-9538-19e87059f8b5

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

    :steps:
        1. Run foreman-maintain service stop.
        2. Run foreman-maintain service status.

    :expectedresults: service status should return error code.

    :CaseImportance: Critical
    """
    try:
        setup = ansible_module.command(Service.service_stop())
        for result in setup.values():
            logger.info(result['stdout'])
            assert result['rc'] == 0
        contacted = ansible_module.command(Service.service_status())
        for result in contacted.values():
            logger.info(result)
            assert result['rc'] != 0
    finally:
        teardown = ansible_module.command(Service.service_start())
        for result in teardown.values():
            assert result['rc'] == 0
Exemplo n.º 5
0
def test_positive_automate_bz1626651(ansible_module):
    """Disable services using foreman-maintain service

    :id: dc60e388-f012-4164-a496-b12d6230cdc2

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

    :steps:
        1. Run foreman-maintain service stop.
        2. Run foreman-maintain service restart

    :expectedresults: service should restart.

    :CaseImportance: Critical
    """
    try:
        contacted = ansible_module.command(Service.service_stop())
        for result in contacted.values():
            logger.info(result['stdout'])
            assert "FAIL" not in result['stdout']
            assert result['rc'] == 0
        contacted = ansible_module.command(Service.service_restart())
        for result in contacted.values():
            logger.info(result['stdout'])
            assert "FAIL" not in result['stdout']
            assert result['rc'] == 0
    finally:
        teardown = ansible_module.command(Service.service_start())
        for result in teardown.values():
            assert result['rc'] == 0
Exemplo n.º 6
0
def test_positive_automate_bz1626651(ansible_module):
    """Disable services using foreman-maintain service

    :id: dc60e388-f012-4164-a496-b12d6230cdc2

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

    :steps:
        1. Run foreman-maintain service stop.
        2. Run foreman-maintain service restart

    :expectedresults: service should restart.

    :CaseImportance: Critical
    """
    try:
        contacted = ansible_module.command(Service.service_stop())
        for result in contacted.values():
            logger.info(result['stdout'])
            assert "FAIL" not in result['stdout']
            assert result['rc'] == 0
        contacted = ansible_module.command(Service.service_restart())
        for result in contacted.values():
            logger.info(result['stdout'])
            assert "FAIL" not in result['stdout']
            assert result['rc'] == 0
    finally:
        teardown = ansible_module.command(Service.service_start())
        for result in teardown.values():
            assert result['rc'] == 0
Exemplo n.º 7
0
def test_positive_automate_bz1624699(ansible_module):
    """Validate correct service restart on dynflowd stopped

    :id: 36f7ea87-12f3-4c12-817d-0031ce3ad241

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

    :steps:
        1. Stop dynflowd service
        2. Run foreman-maintain health check

    :expectedresults: service should restart correctly.

    :CaseImportance: Critical
    """
    setup = ansible_module.command(
        Service.service_stop({u"only": "smart_proxy_dynflow_core"}))
    for result in setup.values():
        assert result["rc"] == 0
        assert "FAIL" not in result["stdout"]
        assert "smart_proxy_dynflow_core" in result["stdout"]

    contacted = ansible_module.command(Health.check(["-y"]))
    for result in contacted.values():
        logger.info(result)
        assert result["rc"] == 0
Exemplo n.º 8
0
def test_positive_backup_stopped_dynflowd(ansible_module):
    """Take online backup of server when dynflowd is not running

    :id: 321b5f16-337c-4370-87b6-cfe1c78c9139

    :setup:

        1. foreman-maintain should be installed.

    :steps:
        1. Run foreman-maintain service stop --only dynflowd
        2. Run foreman-maintain backup online /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{0}backup-{1}".format(BACKUP_DIR, gen_string('alpha'))
    try:
        setup = ansible_module.command(Service.service_stop({
            u'only': 'dynflowd'
        }))
        for result in setup.values():
            logger.info(result)
            assert result['rc'] == 0
        contacted = ansible_module.command(Backup.run_online_backup([
            '-y',
            subdir
        ]))
        for result in contacted.values():
            logger.info(result['stdout'])
            assert "FAIL" not in result['stdout']
            assert result['rc'] == 0

        # getting created files
        contacted = ansible_module.command('ls {}'.format(subdir))
        timestamped_dir = contacted.values()[0]['stdout_lines'][0]
        contacted = ansible_module.command(
            'ls -a {0}/{1}'.format(subdir, timestamped_dir))
        files_list = contacted.values()[0]['stdout_lines']
        expected_files = ONLINE_BACKUP_FILES

        # capsule-specific file list
        if ansible_host_pattern == 'capsule':
            expected_files = ONLINE_CAPS_FILES
        assert set(files_list).issuperset(
            expected_files + CONTENT_FILES), assert_msg
    finally:
        teardown = ansible_module.command(Service.service_start())
        for result in teardown.values():
            assert result['rc'] == 0
Exemplo n.º 9
0
def test_positive_backup_stopped_dynflowd(setup_backup_tests, ansible_module):
    """Take online backup of server when dynflowd is not running

    :id: 321b5f16-337c-4370-87b6-cfe1c78c9139

    :setup:

        1. foreman-maintain should be installed.

    :steps:
        1. Run foreman-maintain service stop --only dynflowd
        2. Run foreman-maintain backup online /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{}backup-{}".format(BACKUP_DIR, gen_string("alpha"))
    try:
        setup = ansible_module.command(
            Service.service_stop({u"only": "dynflowd"}))
        for result in setup.values():
            logger.info(result)
            assert result["rc"] == 0
        contacted = ansible_module.command(
            Backup.run_online_backup(["-y", subdir]))
        for result in contacted.values():
            logger.info(result["stdout"])
            assert "FAIL" not in result["stdout"]
            assert result["rc"] == 0

        # getting created files
        contacted = ansible_module.command("ls {}".format(subdir))
        timestamped_dir = contacted.values()[0]["stdout_lines"][0]
        contacted = ansible_module.command("ls -a {}/{}".format(
            subdir, timestamped_dir))
        files_list = contacted.values()[0]["stdout_lines"]
        expected_files = ONLINE_BACKUP_FILES

        # capsule-specific file list
        if server() == "capsule":
            expected_files = ONLINE_CAPS_FILES
        assert set(files_list).issuperset(expected_files +
                                          CONTENT_FILES), assert_msg
    finally:
        teardown = ansible_module.command(Service.service_start())
        for result in teardown.values():
            assert result["rc"] == 0
Exemplo n.º 10
0
def test_positive_foreman_service(ansible_module):
    """Validate httpd service should work as expected even stopping of the foreman service

    :id: 08a29ea2-2e49-11eb-a22b-d46d6dd3b5b2

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

    :steps:
        1. Stop foreman service
        2. Check the status for httpd should not have affect
        3. Run foreman-maintain health check

    :expectedresults: service should restart correctly.

    :CaseImportance: Critical
    """
    try:
        setup = ansible_module.command(
            Service.service_stop({u"only": "foreman"}))
        for result in setup.values():
            assert result["rc"] == 0
            assert "FAIL" not in result["stdout"]
            assert "foreman" in result["stdout"]

        httpd_service = ansible_module.command(
            Service.service_status({u"only": "httpd"}))
        for result in httpd_service.values():
            logger.info(result)
            assert result["rc"] == 0

        contacted = ansible_module.command(Health.check(["-y"]))
        for result in contacted.values():
            logger.info(result)
            assert result["rc"] == 0
            assert "foreman" in result["stdout"]

    finally:
        teardown = ansible_module.command(
            Service.service_start({u"only": "foreman"}))
        for result in teardown.values():
            assert result["rc"] == 0
Exemplo n.º 11
0
def test_positive_automate_bz1624699(ansible_module):
    """Validate correct service restart on dynflowd stopped

    :id: 36f7ea87-12f3-4c12-817d-0031ce3ad241

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

    :steps:
        1. Stop dynflowd service
        2. Run foreman-maintain health check

    :expectedresults: service should restart correctly.

    :CaseImportance: Critical
    """
    setup = ansible_module.command(Service.service_stop({u'only': 'dynflowd'}))
    for result in setup.values():
        assert result['rc'] == 0
    contacted = ansible_module.command(Health.check(['-y']))
    for result in contacted.values():
        logger.info(result)
        assert result['rc'] == 0