Update changelog and add a spec

This commit is contained in:
Eugene Burmakin 2025-05-31 21:58:50 +02:00
parent 551c6e7629
commit 48eb55f621
6 changed files with 38 additions and 20 deletions

View file

@ -14,6 +14,27 @@ Moving to SolidQueue and SolidCache will require creating new SQLite databases,
Background jobs interface is now available at `/jobs` page.
Please, update your `docker-compose.yml` and add the following:
```diff
dawarich_app:
image: freikin/dawarich:latest
container_name: dawarich_app
volumes:
- dawarich_public:/var/app/public
- dawarich_watched:/var/app/tmp/imports/watched
- dawarich_storage:/var/app/storage
+ - dawarich_db_data:/dawarich_db_data
...
environment:
...
DATABASE_NAME: dawarich_development
# SQLite database paths for secondary databases
+ QUEUE_DATABASE_PATH: /dawarich_db_data/dawarich_development_queue.sqlite3
+ CACHE_DATABASE_PATH: /dawarich_db_data/dawarich_development_cache.sqlite3
+ CABLE_DATABASE_PATH: /dawarich_db_data/dawarich_development_cable.sqlite3
```
## Fixed

View file

@ -23,7 +23,6 @@ gem 'lograge'
gem 'mission_control-jobs'
gem 'oj'
gem 'pg'
gem 'sqlite3', '~> 2.6'
gem 'prometheus_exporter'
gem 'activerecord-postgis-adapter'
gem 'puma'
@ -37,6 +36,7 @@ gem 'rswag-api'
gem 'rswag-ui'
gem 'sentry-ruby'
gem 'sentry-rails'
gem 'sqlite3', '~> 2.6'
gem 'stackprof'
gem 'sidekiq'
gem 'sidekiq-cron'

View file

@ -3,7 +3,7 @@
# not a terminal started via bin/rails console! Add "console" to any action or any ERB template view
# to make the web console appear.
development:
default: &default
adapter: solid_cable
connects_to:
database:
@ -11,13 +11,11 @@ development:
polling_interval: 0.1.seconds
message_retention: 1.day
development:
<<: *default
test:
adapter: test
production:
adapter: solid_cable
connects_to:
database:
writing: cable
polling_interval: 0.1.seconds
message_retention: 1.day
<<: *default

View file

@ -1,11 +0,0 @@
# frozen_string_literal: true
# Configure SolidCache
Rails.application.config.to_prepare do
# Only require the entries file as it seems the Entry class is defined there
begin
require 'solid_cache/store/entries'
rescue LoadError => e
Rails.logger.warn "Could not load SolidCache: #{e.message}"
end
end

View file

@ -5,5 +5,11 @@ FactoryBot.define do
user
name { 'owntracks_export.json' }
source { Import.sources[:owntracks] }
trait :with_points do
after(:create) do |import|
create_list(:point, 10, import:)
end
end
end
end

View file

@ -5,13 +5,17 @@ require 'rails_helper'
RSpec.describe Imports::Destroy do
describe '#call' do
let!(:user) { create(:user) }
let!(:import) { create(:import, user: user) }
let!(:import) { create(:import, :with_points, user: user) }
let(:service) { described_class.new(user, import) }
it 'destroys the import' do
expect { service.call }.to change { Import.count }.by(-1)
end
it 'destroys the points' do
expect { service.call }.to change { Point.count }.by(-import.points.count)
end
it 'enqueues a BulkStatsCalculatingJob' do
expect(Stats::BulkCalculator).to receive(:new).with(user.id).and_return(double(call: nil))