Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Pod spec does not contain a template container called 'task-runner'" error message swallowed #371

Merged
merged 2 commits into from
Oct 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/kubernetes-deploy/runner_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions test/integration/runner_task_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down