Ejemplo n.º 1
0
def test_fails_with_insufficient_disk_space(group_names, configured_min,
                                            ansible_mounts, extra_words):
    task_vars = dict(
        group_names=group_names,
        openshift_check_min_host_disk_gb=configured_min,
        ansible_mounts=ansible_mounts,
    )

    result = DiskAvailability(fake_execute_module, task_vars).run()

    assert result['failed']
    for word in 'below recommended'.split() + extra_words:
        assert word in result['msg']
def test_fails_with_insufficient_disk_space(group_names, ansible_mounts,
                                            extra_words):
    task_vars = dict(
        group_names=group_names,
        ansible_mounts=ansible_mounts,
    )

    check = DiskAvailability(execute_module=fake_execute_module)
    result = check.run(tmp=None, task_vars=task_vars)

    assert result['failed']
    for word in 'below recommended'.split() + extra_words:
        assert word in result['msg']
Ejemplo n.º 3
0
def test_min_required_space_changes_with_upgrade_context(
        name, group_names, context, ansible_mounts, failed, extra_words):
    task_vars = dict(
        r_openshift_health_checker_playbook_context=context,
        group_names=group_names,
        ansible_mounts=ansible_mounts,
    )

    check = DiskAvailability(fake_execute_module, task_vars)
    check.run()

    assert bool(check.failures) == failed
    for word in extra_words:
        assert word in str(check.failures[0])
Ejemplo n.º 4
0
def test_fails_with_insufficient_disk_space(name, group_names, configured_min,
                                            ansible_mounts, expect_chunks):
    task_vars = dict(
        group_names=group_names,
        openshift_check_min_host_disk_gb=configured_min,
        ansible_mounts=ansible_mounts,
    )

    check = DiskAvailability(fake_execute_module, task_vars)
    check.run()

    assert check.failures
    for chunk in 'below recommended'.split() + expect_chunks:
        assert chunk in str(check.failures[0])
def test_min_required_space_changes_with_upgrade_context(
        name, group_names, context, ansible_mounts, failed, extra_words):
    task_vars = dict(
        r_openshift_health_checker_playbook_context=context,
        group_names=group_names,
        ansible_mounts=ansible_mounts,
    )

    check = DiskAvailability(fake_execute_module, task_vars)
    result = check.run()

    assert result.get("failed", False) == failed
    for word in extra_words:
        assert word in result.get('msg', '')
Ejemplo n.º 6
0
def test_is_active(group_names, is_active):
    task_vars = dict(group_names=group_names, )
    assert DiskAvailability(None, task_vars).is_active() == is_active