X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/126dd750f48654cb3b1a4e53c5b7d337003e112f..07aa5aa282a388fc1bcb3d0cfe7520b96b3e7e38:/services/api/test/unit/job_test.rb diff --git a/services/api/test/unit/job_test.rb b/services/api/test/unit/job_test.rb index 9241465d49..5f389c2545 100644 --- a/services/api/test/unit/job_test.rb +++ b/services/api/test/unit/job_test.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'test_helper' require 'helpers/git_test_helper' require 'helpers/docker_migration_helper' @@ -557,7 +561,18 @@ class JobTest < ActiveSupport::TestCase assert_equal Job.deep_sort_hash(a).to_json, Job.deep_sort_hash(b).to_json end - test 'find_reusable' do + test 'find_reusable without logging' do + Rails.logger.expects(:info).never + try_find_reusable + end + + test 'find_reusable with logging' do + Rails.configuration.log_reuse_decisions = true + Rails.logger.expects(:info).at_least(3) + try_find_reusable + end + + def try_find_reusable foobar = jobs(:foobar) example_attrs = { script_version: foobar.script_version, @@ -577,6 +592,11 @@ class JobTest < ActiveSupport::TestCase Job.where(uuid: jobs(:job_with_latest_version).uuid). update_all(output: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa+1') assert_nil Job.find_reusable(example_attrs, {}, [], [users(:active)]) + + # ...unless config says to reuse the earlier job in such cases. + Rails.configuration.reuse_job_if_outputs_differ = true + j = Job.find_reusable(example_attrs, {}, [], [users(:active)]) + assert_equal foobar.uuid, j.uuid end [