Add test for Import::WatcherJob

This commit is contained in:
Eugene Burmakin 2024-10-03 15:27:30 +02:00
parent 200bc980e5
commit b79bb9951c
7 changed files with 22 additions and 1246 deletions

1
.gitignore vendored
View file

@ -26,6 +26,7 @@
!/tmp/storage/.keep
/tmp/imports/*
!/tmp/imports/
/tmp/imports/watched/*
!/tmp/imports/watched/
!/tmp/imports/watched/.keep
!/tmp/imports/watched/put-your-files-here.txt

View file

@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Monkey patch for Geocoder to support http along with https for Photon API host was removed becausee it was breaking the reverse geocoding process. Now you can use only https for the Photon API host. This might be changed in the future
### Fixed
- Stats update is now being correctly triggered every 6 hours
# [0.14.7] - 2024-10-01
### Fixed

View file

@ -4,6 +4,8 @@ class StatCreatingJob < ApplicationJob
queue_as :stats
def perform(user_ids = nil)
user_ids = user_ids.nil? ? User.pluck(:id) : Array(user_ids)
CreateStats.new(user_ids).call
end
end

View file

@ -1,21 +1,21 @@
# config/schedule.yml
stat_creating_job:
cron: "0 */6 * * *" # every 6 hours
cron: "0 */6 * * *" # every 6 hour
class: "StatCreatingJob"
queue: default
queue: stats
area_visits_calculation_scheduling_job:
cron: "0 0 * * *" # every day at 0:00
class: "AreaVisitsCalculationSchedulingJob"
queue: default
queue: visit_suggesting
visit_suggesting_job:
cron: "0 1 * * *" # every day at 1:00
class: "VisitSuggestingJob"
queue: default
queue: visit_suggesting
watcher_job:
cron: "0 */1 * * *" # every 1 hour
class: "Import::WatcherJob"
queue: default
queue: imports

View file

@ -9,7 +9,7 @@ RSpec.describe Import::ImmichGeodataJob, type: :job do
it 'calls Immich::ImportGeodata' do
expect_any_instance_of(Immich::ImportGeodata).to receive(:call)
Import::ImmichGeodataJob.perform_now(user.id)
described_class.perform_now(user.id)
end
end
end

View file

@ -1,5 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Import::WatcherJob, type: :job do
pending "add some examples to (or delete) #{__FILE__}"
describe '#perform' do
it 'calls Imports::Watcher' do
expect_any_instance_of(Imports::Watcher).to receive(:call)
described_class.perform_now
end
end
end

File diff suppressed because it is too large Load diff