From d055bb13cdf393309deede33ae4a4a5f2e39bd58 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Mon, 4 Apr 2022 10:18:31 -0400 Subject: [PATCH] 18943: Fix tests Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- sdk/python/tests/test_util.py | 4 +-- .../20220401153101_fix_created_at_indexes.rb | 7 ----- .../api/test/fixtures/pipeline_instances.yml | 30 +++++++++---------- .../test/functional/arvados/v1/query_test.rb | 6 ++-- services/api/test/integration/select_test.rb | 2 +- 5 files changed, 21 insertions(+), 28 deletions(-) diff --git a/sdk/python/tests/test_util.py b/sdk/python/tests/test_util.py index 1c0e437b41..4dba9ce3dc 100644 --- a/sdk/python/tests/test_util.py +++ b/sdk/python/tests/test_util.py @@ -166,10 +166,10 @@ class KeysetListAllTestCase(unittest.TestCase): def test_onepage_desc(self): ks = KeysetTestHelper([[ - {"limit": 1000, "count": "none", "order": ["created_at desc", "uuid asc"], "filters": []}, + {"limit": 1000, "count": "none", "order": ["created_at desc", "uuid desc"], "filters": []}, {"items": [{"created_at": "2", "uuid": "2"}, {"created_at": "1", "uuid": "1"}]} ], [ - {"limit": 1000, "count": "none", "order": ["created_at desc", "uuid asc"], "filters": [["created_at", "<=", "1"], ["uuid", "!=", "1"]]}, + {"limit": 1000, "count": "none", "order": ["created_at desc", "uuid desc"], "filters": [["created_at", "<=", "1"], ["uuid", "!=", "1"]]}, {"items": []} ]]) diff --git a/services/api/db/migrate/20220401153101_fix_created_at_indexes.rb b/services/api/db/migrate/20220401153101_fix_created_at_indexes.rb index 35ed4cd152..590e8413e9 100644 --- a/services/api/db/migrate/20220401153101_fix_created_at_indexes.rb +++ b/services/api/db/migrate/20220401153101_fix_created_at_indexes.rb @@ -21,14 +21,7 @@ class FixCreatedAtIndexes < ActiveRecord::Migration[5.2] def down @@idxtables.each do |table| - ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at") - ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at_uuid") - ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at_and_uuid") - ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_modified_at") - ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_modified_at_uuid") ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_modified_at_and_uuid") - - ActiveRecord::Base.connection.execute("CREATE INDEX IF NOT EXISTS index_#{table.to_s}_on_created_at_and_uuid ON #{table.to_s} USING btree (created_at, uuid)") ActiveRecord::Base.connection.execute("CREATE INDEX IF NOT EXISTS index_#{table.to_s}_on_modified_at_uuid ON #{table.to_s} USING btree (modified_at desc, uuid asc)") end end diff --git a/services/api/test/fixtures/pipeline_instances.yml b/services/api/test/fixtures/pipeline_instances.yml index 9621b3effc..22d97871ea 100644 --- a/services/api/test/fixtures/pipeline_instances.yml +++ b/services/api/test/fixtures/pipeline_instances.yml @@ -97,7 +97,7 @@ has_job: state: Ready uuid: zzzzz-d1hrv-1yfj6xkidf2muk3 owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz - created_at: <%= 3.1.minute.ago.to_s(:db) %> + created_at: <%= 2.1.minute.ago.to_s(:db) %> components: foo: script: foo @@ -112,7 +112,7 @@ components_is_jobspec: # Helps test that clients cope with funny-shaped components. # For an example, see #3321. uuid: zzzzz-d1hrv-1yfj61234abcdk4 - created_at: <%= 2.minute.ago.to_s(:db) %> + created_at: <%= 4.minute.ago.to_s(:db) %> owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz @@ -132,7 +132,7 @@ pipeline_with_tagged_collection_input: state: Ready uuid: zzzzz-d1hrv-1yfj61234abcdk3 owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz - created_at: <%= 3.1.minute.ago.to_s(:db) %> + created_at: <%= 3.2.minute.ago.to_s(:db) %> components: part-one: script_parameters: @@ -145,7 +145,7 @@ pipeline_to_merge_params: uuid: zzzzz-d1hrv-1yfj6dcba4321k3 pipeline_template_uuid: zzzzz-p5p6p-aox0k0ofxrystgw owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz - created_at: <%= 3.1.minute.ago.to_s(:db) %> + created_at: <%= 3.3.minute.ago.to_s(:db) %> components: part-one: script_parameters: @@ -193,7 +193,7 @@ pipeline_instance_owned_by_fuse: uuid: zzzzz-d1hrv-ri9dvgkgqs9y09j owner_uuid: zzzzz-tpzed-0fusedrivertest pipeline_template_uuid: zzzzz-p5p6p-vq4wuvy84xvaq2r - created_at: 2014-09-15 12:00:00 + created_at: 2014-09-16 12:00:00 name: "pipeline instance owned by FUSE" components: foo: @@ -210,7 +210,7 @@ pipeline_instance_in_fuse_project: uuid: zzzzz-d1hrv-scarxiyajtshq3l owner_uuid: zzzzz-j7d0g-0000ownedbyfuse pipeline_template_uuid: zzzzz-p5p6p-vq4wuvy84xvaq2r - created_at: 2014-09-15 12:00:00 + created_at: 2014-09-17 12:00:00 name: "pipeline instance in FUSE project" components: foo: @@ -227,7 +227,7 @@ pipeline_owned_by_active_in_aproject: state: Complete uuid: zzzzz-d1hrv-ju5ghi0i9z2kqc6 owner_uuid: zzzzz-j7d0g-v955i6s2oi1cbso - created_at: 2014-09-15 12:00:00 + created_at: 2014-09-18 12:00:00 components: foo: script: foo @@ -243,7 +243,7 @@ pipeline_owned_by_active_in_home: state: Complete uuid: zzzzz-d1hrv-lihrbd0i9z2kqc6 owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz - created_at: 2014-09-15 12:00:00 + created_at: 2014-09-19 12:00:00 components: foo: script: foo @@ -287,7 +287,7 @@ pipeline_in_publicly_accessible_project_but_other_objects_elsewhere: name: Pipeline in public project with other objects elsewhere pipeline_template_uuid: zzzzz-p5p6p-aox0k0ofxrystgw state: Complete - created_at: 2014-09-15 12:00:00 + created_at: 2014-09-20 12:00:00 components: foo: script: foo @@ -314,7 +314,7 @@ new_pipeline_in_publicly_accessible_project: name: Pipeline in New state in publicly accessible project pipeline_template_uuid: zzzzz-p5p6p-tmpltpublicproj state: New - created_at: 2014-09-15 12:00:00 + created_at: 2014-09-21 12:00:00 components: foo: script: foo @@ -331,7 +331,7 @@ new_pipeline_in_publicly_accessible_project_but_other_objects_elsewhere: name: Pipeline in New state in public project with objects elsewhere pipeline_template_uuid: zzzzz-p5p6p-aox0k0ofxrystgw state: New - created_at: 2014-09-15 12:00:00 + created_at: 2014-09-22 12:00:00 components: foo: script: foo @@ -348,7 +348,7 @@ new_pipeline_in_publicly_accessible_project_with_dataclass_file_and_other_object name: Pipeline in public project in New state with file type data class with objects elsewhere pipeline_template_uuid: zzzzz-p5p6p-aox0k0ofxrystgw state: New - created_at: 2014-09-15 12:00:00 + created_at: 2014-09-23 12:00:00 components: foo: script: foo @@ -363,8 +363,8 @@ pipeline_in_running_state: name: running_with_job uuid: zzzzz-d1hrv-runningpipeline owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz - created_at: <%= 3.1.minute.ago.to_s(:db) %> - started_at: <%= 3.1.minute.ago.to_s(:db) %> + created_at: <%= 3.4.minute.ago.to_s(:db) %> + started_at: <%= 3.3.minute.ago.to_s(:db) %> state: RunningOnServer components: foo: @@ -393,7 +393,7 @@ complete_pipeline_with_two_jobs: uuid: zzzzz-d1hrv-twodonepipeline owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz state: Complete - created_at: <%= 3.minute.ago.to_s(:db) %> + created_at: <%= 2.5.minute.ago.to_s(:db) %> started_at: <%= 2.minute.ago.to_s(:db) %> finished_at: <%= 1.minute.ago.to_s(:db) %> components: diff --git a/services/api/test/functional/arvados/v1/query_test.rb b/services/api/test/functional/arvados/v1/query_test.rb index 9bba418578..fae9dc40c6 100644 --- a/services/api/test/functional/arvados/v1/query_test.rb +++ b/services/api/test/functional/arvados/v1/query_test.rb @@ -24,7 +24,7 @@ class Arvados::V1::QueryTest < ActionController::TestCase controller: 'logs', } assert_response :success - assert_equal('logs.event_type asc, logs.modified_at desc, logs.uuid', + assert_equal('logs.event_type asc, logs.modified_at desc, logs.uuid desc', assigns(:objects).order_values.join(', ')) end @@ -36,7 +36,7 @@ class Arvados::V1::QueryTest < ActionController::TestCase controller: 'logs', } assert_response :success - assert_equal('logs.modified_at asc, logs.uuid', + assert_equal('logs.modified_at asc, logs.uuid desc', assigns(:objects).order_values.join(', ')) end @@ -51,7 +51,7 @@ class Arvados::V1::QueryTest < ActionController::TestCase controller: 'logs', } assert_response :success - assert_equal('logs.modified_at asc, logs.event_type desc, logs.uuid', + assert_equal('logs.modified_at asc, logs.event_type desc, logs.uuid desc', assigns(:objects).order_values.join(', ')) end diff --git a/services/api/test/integration/select_test.rb b/services/api/test/integration/select_test.rb index 2ee3b3cf94..0548a767ba 100644 --- a/services/api/test/integration/select_test.rb +++ b/services/api/test/integration/select_test.rb @@ -62,7 +62,7 @@ class SelectTest < ActionDispatch::IntegrationTest headers: auth(:admin) assert_response :success uuids = json_response['items'].collect { |i| i['uuid'] } - assert_equal uuids, uuids.sort + assert_equal uuids, uuids.sort.reverse end def assert_link_classes_ascend(current_class, prev_class) -- 2.30.2