Exemple #1
0
def test_positive_backup_online_all(ansible_module):
    """Take online backup of server providing all options

    :id: 86a93e4f-61e3-4206-ae28-ce01136c5518

    :setup:

        1. foreman-maintain should be installed.
        2. Take backup of server.
    :steps:
        1. Run foreman-maintain backup online -y -f -s -p -t 10M -i
        /previous_backup/ --features dns,tftp /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    setup = ansible_module.command(Backup.run_online_backup(['-y', '/mnt/']))
    for result in setup.values():
        logger.info(result['stdout'])
        assert "FAIL" not in result['stdout']
        assert result['rc'] == 0
    contacted = ansible_module.command(
        Backup.run_online_backup([
            '-y -f -s -p -t 10M -i', '/mnt/', '--features',
            'dns,tftp,openscap,dhcp', BACKUP_DIR
        ]))
    for result in contacted.values():
        logger.info(result['stdout'])
        assert "FAIL" not in result['stdout']
        assert result['rc'] == 0
def test_positive_backup_online_all(setup_backup_tests, ansible_module):
    """Take online backup of server providing all options

    :id: 86a93e4f-61e3-4206-ae28-ce01136c5518

    :setup:

        1. foreman-maintain should be installed.
        2. Take backup of server.
    :steps:
        1. Run foreman-maintain backup online -y -f -s -p -t 10M -i
        /previous_backup/ --features dns,tftp /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{}backup-{}".format(BACKUP_DIR, gen_string("alpha"))
    ansible_module.file(path=subdir, state="directory", mode="0777")
    setup = ansible_module.command(Backup.run_online_backup(["-y", "/mnt/"]))
    for result in setup.values():
        logger.info(result["stdout"])
        assert "FAIL" not in result["stdout"]
        assert result["rc"] == 0
    contacted = ansible_module.command(
        Backup.run_online_backup([
            "-y -f -s -p -t 10M -i", "/mnt/", "--features",
            "dns,tftp,openscap,dhcp", subdir
        ]))
    for result in contacted.values():
        logger.info(result["stdout"])
        assert "FAIL" not in result["stdout"]
        assert result["rc"] == 0
Exemple #3
0
def test_positive_backup_online_incremental(ansible_module):
    """Take incremental online backup of server

    :id: e4af1804-8479-47c0-9f50-460b6edbe9e0

    :setup:

        1. foreman-maintain should be installed.
        2. Take backup of server.
    :steps:
        1. Run foreman-maintain backup online --incremental
         /previous_backup_dir/ /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    setup = ansible_module.command(Backup.run_online_backup(['-y', '/mnt/']))
    for result in setup.values():
        logger.info(result['stdout'])
        assert "FAIL" not in result['stdout']
        assert result['rc'] == 0
    contacted = ansible_module.command(
        Backup.run_online_backup(['-y', '--incremental', '/mnt/', BACKUP_DIR]))
    for result in contacted.values():
        logger.info(result['stdout'])
        assert "FAIL" not in result['stdout']
        assert result['rc'] == 0
Exemple #4
0
def test_negative_backup_online_incremental_nodir(ansible_module):
    """Take online backup of server with no destination

    :id: cfb68cdf-9d27-4a38-bc16-900fc9488ac6

    :setup:

        1. foreman-maintain should be installed.
    :steps:
        1. Run foreman-maintain backup offline with nonexistent
        directory

    :expectedresults: backup aborted, relevant message is
        returned

    :CaseImportance: Critical
    """
    contacted = ansible_module.command(Backup.run_online_backup([
        '-y',
        '--incremental',
        gen_string('alpha'),
    ]))
    for result in contacted.values():
        logger.info(result['stderr'])
        assert result['rc'] == 1
        assert NOPREV_MSG in result['stderr']
Exemple #5
0
def test_positive_backup_online_split_pulp_tar(ansible_module):
    """Take online backup of server spliting pulp tar

    :id: f2c7173f-a955-4c0c-a232-60f6161fda81

    :setup:

        1. foreman-maintain should be installed.
    :steps:
        1. Run foreman-maintain backup online  --split-pulp-tar 1M /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{0}backup-{1}".format(BACKUP_DIR, gen_string('alpha'))
    contacted = ansible_module.command(
        Backup.run_online_backup(['-y', '--split-pulp-tar', '1M', subdir]))
    for result in contacted.values():
        logger.info(result['stdout'])
        assert "FAIL" not in result['stdout']
        assert result['rc'] == 0

    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']
    assert set(files_list).issuperset(ONLINE_BACKUP_FILES +
                                      CONTENT_FILES), assert_msg
Exemple #6
0
def test_positive_backup_online(setup_backup_tests, ansible_module):
    """Take online backup of server

    :id: 962d21de-04bc-43fd-9076-cdbfdb9d798e

    :setup:

        1. foreman-maintain should be installed.
    :steps:
        1. Run foreman-maintain backup online /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = f"{BACKUP_DIR}backup-{gen_string('alpha')}"
    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(f"ls {subdir}")
    timestamped_dir = contacted.values()[0]["stdout_lines"][0]
    contacted = ansible_module.command(f"ls -a {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
Exemple #7
0
def test_positive_backup_online_split_pulp_tar(setup_backup_tests,
                                               ansible_module):
    """Take online backup of server spliting pulp tar

    :id: f2c7173f-a955-4c0c-a232-60f6161fda81

    :setup:

        1. foreman-maintain should be installed.
    :steps:
        1. Run foreman-maintain backup online  --split-pulp-tar 1M /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = f"{BACKUP_DIR}backup-{gen_string('alpha')}"
    contacted = ansible_module.command(
        Backup.run_online_backup(["-y", "--split-pulp-tar", "1M", subdir]))
    for result in contacted.values():
        logger.info(result["stdout"])
        assert "FAIL" not in result["stdout"]
        assert result["rc"] == 0

    contacted = ansible_module.command(f"ls {subdir}")
    timestamped_dir = contacted.values()[0]["stdout_lines"][0]
    contacted = ansible_module.command(f"ls -a {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
Exemple #8
0
def test_positive_backup_online_preserve_directory(setup_backup_tests,
                                                   ansible_module):
    """Take online backup of server preserving directory

    :id: 343c79fd-5fd3-45a3-bb75-c807817f2970

    :setup:

        1. foreman-maintain should be installed.
    :steps:
        1. Run foreman-maintain backup online --preserve-directory /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = f"{BACKUP_DIR}backup-{gen_string('alpha')}"
    ansible_module.file(path=f"{subdir}", state="directory", owner="postgres")
    contacted = ansible_module.command(
        Backup.run_online_backup(["-y", "--preserve-directory", subdir]))
    for result in contacted.values():
        logger.info(result["stdout"])
        assert "FAIL" not in result["stdout"]
        assert result["rc"] == 0

    contacted = ansible_module.command(f"ls -a {subdir}")
    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
Exemple #9
0
def test_positive_backup_online_skip_pulp_content(ansible_module):
    """Take online backup skipping pulp content of server

    :id: 0a041aed-8578-40d9-8044-6a1db0daba59

    :setup:

        1. foreman-maintain should be installed.
    :steps:
        1. Run foreman-maintain backup online --skip-pulp-content /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{0}backup-{1}".format(BACKUP_DIR, gen_string('alpha'))
    contacted = ansible_module.command(
        Backup.run_online_backup(['-y', '--skip-pulp-content', 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']
    assert set(files_list).issuperset(ONLINE_BACKUP_FILES), assert_msg
    assert CONTENT_FILES not in files_list, "content not skipped"
Exemple #10
0
def test_positive_backup_online(ansible_module):
    """Take online backup of server

    :id: 962d21de-04bc-43fd-9076-cdbfdb9d798e

    :setup:

        1. foreman-maintain should be installed.
    :steps:
        1. Run foreman-maintain backup online /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{0}backup-{1}".format(BACKUP_DIR, gen_string('alpha'))
    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']
    assert set(files_list).issuperset(ONLINE_BACKUP_FILES +
                                      CONTENT_FILES), assert_msg
Exemple #11
0
def test_positive_backup_online_caspule_features(ansible_module):
    """Take online backup of server including capsule features dns, tftp, etc.

    :id: a36f8a53-a233-4bc8-bd0f-c4629e383cb9

    :setup:

        1. foreman-maintain should be installed.
    :steps:
        1. Run foreman-maintain backup online  --features dns,tftp /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{0}backup-{1}".format(BACKUP_DIR, gen_string('alpha'))
    contacted = ansible_module.command(
        Backup.run_online_backup(
            ['-y', '--features', 'dns,tftp,openscap,dhcp', 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']
    assert set(files_list).issuperset(ONLINE_BACKUP_FILES +
                                      CONTENT_FILES), assert_msg
Exemple #12
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
Exemple #13
0
def test_positive_backup_online_preserve_directory(ansible_module):
    """Take online backup of server preserving directory

    :id: 343c79fd-5fd3-45a3-bb75-c807817f2970

    :setup:

        1. foreman-maintain should be installed.
    :steps:
        1. Run foreman-maintain backup online --preserve-directory /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{0}backup-{1}".format(BACKUP_DIR, gen_string('alpha'))
    ansible_module.file(
        path="{}".format(subdir),
        state="directory",
        owner="postgres",
    )
    contacted = ansible_module.command(
        Backup.run_online_backup(['-y', '--preserve-directory', subdir]))
    for result in contacted.values():
        logger.info(result['stdout'])
        assert "FAIL" not in result['stdout']
        assert result['rc'] == 0

    contacted = ansible_module.command('ls -a {0}'.format(subdir))
    files_list = contacted.values()[0]['stdout_lines']
    assert set(files_list).issuperset(ONLINE_BACKUP_FILES +
                                      CONTENT_FILES), assert_msg
Exemple #14
0
def test_positive_backup_online_incremental(ansible_module):
    """Take incremental online backup of server

    :id: e4af1804-8479-47c0-9f50-460b6edbe9e0

    :setup:

        1. foreman-maintain should be installed.
        2. Take backup of server.
    :steps:
        1. Run foreman-maintain backup online --incremental
         /previous_backup_dir/ /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{0}backup-{1}".format(BACKUP_DIR, gen_string('alpha'))
    dest_dir = "{0}backup-{1}".format(BACKUP_DIR, gen_string('alpha'))
    setup = ansible_module.command(Backup.run_online_backup([
        '-y',
        subdir
    ]))
    for result in setup.values():
        logger.info(result['stdout'])
        assert "FAIL" not in result['stdout']
        assert result['rc'] == 0
    contacted = ansible_module.command('ls {}'.format(subdir))
    source_dir = contacted.values()[0]['stdout_lines'][0]
    contacted = ansible_module.command(Backup.run_online_backup([
        '-y',
        '--incremental',
        '{0}/{1}'.format(subdir, source_dir),
        dest_dir
    ]))
    for result in contacted.values():
        logger.info(result['stdout'])
        assert "FAIL" not in result['stdout']
        assert result['rc'] == 0

    contacted = ansible_module.stat(path=subdir)
    source_size = contacted.values()[0]['stat']['size']
    contacted = ansible_module.stat(path=dest_dir)
    dest_size = contacted.values()[0]['stat']['size']
    assert source_size >= dest_size
Exemple #15
0
def test_positive_backup_online_incremental(setup_backup_tests,
                                            ansible_module):
    """Take incremental online backup of server

    :id: e4af1804-8479-47c0-9f50-460b6edbe9e0

    :setup:

        1. foreman-maintain should be installed.
        2. Take backup of server.
    :steps:
        1. Run foreman-maintain backup online --incremental
        /previous_backup_dir/ /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{}backup-{}".format(BACKUP_DIR, gen_string("alpha"))
    dest_dir = "{}backup-{}".format(BACKUP_DIR, gen_string("alpha"))
    setup = ansible_module.command(Backup.run_online_backup(["-y", subdir]))
    for result in setup.values():
        logger.info(result["stdout"])
        assert "FAIL" not in result["stdout"]
        assert result["rc"] == 0
    contacted = ansible_module.command("ls {}".format(subdir))
    source_dir = contacted.values()[0]["stdout_lines"][0]
    contacted = ansible_module.command(
        Backup.run_online_backup([
            "-y", "--incremental", "{}/{}".format(subdir, source_dir), dest_dir
        ]))
    for result in contacted.values():
        logger.info(result["stdout"])
        assert "FAIL" not in result["stdout"]
        assert result["rc"] == 0

    contacted = ansible_module.stat(path=subdir)
    source_size = contacted.values()[0]["stat"]["size"]
    contacted = ansible_module.stat(path=dest_dir)
    dest_size = contacted.values()[0]["stat"]["size"]
    assert source_size >= dest_size
Exemple #16
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
Exemple #17
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
Exemple #18
0
def test_positive_restore_online_backup(ansible_module):
    """Restore online backup of server

    :id: 3b83f757-2bf8-49ff-b237-bd466c5694bb

    :setup:

        1. foreman-maintain should be installed.
        2. Take online backup of server.
    :steps:
        1. Run foreman-maintain restore /backup_dir/

    :expectedresults: Restore successful.

    :CaseImportance: Critical
    """
    # preparing a target dir
    backup_dir = "online_backup_restore"
    setup = ansible_module.command(f"rm -rf /tmp/{backup_dir}")
    assert setup.values()[0]["rc"] == 0
    setup = ansible_module.file(
        path=f"/tmp/{backup_dir}",
        state="directory",
        owner="postgres",
    )
    # saving backup to specified dir
    setup = ansible_module.command(
        Backup.run_online_backup(
            ["-y", "--preserve-directory", f"/tmp/{backup_dir}"]))
    for result in setup.values():
        logger.info(result["stdout"])
        assert "FAIL" not in result["stdout"]
        assert result["rc"] == 0
    # restore from previously saved backup
    contacted = ansible_module.command(
        Restore._construct_command(["-y", f"/tmp/{backup_dir}"]))
    for result in contacted.values():
        logger.info(result)
        assert "FAIL" not in result["stdout"]
        assert result["rc"] == 0
Exemple #19
0
def test_negative_backup_online_nodir(ansible_module):
    """Take online backup of server with no destination

    :id: 298176a7-ba1d-4fcd-9718-d62c47900bb5

    :setup:

        1. foreman-maintain should be installed.
    :steps:
        1. Run foreman-maintain backup online without providing
        directory

    :expectedresults: backup aborted, relevant message is
        returned

    :CaseImportance: Critical
    """
    contacted = ansible_module.command(Backup.run_online_backup(["-y"]))
    for result in contacted.values():
        logger.info(result["stderr"])
        assert result["rc"] == 1
        assert NODIR_MSG in result["stderr"]
Exemple #20
0
def test_positive_restore_online_backup(ansible_module):
    """Restore online backup of server

    :id: 3b83f757-2bf8-49ff-b237-bd466c5694bb

    :setup:

        1. foreman-maintain should be installed.
        2. Take online backup of server.
    :steps:
        1. Run foreman-maintain restore /backup_dir/

    :expectedresults: Restore successful.

    :CaseImportance: Critical
    """
    # preparing a target dir
    backup_dir = 'online_backup_restore'
    setup = ansible_module.command("rm -rf /tmp/{}".format(backup_dir))
    assert setup.values()[0]["rc"] == 0
    setup = ansible_module.file(
            path="/tmp/{}".format(backup_dir),
            state="directory",
            owner="postgres",
    )
    # saving backup to specified dir
    setup = ansible_module.command(Backup.run_online_backup([
        '-y', '--preserve-directory', '/tmp/{}'.format(backup_dir)]))
    for result in setup.values():
        logger.info(result['stdout'])
        assert "FAIL" not in result['stdout']
        assert result['rc'] == 0
    # restore from previously saved backup
    contacted = ansible_module.command(Restore._construct_command(
        ['-y', '/tmp/{}'.format(backup_dir)]))
    for result in contacted.values():
        logger.info(result)
        assert "FAIL" not in result['stdout']
        assert result['rc'] == 0
Exemple #21
0
def test_positive_backup_online_skip_pulp_content(setup_backup_tests,
                                                  ansible_module):
    """Take online backup skipping pulp content of server

    :id: 0a041aed-8578-40d9-8044-6a1db0daba59

    :setup:

        1. foreman-maintain should be installed.
    :steps:
        1. Run foreman-maintain backup online --skip-pulp-content /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{}backup-{}".format(BACKUP_DIR, gen_string("alpha"))
    contacted = ansible_module.command(
        Backup.run_online_backup(["-y", "--skip-pulp-content", 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), assert_msg
    assert CONTENT_FILES not in files_list, "content not skipped"
Exemple #22
0
def test_positive_backup_online_caspule_features(setup_backup_tests,
                                                 ansible_module):
    """Take online backup of server including capsule features dns, tftp, etc.

    :id: a36f8a53-a233-4bc8-bd0f-c4629e383cb9

    :setup:

        1. foreman-maintain should be installed.
    :steps:
        1. Run foreman-maintain backup online  --features dns,tftp /backup_dir/

    :expectedresults: Backup should successful.

    :CaseImportance: Critical
    """
    subdir = "{}backup-{}".format(BACKUP_DIR, gen_string("alpha"))
    contacted = ansible_module.command(
        Backup.run_online_backup(
            ["-y", "--features", "dns,tftp,openscap,dhcp", 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