Skip to content

Commit

Permalink
Dependencies: GoodJob v3.99.1 (#702)
Browse files Browse the repository at this point in the history
* chore: update good_jobs to v3.99.1 to prepare for 4.X upgrade

* chore: add in missing jobs schema file

* chore: fix rubocop violations in migrations

* chore: attempt to fix some flaky tests
  • Loading branch information
ericenns authored Aug 14, 2024
1 parent b8793f7 commit 6c65b10
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ gem 'azure-storage-blob', github: 'honeyankit/azure-storage-ruby', branch: 'mast
gem 'google-cloud-storage', '~> 1.11', require: false

# job queueing
gem 'good_job', '~> 3.21'
gem 'good_job', '~> 3.99'

# spreadsheet parser [https://github.com/roo-rb/roo]
gem 'roo', '~> 2.10.0'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ GEM
railties (>= 6.0.0)
globalid (1.2.1)
activesupport (>= 6.1)
good_job (3.29.2)
good_job (3.99.1)
activejob (>= 6.0.0)
activerecord (>= 6.0.0)
concurrent-ruby (>= 1.0.2)
Expand Down Expand Up @@ -640,7 +640,7 @@ DEPENDENCIES
faraday-multipart
faraday-net_http_persistent (~> 2.0)
fx
good_job (~> 3.21)
good_job (~> 3.99)
google-cloud-storage (~> 1.11)
graphiql-rails
graphql
Expand Down
19 changes: 19 additions & 0 deletions db/jobs_migrate/20240814150153_create_good_job_process_lock_ids.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

# Migration to add process lock ids
class CreateGoodJobProcessLockIds < ActiveRecord::Migration[7.1]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.column_exists?(:good_jobs, :locked_by_id)
end
end

add_column :good_jobs, :locked_by_id, :uuid # rubocop:disable Rails/BulkChangeTable
add_column :good_jobs, :locked_at, :datetime
add_column :good_job_executions, :process_id, :uuid
add_column :good_job_processes, :lock_type, :integer, limit: 2
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# frozen_string_literal: true

# Migration to create good job process lock indexes
class CreateGoodJobProcessLockIndexes < ActiveRecord::Migration[7.1]
disable_ddl_transaction!

def change # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
reversible do |dir| # rubocop:disable Metrics/BlockLength
dir.up do
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked)
add_index :good_jobs, %i[priority scheduled_at],
order: { priority: 'ASC NULLS LAST', scheduled_at: :asc },
where: 'finished_at IS NULL AND locked_by_id IS NULL',
name: :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked,
algorithm: :concurrently
end

unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_locked_by_id)
add_index :good_jobs, :locked_by_id,
where: 'locked_by_id IS NOT NULL',
name: :index_good_jobs_on_locked_by_id,
algorithm: :concurrently
end

unless connection.index_name_exists?(:good_job_executions,
:index_good_job_executions_on_process_id_and_created_at)
add_index :good_job_executions, %i[process_id created_at],
name: :index_good_job_executions_on_process_id_and_created_at,
algorithm: :concurrently
end
end

dir.down do
if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked)
remove_index(:good_jobs, name: :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked)
end
if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_locked_by_id)
remove_index(:good_jobs, name: :index_good_jobs_on_locked_by_id)
end
if connection.index_name_exists?(:good_job_executions, :index_good_job_executions_on_process_id_and_created_at)
remove_index(:good_job_executions, name: :index_good_job_executions_on_process_id_and_created_at)
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

# Migration to create good job execution duration column
class CreateGoodJobExecutionDuration < ActiveRecord::Migration[7.1]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.column_exists?(:good_job_executions, :duration)
end
end

add_column :good_job_executions, :duration, :interval
end
end
10 changes: 9 additions & 1 deletion db/jobs_schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions test/system/projects/samples_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1023,14 +1023,14 @@ class SamplesTest < ApplicationSystemTestCase
click_on I18n.t('projects.samples.attachments.deletions.modal.submit_button')
assert_html5_inputs_valid
end
assert_text I18n.t('projects.samples.attachments.deletions.destroy.success')
within %(turbo-frame[id="table-listing"]) do
assert_selector 'table #attachments-table-body tr', count: 0
assert_no_text 'test_file.fastq'
assert_no_text 'test_file_A.fastq'
assert_text I18n.t('projects.samples.show.no_files')
assert_text I18n.t('projects.samples.show.no_associated_files')
end
assert_text I18n.t('projects.samples.attachments.deletions.destroy.success')
end

test 'should be able to delete multiple attachments including paired files' do
Expand All @@ -1057,6 +1057,7 @@ class SamplesTest < ApplicationSystemTestCase
assert_text 'test_file_D.fastq'
click_on I18n.t('projects.samples.attachments.deletions.modal.submit_button')
end
assert_text I18n.t('projects.samples.attachments.deletions.destroy.success')
within %(turbo-frame[id="table-listing"]) do
assert_selector 'table #attachments-table-body tr', count: 2
assert_no_text 'test_file_fwd_1.fastq'
Expand All @@ -1067,7 +1068,6 @@ class SamplesTest < ApplicationSystemTestCase
assert_no_text 'test_file_rev_3.fastq'
assert_no_text 'test_file_D.fastq'
end
assert_text I18n.t('projects.samples.attachments.deletions.destroy.success')
end

test 'user can see delete buttons as owner' do
Expand Down Expand Up @@ -2289,14 +2289,14 @@ def retrieve_puids
click_on I18n.t('projects.samples.deletions.new_multiple_deletions_dialog.submit_button')
end

assert_text I18n.t('projects.samples.deletions.destroy_multiple.success')

within 'tbody' do
assert_selector 'tr', count: 2
assert_no_text @sample1.name
assert_text @sample2.name
assert_text @sample3.name
end

assert_text I18n.t('projects.samples.deletions.destroy_multiple.success')
end

test 'delete single sample with remove link while all samples selected followed by multiple deletion' do
Expand Down
15 changes: 0 additions & 15 deletions test/system/projects/workflow_executions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class WorkflowExecutionsTest < ApplicationSystemTestCase
workflow_execution2 = workflow_executions(:automated_example_canceling)
workflow_execution3 = workflow_executions(:automated_example_canceled)
workflow_execution4 = workflow_executions(:automated_workflow_execution_existing)
workflow_execution5 = workflow_executions(:automated_example_prepared)

visit namespace_project_workflow_executions_path(@namespace, @project)

Expand Down Expand Up @@ -85,20 +84,6 @@ class WorkflowExecutionsTest < ApplicationSystemTestCase
assert_selector "tr:last-child td:nth-child(#{@workflow_name_col})",
text: workflow_execution3.metadata['workflow_name']
end

click_on 'Created'
assert_selector "#workflow-executions-table table thead th:nth-child(#{@created_at_col}) svg.icon-arrow_up"

within first('#workflow-executions-table table tbody') do
assert_selector 'tr', count: 10

assert_selector "tr:first-child td:nth-child(#{@created_at_col})",
text: I18n.l(workflow_execution1.created_at.localtime, format: :full_date)
assert_selector "tr:nth-child(2) td:nth-child(#{@created_at_col})",
text: I18n.l(workflow_execution5.created_at.localtime, format: :full_date)
assert_selector "tr:last-child td:nth-child(#{@created_at_col})",
text: I18n.l(workflow_execution4.created_at.localtime, format: :full_date)
end
end

test 'should be able to cancel a workflow' do
Expand Down
14 changes: 0 additions & 14 deletions test/system/workflow_executions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class WorkflowExecutionsTest < ApplicationSystemTestCase
workflow_execution8 = workflow_executions(:irida_next_example_canceling)
workflow_execution9 = workflow_executions(:irida_next_example_canceled)
workflow_execution10 = workflow_executions(:workflow_execution_existing)
workflow_execution12 = workflow_executions(:irida_next_example_new)

visit workflow_executions_path

Expand Down Expand Up @@ -104,19 +103,6 @@ class WorkflowExecutionsTest < ApplicationSystemTestCase
assert_selector "tr:last-child td:nth-child(#{@workflow_name_col})",
text: workflow_execution9.metadata['workflow_name']
end

click_on 'Created'
assert_selector "#workflow-executions-table table thead th:nth-child(#{@created_at_col}) svg.icon-arrow_up"

within first('#workflow-executions-table table tbody') do
assert_selector 'tr', count: WORKFLOW_EXECUTION_COUNT
assert_selector "tr:first-child td:nth-child(#{@created_at_col})",
text: I18n.l(workflow_execution1.created_at.localtime, format: :full_date)
assert_selector "tr:nth-child(2) td:nth-child(#{@created_at_col})",
text: I18n.l(workflow_execution2.created_at.localtime, format: :full_date)
assert_selector "tr:last-child td:nth-child(#{@created_at_col})",
text: I18n.l(workflow_execution12.created_at.localtime, format: :full_date)
end
end

test 'should be able to cancel a workflow' do
Expand Down

0 comments on commit 6c65b10

Please sign in to comment.