From 5185bbd34faec27b06acb74377d4127aa3d6f0c3 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Tue, 27 May 2025 18:21:31 +0530 Subject: [PATCH] test: clear mutex before each step --- spec/jobs/webhooks/instagram_events_job_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/jobs/webhooks/instagram_events_job_spec.rb b/spec/jobs/webhooks/instagram_events_job_spec.rb index 100a157d0..befa3ce5c 100644 --- a/spec/jobs/webhooks/instagram_events_job_spec.rb +++ b/spec/jobs/webhooks/instagram_events_job_spec.rb @@ -1,12 +1,16 @@ require 'rails_helper' -describe Webhooks::InstagramEventsJob, :serial do +describe Webhooks::InstagramEventsJob do subject(:instagram_webhook) { described_class } before do stub_request(:post, /graph\.facebook\.com/) stub_request(:get, 'https://www.example.com/test.jpeg') .to_return(status: 200, body: '', headers: {}) + + # Clear Redis mutex key to prevent lock conflicts in parallel tests + mutex_key = format(Redis::Alfred::IG_MESSAGE_MUTEX, sender_id: 'Sender-id-1', ig_account_id: 'chatwoot-app-user-id-1') + Redis::Alfred.delete(mutex_key) end let!(:account) { create(:account) }