예제 #1
0
def test_marathon_deployments_marathon_but_not_deploy(
    mock_get_deploy_groups_used_by_framework,
    mock_get_pipeline_config,
    capfd,
):
    mock_get_pipeline_config.return_value = [
        {
            'step': 'itest',
        },
        {
            'step': 'performance-check',
        },
        {
            'step': 'push-to-registry',
        },
        {
            'step': 'hab.canary',
            'trigger_next_step_manually': True,
        },
        {
            'step': 'hab.main',
        },
    ]
    mock_get_deploy_groups_used_by_framework.return_value = [
        'hab.canary',
        'hab.main',
        'hab.BOGUS',
    ]
    actual = deployments_check(service='fake_service', soa_dir='/fake/path')
    assert actual is False
    assert 'BOGUS' in capfd.readouterr()[0]
예제 #2
0
def test_marathon_deployments_check_good(
    mock_get_deploy_groups_used_by_framework, mock_get_pipeline_deploy_groups, capfd
):
    mock_get_pipeline_deploy_groups.return_value = ["hab.canary", "hab.main"]
    mock_get_deploy_groups_used_by_framework.return_value = ["hab.canary", "hab.main"]
    actual = deployments_check(service="fake_service", soa_dir="/fake/path")
    assert actual is True
예제 #3
0
def test_marathon_deployments_marathon_but_not_deploy(
    mock_get_marathon_steps,
    mock_get_pipeline_config,
    mock_stdout,
):
    mock_get_pipeline_config.return_value = [
        {
            'step': 'itest',
        },
        {
            'step': 'performance-check',
        },
        {
            'step': 'push-to-registry',
        },
        {
            'step': 'hab.canary',
            'trigger_next_step_manually': True,
        },
        {
            'step': 'hab.main',
        },
    ]
    mock_get_marathon_steps.return_value = [
        'hab.canary',
        'hab.main',
        'hab.BOGUS',
    ]
    actual = deployments_check(service='fake_service', soa_dir='/fake/path')
    assert actual is False
    assert 'BOGUS' in mock_stdout.getvalue()
예제 #4
0
def test_marathon_deployments_deploy_but_not_marathon(
    mock_get_marathon_steps,
    mock_get_pipeline_config,
    capfd,
):
    mock_get_pipeline_config.return_value = [
        {
            'step': 'itest',
        },
        {
            'step': 'performance-check',
        },
        {
            'step': 'push-to-registry',
        },
        {
            'step': 'hab.canary',
            'trigger_next_step_manually': True,
        },
        {
            'step': 'hab.main',
        },
        {
            'step': 'hab.EXTRA',
        },
    ]
    mock_get_marathon_steps.return_value = [
        'hab.canary',
        'hab.main',
    ]
    actual = deployments_check(service='fake_service', soa_dir='/fake/service')
    assert actual is False
    assert 'EXTRA' in capfd.readouterr()[0]
예제 #5
0
def test_marathon_deployments_check_good(
    mock_get_marathon_steps,
    mock_get_pipeline_config,
    capfd,
):
    mock_get_pipeline_config.return_value = [
        {
            'step': 'itest',
        },
        {
            'step': 'performance-check',
        },
        {
            'step': 'push-to-registry',
        },
        {
            'step': 'hab.canary',
            'trigger_next_step_manually': True,
        },
        {
            'step': 'hab.main',
        },
    ]
    mock_get_marathon_steps.return_value = [
        'hab.canary',
        'hab.main',
    ]
    actual = deployments_check(service='fake_service', soa_dir='/fake/path')
    assert actual is True
예제 #6
0
def test_marathon_deployments_check_good(
    mock_get_deploy_groups_used_by_framework,
    mock_get_pipeline_deploy_groups,
    capfd,
):
    mock_get_pipeline_deploy_groups.return_value = ['hab.canary', 'hab.main']
    mock_get_deploy_groups_used_by_framework.return_value = [
        'hab.canary', 'hab.main'
    ]
    actual = deployments_check(service='fake_service', soa_dir='/fake/path')
    assert actual is True
예제 #7
0
def test_marathon_deployments_marathon_but_not_deploy(
        mock_get_deploy_groups_used_by_framework,
        mock_get_pipeline_deploy_groups, capfd):
    mock_get_pipeline_deploy_groups.return_value = ["hab.canary", "hab.main"]
    mock_get_deploy_groups_used_by_framework.return_value = [
        "hab.canary",
        "hab.main",
        "hab.BOGUS",
    ]
    actual = deployments_check(service="fake_service", soa_dir="/fake/path")
    assert actual is False
    assert "BOGUS" in capfd.readouterr()[0]
예제 #8
0
def test_marathon_deployments_marathon_but_not_deploy(
    mock_get_deploy_groups_used_by_framework,
    mock_get_pipeline_deploy_groups,
    capfd,
):
    mock_get_pipeline_deploy_groups.return_value = ['hab.canary', 'hab.main']
    mock_get_deploy_groups_used_by_framework.return_value = [
        'hab.canary', 'hab.main', 'hab.BOGUS'
    ]
    actual = deployments_check(service='fake_service', soa_dir='/fake/path')
    assert actual is False
    assert 'BOGUS' in capfd.readouterr()[0]
예제 #9
0
def test_marathon_deployments_check_good(
    mock_get_marathon_steps,
    mock_get_pipeline_config,
    mock_stdout,
):
    mock_get_pipeline_config.return_value = [
        {'instancename': 'itest', },
        {'instancename': 'performance-check', },
        {'instancename': 'push-to-registry', },
        {'instancename': 'hab.canary', 'trigger_next_step_manually': True, },
        {'instancename': 'hab.main', },
    ]
    mock_get_marathon_steps.return_value = [
        'hab.canary',
        'hab.main',
    ]
    actual = deployments_check(service='fake_service', soa_dir='/fake/path')
    assert actual is True
예제 #10
0
def test_marathon_deployments_deploy_but_not_marathon(
    mock_get_marathon_steps,
    mock_get_pipeline_config,
    mock_stdout,
):
    mock_get_pipeline_config.return_value = [
        {'step': 'itest', },
        {'step': 'performance-check', },
        {'step': 'push-to-registry', },
        {'step': 'hab.canary', 'trigger_next_step_manually': True, },
        {'step': 'hab.main', },
        {'step': 'hab.EXTRA', },
    ]
    mock_get_marathon_steps.return_value = [
        'hab.canary',
        'hab.main',
    ]
    actual = deployments_check(service='fake_service', soa_dir='/fake/service')
    assert actual is False
    assert 'EXTRA' in mock_stdout.getvalue()
예제 #11
0
def test_marathon_deployments_marathon_but_not_deploy(
    mock_get_marathon_steps,
    mock_get_pipeline_config,
    mock_stdout,
):
    mock_get_pipeline_config.return_value = [
        {'instancename': 'itest', },
        {'instancename': 'performance-check', },
        {'instancename': 'push-to-registry', },
        {'instancename': 'hab.canary', 'trigger_next_step_manually': True, },
        {'instancename': 'hab.main', },
    ]
    mock_get_marathon_steps.return_value = [
        'hab.canary',
        'hab.main',
        'hab.BOGUS',
    ]
    actual = deployments_check('fake_service')
    assert actual is False
    assert 'BOGUS' in mock_stdout.getvalue()