Commit Graph

97 Commits

Author SHA1 Message Date
Donovan Daniels
32a1367cfe
[Users] Consolidate password confirmation into singular route (#813) 2024-12-18 06:02:02 -08:00
Earlopain
2d7e507555
[Posts] Show an icon for non-matches urls 2024-02-27 15:48:52 +01:00
Earlopain
fc7d84affd
[RuboCop] Enable Style/FrozenStringLiteralComment
This reduces allocations on the posts page by about 5%, from basic testing
2024-02-25 18:15:55 +01:00
Earlopain
3a58ac0938
Switch to OpenSearch (#550)
Run the following commands to import data into OpenSearch:

Post.document_store.create_index!
PostVersion.document_store.create_index!
Post.document_store.import
PostVersion.document_store.import

* Add opensearch client

* Add url param to force use opensearch

* Switch import method over to opensearch

* Index to opensearch as well

* Add option to gradually roll out os

* Index os with separate queue

* Move os post creation to job as well

* Exclusively use the OpenSearch client

* Stop enqueuing OsIndexUpdateJob

* Remove remaining elasticsearch code

Bump faraday since v2 is no longer blocked
2023-10-02 18:57:07 +02:00
Earlopain
b6dc473a55
[Elasticsearch] Bring back the proxy object 2023-09-16 17:09:33 +02:00
Earlopain
855388b092
[Elasticsearch] Remove a few more easy usages of __elasticsearch__ 2023-09-14 20:56:56 +02:00
Earlopain
a79e25dfbd
[Elasticsearch] Start implementing own elasticsearch-model
This implements create_index!
2023-09-14 20:49:19 +02:00
Earlopain
c53b2eff60
[Tests] More performance improvements
Most of the gained time is because some post tests don't recreate the
elastic index twice now.
Tests go from 107 seconds to 95 on my machine.
2023-09-08 19:51:35 +02:00
Earlopain
de4068ade8
[Tests] Clear elasticsearch before tests run
Previously they were only created if they didn't exist.
Data from previous test runs was still present.
2023-09-08 19:17:47 +02:00
Earlopain
d5b64b1712
[Tests] Improve execution time of some of the worst offenders
From 112 seconds to 107 on my machine
Not much all things considered but most of the time is still spend on
elasticsearch, especially when forcefully recreating the index
2023-09-07 17:04:34 +02:00
Earlopain
d8c0a83fb4
[Tests] Suppress sidekiq redis log message 2023-06-08 20:39:14 +02:00
Earlopain
f5f29f8673
[Tests] Remove workaround for bcrypt slowdown
81a1b4b544 says this was done to make tests significantly faster, I'm
not seeing any slowdown with this change though. The real culprit was
probably the MX lookups.
2023-06-06 19:52:02 +02:00
Earlopain
02a4051031
[Tests] Be explitic about where jobs need to be inlined 2023-02-24 14:14:44 +01:00
Earlopain
7a028cf003
[Tests] Set CurrentUser.ip_addr in base setup 2022-11-26 16:20:16 +01:00
Earlopain
c68fdfce2b
[Tests] Always use CurrentUser as helper 2022-11-26 15:20:15 +01:00
Earlopain
98e55562eb
[Tests] Clean up teardowns 2022-11-26 14:02:06 +01:00
Earlopain
b6fb6d3ee6
[Tests] Remove as_user helper 2022-11-26 12:49:35 +01:00
Earlopain
e0819dfd5f
[Tests] Remove as_admin helper 2022-11-26 12:37:22 +01:00
Earlopain
87313c437c [Tests] Include FactoryBot::Syntax::Methods
The newly included create method behaves exacly like the self-written one,
with the added benefit of it not appearing in backtraces.
2022-11-25 21:06:54 +01:00
Earlopain
5e8989d3df [Tests] Fix duplicate setup/teardown for IntegrationTest
Everything inherits from ActiveSupport::TestCase. Because of that
you can also simply add the global helpers to the class directly.
2022-11-25 20:15:48 +01:00
Earlopain
a34c2217b6 [Tests] Use factory_bot_rails and clean up test_helper requires 2022-11-25 19:56:14 +01:00
Earlopain
00c1dc27e1
[Tests] Use file_fixture/fixture_file_upload 2022-11-25 18:44:36 +01:00
Earlopain
04b18d0852
[Tests] Disallow and stub all requests being made
Make CloudflareService a module for easier stubbing
2022-11-25 17:27:38 +01:00
Earlopain
10cc7e7dba
[Cleanup] Remove iqdb test helper 2022-05-26 19:35:46 +02:00
Earlopain
eff1500059
[Cleanup] Remove some unusted dev/test gems 2022-05-26 19:23:25 +02:00
Earlopain
ac5e8673ca
[Cleanup] Remove most source strategy code 2022-02-19 15:55:26 +01:00
Earlopain
553a861bef
[Tests] Remove unused post archive helper 2022-02-10 17:55:32 +01:00
Earlopain
b1a8c4960c
[Tests] Fix pool tests 2022-02-10 17:53:51 +01:00
Earlopain
a135c2a592
[Cleanup] Remove reportbooru 2022-02-09 15:39:07 +01:00
Earlopain
061176e095
[Setup] Ignore limits when seeding
This makes the environment config understand booleans. If something
ends with "?" it tries to interpret it as a boolean. A bunch of
existing configs where changed to reflect this change.
2021-11-14 22:16:36 +01:00
Kira
9da8e1b1ad [Tests] Fix test breakage because of lack of seeds 2021-02-28 13:28:22 -08:00
Kira
76d1999ade [Rails] Upgrade to rails 6.1 + fix tests 2021-02-25 12:08:09 -08:00
Kira
c246cd68a2 More test fixes 2021-02-25 12:08:08 -08:00
Kira
32e81770ef Update tests 2021-02-25 12:00:09 -08:00
Kira
436d2aea38 [Ruby 3] Fix up some deprecations involving ruby 3
Still pending are gems that make poor choices and need to be removed,
replaced, or fixed up.

Memoist
ActiveModelSerializers
2020-11-11 21:06:12 -08:00
Kira
160b0cb22e Remove saved searches 2019-10-21 02:57:03 -07:00
Kira
8659b908ed Disable user limits when testing 2019-09-09 12:58:18 -07:00
Kira
fffe6b1c19 Fix test fixtures and seeds 2019-09-09 12:58:18 -07:00
Kira
a665b526a1 Don't nuke the main data folder when cleaning up tests, mmkay? 2019-09-09 12:58:18 -07:00
Kira
532e2c1e04 Update to rails 6 2019-08-28 21:50:40 -07:00
evazion
3949c184f7 tests: fix authentication in controller tests.
Fix controller tests to login for real instead of faking it.
2019-08-28 20:52:21 -07:00
Kira
22a077a2dd Convert delayed_jobs to activejob
Add sidekiq and create jobs for the majority of delayed actions.

Temporary hookup of sidekiq UI in routes for testing purposes.
2019-02-17 19:28:40 -08:00
Albert Yi
6839249e9d add logic for persisting pixiv sessions in tests 2018-05-10 13:59:57 -07:00
Albert Yi
79ea6f7e6c Add Docker and Travis config files to enable CI tests
Also fixes some Rails 6.0 deprecation warnings
2018-05-09 09:56:38 -07:00
r888888888
abce4d2551 Raise error on unpermitted params.
Fail loudly if we forget to whitelist a param instead of silently
ignoring it.

misc models: convert to strong params.

artist commentaries: convert to strong params.

* Disallow changing or setting post_id to a nonexistent post.

artists: convert to strong params.

* Disallow setting `is_banned` in create/update actions. Changing it
  this way instead of with the ban/unban actions would leave the artist in
  a partially banned state.

bans: convert to strong params.

* Disallow changing the user_id after the ban has been created.

comments: convert to strong params.

favorite groups: convert to strong params.

news updates: convert to strong params.

post appeals: convert to strong params.

post flags: convert to strong params.

* Disallow users from setting the `is_deleted` / `is_resolved` flags.

ip bans: convert to strong params.

user feedbacks: convert to strong params.

* Disallow users from setting `disable_dmail_notification` when creating feedbacks.
* Disallow changing the user_id after the feedback has been created.

notes: convert to strong params.

wiki pages: convert to strong params.

* Also fix non-Builders being able to delete wiki pages.

saved searches: convert to strong params.

pools: convert to strong params.

* Disallow setting `post_count` or `is_deleted` in create/update actions.

janitor trials: convert to strong params.

post disapprovals: convert to strong params.

* Factor out quick-mod bar to shared partial.
* Fix quick-mod bar to use `Post#is_approvable?` to determine visibility
  of Approve button.

dmail filters: convert to strong params.

password resets: convert to strong params.

user name change requests: convert to strong params.

posts: convert to strong params.

users: convert to strong params.

* Disallow setting password_hash, last_logged_in_at, last_forum_read_at,
  has_mail, and dmail_filter_attributes[user_id].

* Remove initialize_default_image_size (dead code).

uploads: convert to strong params.

* Remove `initialize_status` because status already defaults to pending
  in the database.

tag aliases/implications: convert to strong params.

tags: convert to strong params.

forum posts: convert to strong params.

* Disallow changing the topic_id after creating the post.
* Disallow setting is_deleted (destroy/undelete actions should be used instead).
* Remove is_sticky / is_locked (nonexistent attributes).

forum topics: convert to strong params.

* merges https://github.com/evazion/danbooru/tree/wip-rails-5.1
* lock pg gem to 0.21 (1.0.0 is incompatible with rails 5.1.4)
* switch to factorybot and change all references

Co-authored-by: r888888888 <r888888888@gmail.com>
Co-authored-by: evazion <noizave@gmail.com>

add diffs
2018-04-06 18:09:57 -07:00
evazion
d089be9f8a tests: fix upload tests. 2018-03-20 19:49:58 -05:00
evazion
f0bf1bc66e posts: use storage manager to backup files.
* Perform backups synchronously inside `distribute_files` instead of
  asynchronously in `queue_backup`. Asynchronous backups assumed that
  files are stored on the local filesystem, which isn't true in general.

* Remove obsolete backup service classes.
2018-03-20 19:49:06 -05:00
evazion
b0c7d9c185 Add storage managers (local, sftp, s3, hybrid). 2018-03-20 19:49:06 -05:00
evazion
46b0f9e6d6 Update dotenv.
dotenv-2.2.1 no longer loads .env.local in the test environment. Load it
manually for backwards compatibility.
2018-01-20 19:04:48 -06:00
evazion
4f543671a2 tests: move test/helpers to test/test_helpers.
The Rails convention is for test/helpers to be used for testing the view
helpers in app/helpers. We were using it to store certain utility
methods instead. Move these to test/test_helpers so that test/helpers
can be used for its intended purpose.
2018-01-14 16:11:15 -06:00