def test_end_joins(riak_plan): filters.filter(riak_plan, start=['node1.run', 'node2.run', 'node3.run'], end=['riak_service2.join', 'riak_service3.join']) compare_task_to_names( {n for n in riak_plan if n.status == states.SKIPPED.name}, {'riak_service1.commit'})
def test_second_from_node2_with_node1_walked(riak_plan): success = {'hosts_file1.run', 'riak_service1.run', 'node1.run'} for task in riak_plan.nodes(): if task.name in success: task.status = states.SUCCESS.name filters.filter(riak_plan, start=['node2.run']) compare_task_to_names( {t for t in riak_plan if t.status == states.PENDING.name}, {'hosts_file2.run', 'riak_service2.run', 'node2.run', 'riak_service2.join'})
def test_stage_and_process_partially(): a = ['a'] b = ['b'] both = a + b range_a = range(1, 4) range_b = range(4, 6) with_tag_a = [create_resource(str(n), tags=a) for n in range_a] with_tag_b = [create_resource(str(n), tags=b) for n in range_b] ModelMeta.save_all_lazy() created_log_items_with_a = stage_resources(a, 'restart') assert len(created_log_items_with_a) == len(with_tag_a) created_log_items_with_b = stage_resources(b, 'restart') assert len(created_log_items_with_b) == len(with_tag_b) a_graph = change.send_to_orchestration(a) a_expected = set(['%s.restart' % n for n in range_a]) compare_task_to_names(set(a_graph.nodes()), a_expected) b_graph = change.send_to_orchestration(b) b_expected = set(['%s.restart' % n for n in range_b]) compare_task_to_names(set(b_graph.nodes()), b_expected) both_graph = change.send_to_orchestration(both) compare_task_to_names(set(both_graph.nodes()), a_expected | b_expected)
def test_initial_from_node1_traverse(riak_plan): filters.filter(riak_plan, start=['node1.run']) compare_task_to_names( {t for t in riak_plan if t.status == states.PENDING.name}, {'hosts_file1.run', 'riak_service1.run', 'node1.run'})
def test_start_at_two_nodes(riak_plan): compare_task_to_names(filters.start_from( riak_plan, filters.get_tasks_from_names(riak_plan, ['node1.run', 'node2.run'])), {'hosts_file1.run', 'riak_service2.run', 'riak_service2.join', 'hosts_file2.run', 'node2.run', 'riak_service1.run', 'node1.run'})
def test_riak_end_hosts_file1(riak_plan): compare_task_to_names(filters.end_at( riak_plan, filters.get_tasks_from_names(riak_plan, ['hosts_file1.run'])), {'node1.run', 'hosts_file1.run'})
def test_riak_start_node1(riak_plan): start_tasks = filters.get_tasks_from_names(riak_plan, ['node1.run']) compare_task_to_names( filters.start_from(riak_plan, start_tasks), {'node1.run', 'hosts_file1.run', 'riak_service1.run'})