Example #1
0
def test_verify_link_in_task_graph(chain, decision_link, build_link):
    chain.links = [decision_link, build_link]
    decision_link.task_graph = {
        build_link.task_id: {
            'task': deepcopy(build_link.task)
        },
        chain.task_id: {
            'task': deepcopy(chain.task)
        }
    }
    cotverify.verify_link_in_task_graph(chain, decision_link, build_link)
Example #2
0
def test_verify_link_in_task_graph_fuzzy_match(chain, decision_link, build_link):
    chain.links = [decision_link, build_link]
    decision_link.task_graph = {
        'bogus-task-id': {
            'task': deepcopy(build_link.task)
        },
        'bogus-task-id2': {
            'task': deepcopy(chain.task)
        }
    }
    cotverify.verify_link_in_task_graph(chain, decision_link, build_link)
Example #3
0
def test_verify_link_in_task_graph_exception(chain, decision_link, build_link):
    chain.links = [decision_link, build_link]
    bad_task = deepcopy(build_link.task)
    bad_task['dependencies'].append("foo")
    bad_task['x'] = 'y'
    build_link.task['x'] = 'z'
    decision_link.task_graph = {
        build_link.task_id: {
            'task': bad_task
        },
        chain.task_id: {
            'task': deepcopy(chain.task)
        },
    }
    with pytest.raises(CoTError):
        cotverify.verify_link_in_task_graph(chain, decision_link, build_link)
Example #4
0
def test_verify_link_in_task_graph_fuzzy_match(chain, decision_link,
                                               build_link, zero_deps):
    chain.links = [decision_link, build_link]
    task_defn1 = deepcopy(build_link.task)
    task_defn2 = deepcopy(chain.task)
    if zero_deps:
        build_link.task['dependencies'] = []
        chain.task['dependencies'] = []
    decision_link.task_graph = {
        'bogus-task-id': {
            'task': task_defn1
        },
        'bogus-task-id2': {
            'task': task_defn2
        }
    }
    cotverify.verify_link_in_task_graph(chain, decision_link, build_link)