From 87fb68e4dfa01b6abb69bb2ef844a526e0acfd8a Mon Sep 17 00:00:00 2001 From: bedrock-adam Date: Sun, 1 Dec 2024 17:33:11 +1100 Subject: [PATCH 1/3] fix queue name --- app/jobs/event_created_job.rb | 2 +- script/accountify/invoice/test_lifecycle.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/jobs/event_created_job.rb b/app/jobs/event_created_job.rb index bf7f778..1155992 100644 --- a/app/jobs/event_created_job.rb +++ b/app/jobs/event_created_job.rb @@ -1,7 +1,7 @@ class EventCreatedJob include Sidekiq::Job - sidekiq_options queue: 'reporting', retry: false, backtrace: true + sidekiq_options queue: 'events', retry: false, backtrace: true def perform(args) case args['type'] diff --git a/script/accountify/invoice/test_lifecycle.rb b/script/accountify/invoice/test_lifecycle.rb index 778bf60..dc1ae04 100644 --- a/script/accountify/invoice/test_lifecycle.rb +++ b/script/accountify/invoice/test_lifecycle.rb @@ -1,6 +1,5 @@ require_relative '../../../config/environment' -# require 'time' require 'open3' user_id = 123 From 0269a77c107a6619f6b2982b7edcef88f789fad5 Mon Sep 17 00:00:00 2001 From: bedrock-adam Date: Sun, 1 Dec 2024 20:10:20 +1100 Subject: [PATCH 2/3] fix test --- script/accountify/invoice/test_lifecycle.rb | 2 -- .../accountify/invoice/test_lifecycle_spec.rb | 16 ++++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/script/accountify/invoice/test_lifecycle.rb b/script/accountify/invoice/test_lifecycle.rb index dc1ae04..0baaf43 100644 --- a/script/accountify/invoice/test_lifecycle.rb +++ b/script/accountify/invoice/test_lifecycle.rb @@ -13,8 +13,6 @@ tenant_id: tenant_id, name: 'Debbies Debts Ltd') -sleep 1 - contact = Accountify::Contact.create( user_id: user_id, tenant_id: tenant_id, diff --git a/spec/integration/accountify/invoice/test_lifecycle_spec.rb b/spec/integration/accountify/invoice/test_lifecycle_spec.rb index b788873..c061db2 100644 --- a/spec/integration/accountify/invoice/test_lifecycle_spec.rb +++ b/spec/integration/accountify/invoice/test_lifecycle_spec.rb @@ -1,13 +1,17 @@ require 'rails_helper' RSpec.describe 'Invoice Lifecycle', type: :integration do - it 'runs the test lifecycle script' do - # TODO: work out why this fails + it 'transitions as expected' do + Sidekiq::Testing.disable! - # load Rails.root.join('script/accountify/invoice/test_lifecycle.rb') + begin + load Rails.root.join('script/accountify/invoice/test_lifecycle.rb') - # expect(Accountify::Models::Organisation.count).to eq(1) - # expect(Accountify::Models::Contact.count).to eq(1) - # expect(Accountify::Models::Invoice.count).to eq(1) + expect(Accountify::Models::Organisation.count).to eq(1) + expect(Accountify::Models::Contact.count).to eq(1) + expect(Accountify::Models::Invoice.count).to eq(1) + ensure + Sidekiq::Testing.fake! + end end end From 8a6a7c21ffbf1700232e8d7caa9457fc7982450e Mon Sep 17 00:00:00 2001 From: bedrock-adam Date: Sun, 1 Dec 2024 20:17:49 +1100 Subject: [PATCH 3/3] add redis image --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb8e199..e5f776c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,11 @@ jobs: --health-timeout 5s --health-retries 5 + redis: + image: redis:latest + ports: + - 6379:6379 + env: RAILS_ENV: test DATABASE_HOST: localhost