def setup_previous_result(self, work_dir_path, artifact_config={}): step_result = StepResult( step_name='test-step', sub_step_name='test-sub-step-name', sub_step_implementer_name='test-step-implementer-name') for key1, val1 in artifact_config.items(): description = '' value = '' for key2, val2 in val1.items(): if key2 == 'description': description = val2 elif key2 == 'value': value = val2 else: raise StepRunnerException( f'Given field is not apart of an artifact: {key2}') step_result.add_artifact( name=key1, value=value, description=description, ) workflow_result = WorkflowResult() workflow_result.add_step_result(step_result=step_result) pickle_filename = os.path.join(work_dir_path, 'step-runner-results.pkl') workflow_result.write_to_pickle_file(pickle_filename=pickle_filename)
def __setup_get_value_with_env_test(self, test_dir, environment): step_config = {'test': 'hello world'} results_dir_path = os.path.join(test_dir.path, 'step-runner-results') results_file_name = 'step-runner-results.yml' work_dir_path = os.path.join(test_dir.path, 'working') workflow_result = WorkflowResult() step_result_deploy_test = StepResult( step_name='deploy', sub_step_name='ArgoCD', sub_step_implementer_name='ArgoCD', environment='TEST') step_result_deploy_test.add_artifact( name='deployed-host-urls', value='https://awesome-app.test.ploigos.xyz') workflow_result.add_step_result(step_result=step_result_deploy_test) step_result_deploy_prod = StepResult( step_name='deploy', sub_step_name='ArgoCD', sub_step_implementer_name='ArgoCD', environment='PROD') step_result_deploy_prod.add_artifact( name='deployed-host-urls', value='https://awesome-app.prod.ploigos.xyz') workflow_result.add_step_result(step_result=step_result_deploy_prod) pickle_filename = os.path.join(work_dir_path, 'step-runner-results.pkl') workflow_result.write_to_pickle_file(pickle_filename=pickle_filename) return self.create_given_step_implementer( step_implementer=FooStepImplementer, step_config=step_config, step_name='foo', implementer='FooStepImplementer', results_dir_path=results_dir_path, results_file_name=results_file_name, work_dir_path=work_dir_path, environment=environment)