Exemple #1
0
 def test_pipeline_with_asset_count_for_action(scenario1):
     builder = PipelineBuilder(name='orchestrate')
     pipeline = builder.build(scenario1, teflo_options={})
     tasks = getattr(pipeline, 'tasks')
     assert isinstance(getattr(tasks[0].get('package'), 'hosts')[-1], Asset)
     assert len(getattr(tasks[0].get('package'), 'hosts')) == 1
     assert getattr(getattr(tasks[0].get('package'), 'hosts')[-1], 'name') == 'host_0'
Exemple #2
0
 def test_pipeline_with_skip_label(scenario_labels):
     builder = PipelineBuilder(name='execute')
     pipeline = builder.build(scenario_labels, teflo_options={'skip_labels': ('label2',)})
     tasks = getattr(pipeline, 'tasks')
     assert isinstance(getattr(tasks[0].get('package'), 'hosts')[-1], Asset)
     assert len(getattr(tasks[0].get('package'), 'hosts')) == 1
     assert getattr(getattr(tasks[0].get('package'), 'hosts')[-1], 'name') == 'host_3'
Exemple #3
0
 def test_pipeline_with_asset_count_using_role_for_execute(scenario1, asset2):
     scenario1.add_assets(asset2)
     builder = PipelineBuilder(name='execute')
     pipeline = builder.build(scenario1, teflo_options={})
     tasks = getattr(pipeline, 'tasks')
     assert isinstance(getattr(tasks[-1].get('package'), 'hosts')[-1], Asset)
     assert len(getattr(tasks[-1].get('package'), 'hosts')) == 1
     assert getattr(getattr(tasks[-1].get('package'), 'hosts')[-1], 'name') == 'host_1'
Exemple #4
0
 def test_pipeline_with_asset_count_using_groups_for_execute(scenario1, asset3, execute2):
     scenario1.add_assets(asset3)
     scenario1.add_executes(execute2)
     builder = PipelineBuilder(name='execute')
     pipeline = builder.build(scenario1, teflo_options={})
     tasks = getattr(pipeline, 'tasks')
     assert isinstance(getattr(scenario1, 'executes')[0].hosts[-1], string_types)
     assert len(getattr(tasks[1].get('package'), 'hosts')) == 1
     assert getattr(getattr(tasks[1].get('package'), 'hosts')[-1], 'name') == 'host_3'
Exemple #5
0
 def test_build_cleanup_task_pipeline_failed_orch_status(scenario1, action_resource_cleanup):
     """Validate that orchestrate tasks with a failed status aren't getting filtered for cleanup"""
     setattr(action_resource_cleanup, 'status', 1)
     scenario1.add_actions(action_resource_cleanup)
     builder = PipelineBuilder(name='cleanup')
     pipeline = builder.build(scenario1, teflo_options={})
     assert getattr(pipeline, 'name') == 'cleanup'
     assert isinstance(getattr(pipeline, 'tasks'), list)
     assert getattr(pipeline, 'type') is CleanupTask
     assert len([task for task in getattr(pipeline, 'tasks') if 'package' in task]) == 2
Exemple #6
0
 def test_build_validate_task_pipeline(scenario):
     builder = PipelineBuilder(name='validate')
     pipeline = builder.build(scenario, teflo_options={})
     assert getattr(pipeline, 'name') == 'validate'
     assert isinstance(getattr(pipeline, 'tasks'), list)
     assert getattr(pipeline, 'type') is ValidateTask
Exemple #7
0
 def test_multiple_scenario_pipeline_02(master_child_scenario):
     builder = PipelineBuilder(name='execute')
     pipeline = builder.build(master_child_scenario, teflo_options={})
     tasks = getattr(pipeline, 'tasks')
     assert len(tasks) == 2
Exemple #8
0
 def test_build_cleanup_task_pipeline(scenario):
     builder = PipelineBuilder(name='cleanup')
     pipeline = builder.build(scenario, teflo_options={})
     assert getattr(pipeline, 'name') == 'cleanup'
     assert isinstance(getattr(pipeline, 'tasks'), list)
     assert getattr(pipeline, 'type') is CleanupTask
Exemple #9
0
 def test_build_report_task_pipeline(scenario):
     builder = PipelineBuilder(name='report')
     pipeline = builder.build(scenario, teflo_options={})
     assert getattr(pipeline, 'name') == 'report'
     assert isinstance(getattr(pipeline, 'tasks'), list)
     assert getattr(pipeline, 'type') is ReportTask
Exemple #10
0
 def test_build_provision_task_pipeline(scenario):
     builder = PipelineBuilder(name='provision')
     pipeline = builder.build(scenario, teflo_options={})
     assert getattr(pipeline, 'name') == 'provision'
     assert isinstance(getattr(pipeline, 'tasks'), list)
     assert getattr(pipeline, 'type') is ProvisionTask