From 6d6b609a1952bd0edb87413f24753d7b85c093b7 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Tue, 17 Jun 2014 13:51:18 -0400 Subject: [PATCH] 2879: Support tag search in "in docker" Job filters. The search uses the same `reponame:tagname` format used by `docker tag`. --- .../controllers/arvados/v1/jobs_controller.rb | 2 +- .../arvados/v1/job_reuse_controller_test.rb | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/services/api/app/controllers/arvados/v1/jobs_controller.rb b/services/api/app/controllers/arvados/v1/jobs_controller.rb index d823b00d34..3e3150b70b 100644 --- a/services/api/app/controllers/arvados/v1/jobs_controller.rb +++ b/services/api/app/controllers/arvados/v1/jobs_controller.rb @@ -190,7 +190,7 @@ class Arvados::V1::JobsController < ApplicationController false when ["docker_image_locator", "in docker"], ["docker_image_locator", "not in docker"] filter[1].sub!(/ docker$/, '') - filter[2] = Collection.uuids_for_docker_image(filter[2]) + filter[2] = Collection.uuids_for_docker_image(*filter[2].split(':', 2)) true else true diff --git a/services/api/test/functional/arvados/v1/job_reuse_controller_test.rb b/services/api/test/functional/arvados/v1/job_reuse_controller_test.rb index 450093c75b..5cdf6c75b5 100644 --- a/services/api/test/functional/arvados/v1/job_reuse_controller_test.rb +++ b/services/api/test/functional/arvados/v1/job_reuse_controller_test.rb @@ -413,6 +413,34 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase end end + test "reuse Job with Docker image repo+tag" do + filter_h = BASE_FILTERS. + merge("script_version" => + ["=", "4fe459abe02d9b365932b8f5dc419439ab4e2577"], + "docker_image_locator" => + ["in docker", links(:docker_image_collection_tag2).name]) + post(:create, { + job: { + script: "hash", + script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577", + repository: "foo", + script_parameters: { + input: 'fa7aeb5140e2848d39b416daeef4ffc5+45', + an_integer: '1' + }, + }, + filters: filters_from_hash(filter_h), + find_or_create: true, + }) + assert_response :success + new_job = assigns(:object) + assert_not_nil new_job + target_job = jobs(:previous_docker_job_run) + [:uuid, :script_version, :docker_image_locator].each do |attr| + assert_equal(target_job.send(attr), new_job.send(attr)) + end + end + test "new job with unknown Docker image filter" do filter_h = BASE_FILTERS. merge("docker_image_locator" => ["in docker", "_nonesuchname_"]) -- 2.30.2