projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
12960: Fix test due to slightly different serialization from jsonb
[arvados.git]
/
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 9241465d4969388df24acc87087a9af9cb3cfb80..5f389c2545fa20bafd7ace1736b740abb44f3538 100644
(file)
--- 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'
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
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,
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)])
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
[
end
[