From 3669162e11286abe18925c65ec5a126ab80ff0b3 Mon Sep 17 00:00:00 2001 From: Daniel Turner Date: Thu, 25 Oct 2018 17:11:09 -0700 Subject: [PATCH 1/2] Write test to show swallowed error message --- test/integration/runner_task_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/integration/runner_task_test.rb b/test/integration/runner_task_test.rb index 2bde99948..fb9977c92 100644 --- a/test/integration/runner_task_test.rb +++ b/test/integration/runner_task_test.rb @@ -206,6 +206,26 @@ def test_run_with_template_missing end end + def test_run_with_pod_spec_template_missing + deploy_task_template do |fixtures| + template = fixtures["template-runner.yml"]["PodTemplate"].first["template"] + template["spec"]["containers"].first["name"] = "bad-name" + end + + task_runner = build_task_runner + assert_task_run_failure(task_runner.run(run_params)) + message = "Pod spec does not contain a template container called 'task-runner'" + + assert_raises_message(KubernetesDeploy::RunnerTask::TaskConfigurationError, message) do + task_runner.run!(run_params) + end + + assert_logs_match_all([ + "Result: FAILURE", + message + ], in_order: true) + end + def test_run_adds_env_vars_provided_to_the_task_container deploy_task_template From bdb2398208a8045fcdaced6437e8b036a7edd4de Mon Sep 17 00:00:00 2001 From: Daniel Turner Date: Mon, 29 Oct 2018 15:26:54 -0700 Subject: [PATCH 2/2] Log the error is the pattern we're actually using --- lib/kubernetes-deploy/runner_task.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/kubernetes-deploy/runner_task.rb b/lib/kubernetes-deploy/runner_task.rb index 57ecde636..0b57124ea 100644 --- a/lib/kubernetes-deploy/runner_task.rb +++ b/lib/kubernetes-deploy/runner_task.rb @@ -164,7 +164,9 @@ def build_pod_definition(base_template) def set_container_overrides!(pod_definition, entrypoint, args, env_vars) container = pod_definition.spec.containers.find { |cont| cont.name == 'task-runner' } if container.nil? - raise TaskConfigurationError, "Pod spec does not contain a template container called 'task-runner'" + message = "Pod spec does not contain a template container called 'task-runner'" + @logger.summary.add_paragraph(message) + raise TaskConfigurationError, message end container.command = entrypoint