def test_run_pipeline( image_tag, direct_runner, update, blocking, cli_runner, klio_config, patch_get_config, patch_run_basic_pipeline, patch_klio_config, mock_compare_runtime_to_buildtime_config, ): mock_compare_runtime_to_buildtime_config.return_value = True runtime_conf = cli.RuntimeConfig( image_tag=None, direct_runner=False, update=None, blocking=None ) cli_inputs = [] if image_tag: cli_inputs.extend(["--image-tag", image_tag]) runtime_conf = runtime_conf._replace(image_tag=image_tag) if direct_runner: cli_inputs.append("--direct-runner") runtime_conf = runtime_conf._replace(direct_runner=True) if update: cli_inputs.append("--update") runtime_conf = runtime_conf._replace(update=True) if update is False: cli_inputs.append("--no-update") if not update: # if none or false runtime_conf = runtime_conf._replace(update=False) if blocking: cli_inputs.append("--blocking") runtime_conf._replace(blocking=True) if blocking is False: cli_inputs.append("--no-blocking") if not blocking: runtime_conf._replace(blocking=False) result = cli_runner.invoke(cli.run_pipeline, cli_inputs) assert 0 == result.exit_code patch_run_basic_pipeline.assert_called_once_with() mock_compare_runtime_to_buildtime_config.assert_called_once_with( "klio-job.yaml" )
def test_run_pipeline( image_tag, direct_runner, update, blocking, cli_runner, mock_klio_config, patch_run_basic_pipeline, ): runtime_conf = cli.RuntimeConfig(image_tag=None, direct_runner=False, update=None, blocking=None) cli_inputs = [] if image_tag: cli_inputs.extend(["--image-tag", image_tag]) runtime_conf = runtime_conf._replace(image_tag=image_tag) if direct_runner: cli_inputs.append("--direct-runner") runtime_conf = runtime_conf._replace(direct_runner=True) if update: cli_inputs.append("--update") runtime_conf = runtime_conf._replace(update=True) if update is False: cli_inputs.append("--no-update") if not update: # if none or false runtime_conf = runtime_conf._replace(update=False) if blocking: cli_inputs.append("--blocking") runtime_conf._replace(blocking=True) if blocking is False: cli_inputs.append("--no-blocking") if not blocking: runtime_conf._replace(blocking=False) result = cli_runner.invoke(cli.run_pipeline, cli_inputs) core_testing.assert_execution_success(result) mock_klio_config.assert_calls() patch_run_basic_pipeline.assert_called_once_with()