Merge remote-tracking branch 'parent/main' into upstream-20240112
This commit is contained in:
commit
e65fb9fb51
333 changed files with 2661 additions and 1461 deletions
|
@ -34,7 +34,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
stub_request(:get, 'http://example.com/invalid-conversation').to_return(status: 404)
|
||||
end
|
||||
|
||||
describe 'processing posts received out of order', :sidekiq_fake do
|
||||
describe 'processing posts received out of order' do
|
||||
let(:follower) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
let(:object_json) do
|
||||
|
@ -1076,7 +1076,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
expect(status.mentions.map(&:account_id)).to contain_exactly(recipient.id, ancestor_account.id, mentioned_account.id, local_mentioned_account.id)
|
||||
end
|
||||
|
||||
it 'forwards to observers' do
|
||||
it 'forwards to observers', :sidekiq_inline do
|
||||
expect(a_request(:post, 'http://or.example.com/actor/inbox')).to have_been_made.once
|
||||
expect(a_request(:post, 'http://example.com/bob/inbox')).to have_been_made.once
|
||||
end
|
||||
|
@ -1119,7 +1119,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
expect(status.mentions.map(&:account_id)).to contain_exactly(recipient.id, ancestor_account.id, mentioned_account.id, local_mentioned_account.id, new_mentioned_account.id, new_local_mentioned_account.id)
|
||||
end
|
||||
|
||||
it 'forwards to observers' do
|
||||
it 'forwards to observers', :sidekiq_inline do
|
||||
expect(a_request(:post, 'http://or.example.com/actor/inbox')).to have_been_made.once
|
||||
expect(a_request(:post, 'http://example.com/bob/inbox')).to have_been_made.once
|
||||
expect(a_request(:post, 'http://example.com/alice/inbox')).to have_been_made.once
|
||||
|
@ -1172,7 +1172,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
expect(status.mentioned_accounts.map(&:uri)).to include 'https://foo.test'
|
||||
end
|
||||
|
||||
it 'forwards to observers' do
|
||||
it 'forwards to observers', :sidekiq_inline do
|
||||
expect(a_request(:post, 'https://foo.test/inbox')).to have_been_made.once
|
||||
end
|
||||
end
|
||||
|
@ -1189,7 +1189,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
expect(status.mentions.map(&:account_id)).to contain_exactly(recipient.id)
|
||||
end
|
||||
|
||||
it 'do not forward to observers' do
|
||||
it 'do not forward to observers', :sidekiq_inline do
|
||||
expect(a_request(:post, 'http://or.example.com/actor/inbox')).to_not have_been_made
|
||||
expect(a_request(:post, 'http://example.com/bob/inbox')).to_not have_been_made
|
||||
end
|
||||
|
|
|
@ -47,7 +47,7 @@ RSpec.describe ActivityPub::Activity::Delete do
|
|||
expect(Status.find_by(id: status.id)).to be_nil
|
||||
end
|
||||
|
||||
it 'sends delete activity to followers of rebloggers' do
|
||||
it 'sends delete activity to followers of rebloggers', :sidekiq_inline do
|
||||
expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once
|
||||
end
|
||||
|
||||
|
@ -91,7 +91,7 @@ RSpec.describe ActivityPub::Activity::Delete do
|
|||
subject.perform
|
||||
end
|
||||
|
||||
it 'forwards to parent status holder' do
|
||||
it 'forwards to parent status holder', :sidekiq_inline do
|
||||
expect(a_request(:post, 'https://example.com/inbox').with(body: hash_including({
|
||||
type: 'Delete',
|
||||
signature: 'foo',
|
||||
|
|
|
@ -381,7 +381,7 @@ RSpec.describe ActivityPub::Activity::Follow do
|
|||
stub_request(:post, 'https://example.com/inbox')
|
||||
end
|
||||
|
||||
it 'marks me as idle and the friend as accepted' do
|
||||
it 'marks me as idle and the friend as accepted', :sidekiq_inline do
|
||||
subject.perform
|
||||
expect(friend.reload.they_are_accepted?).to be true
|
||||
expect(friend.i_am_idle?).to be true
|
||||
|
@ -429,7 +429,7 @@ RSpec.describe ActivityPub::Activity::Follow do
|
|||
stub_request(:post, 'https://example.com/inbox')
|
||||
end
|
||||
|
||||
it 'marks the friend as accepted' do
|
||||
it 'marks the friend as accepted', :sidekiq_inline do
|
||||
subject.perform
|
||||
|
||||
friend = FriendDomain.find_by(domain: 'abc.com')
|
||||
|
@ -449,7 +449,7 @@ RSpec.describe ActivityPub::Activity::Follow do
|
|||
stub_request(:post, 'https://example.com/inbox')
|
||||
end
|
||||
|
||||
it 'marks the friend as accepted' do
|
||||
it 'marks the friend as accepted', :sidekiq_inline do
|
||||
subject.perform
|
||||
|
||||
friend = FriendDomain.find_by(domain: 'abc.com')
|
||||
|
|
|
@ -38,7 +38,7 @@ RSpec.describe ActivityPub::Activity::Move do
|
|||
subject.perform
|
||||
end
|
||||
|
||||
context 'when all conditions are met' do
|
||||
context 'when all conditions are met', :sidekiq_inline do
|
||||
it 'sets moved account on old account' do
|
||||
expect(old_account.reload.moved_to_account_id).to eq new_account.id
|
||||
end
|
||||
|
|
|
@ -143,7 +143,7 @@ RSpec.describe ActivityPub::Activity::Update do
|
|||
subject.perform
|
||||
end
|
||||
|
||||
it 'forwards to parent status holder' do
|
||||
it 'forwards to parent status holder', :sidekiq_inline do
|
||||
expect(a_request(:post, 'https://example.com/inbox').with(body: hash_including({
|
||||
type: 'Update',
|
||||
signature: 'foo',
|
||||
|
|
|
@ -125,5 +125,17 @@ describe ContentSecurityPolicy do
|
|||
expect(subject.media_hosts).to contain_exactly(subject.assets_host, 'https://asset-host.s3.example')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when PAPERCLIP_ROOT_URL is configured' do
|
||||
around do |example|
|
||||
ClimateControl.modify PAPERCLIP_ROOT_URL: 'https://paperclip-host.example' do
|
||||
example.run
|
||||
end
|
||||
end
|
||||
|
||||
it 'uses the provided URL in the content security policy' do
|
||||
expect(subject.media_hosts).to contain_exactly(subject.assets_host, 'https://paperclip-host.example')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -183,6 +183,21 @@ describe Mastodon::CLI::Media do
|
|||
.to output_results('Downloaded 1 media')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with --days option' do
|
||||
before do
|
||||
Fabricate(:media_attachment, remote_url: 'https://example.com/image.jpg', id: Mastodon::Snowflake.id_at(50.days.ago))
|
||||
Fabricate(:media_attachment, remote_url: 'https://example.com/image.jpg', id: Mastodon::Snowflake.id_at(5.days.ago))
|
||||
Fabricate(:media_attachment, remote_url: '', id: Mastodon::Snowflake.id_at(5.days.ago))
|
||||
end
|
||||
|
||||
let(:options) { { days: 10 } }
|
||||
|
||||
it 'redownloads the attachment file for the remote records more recent than the option' do
|
||||
expect { subject }
|
||||
.to output_results('Downloaded 1 media')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#remove_orphans' do
|
||||
|
|
|
@ -33,14 +33,12 @@ describe RequestPool do
|
|||
|
||||
subject
|
||||
|
||||
threads = Array.new(3) do
|
||||
threads = Array.new(5) do
|
||||
Thread.new do
|
||||
2.times do
|
||||
subject.with('http://example.com') do |http_client|
|
||||
http_client.get('/').flush
|
||||
# Nudge scheduler to yield and exercise the full pool
|
||||
sleep(0)
|
||||
end
|
||||
subject.with('http://example.com') do |http_client|
|
||||
http_client.get('/').flush
|
||||
# Nudge scheduler to yield and exercise the full pool
|
||||
sleep(0.01)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue