Compare commits

...
Author SHA1 Message Date
Shivam Mishra e204c2aa4f chore: re-enable test 2025-05-27 18:32:44 +05:30
Shivam Mishra 1acc994d98 Revert "feat: re-enable all ci config"
This reverts commit 58e5f7e4df.
2025-05-27 18:23:22 +05:30
Shivam Mishra 5185bbd34f test: clear mutex before each step 2025-05-27 18:21:31 +05:30
2 changed files with 54 additions and 50 deletions
+40 -40
View File
@@ -99,17 +99,17 @@ jobs:
chmod +x ~/tmp/cc-test-reporter chmod +x ~/tmp/cc-test-reporter
# Swagger verification # Swagger verification
- run: # - run:
name: Verify swagger API specification # name: Verify swagger API specification
command: | # command: |
bundle exec rake swagger:build # bundle exec rake swagger:build
if [[ `git status swagger/swagger.json --porcelain` ]] # if [[ `git status swagger/swagger.json --porcelain` ]]
then # then
echo "ERROR: The swagger.json file is not in sync with the yaml specification. Run 'rake swagger:build' and commit 'swagger/swagger.json'." # echo "ERROR: The swagger.json file is not in sync with the yaml specification. Run 'rake swagger:build' and commit 'swagger/swagger.json'."
exit 1 # exit 1
fi # fi
curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar > ~/tmp/openapi-generator-cli-6.3.0.jar # curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar > ~/tmp/openapi-generator-cli-6.3.0.jar
java -jar ~/tmp/openapi-generator-cli-6.3.0.jar validate -i swagger/swagger.json # java -jar ~/tmp/openapi-generator-cli-6.3.0.jar validate -i swagger/swagger.json
# we remove the FRONTED_URL from the .env before running the tests # we remove the FRONTED_URL from the .env before running the tests
- run: - run:
@@ -139,26 +139,26 @@ jobs:
command: bundle exec bundle audit update && bundle exec bundle audit check -v command: bundle exec bundle audit update && bundle exec bundle audit check -v
# Rubocop linting # Rubocop linting
- run: # - run:
name: Rubocop # name: Rubocop
command: bundle exec rubocop # command: bundle exec rubocop
# ESLint linting # # ESLint linting
- run: # - run:
name: eslint # name: eslint
command: pnpm run eslint # command: pnpm run eslint
- run: # - run:
name: Run frontend tests # name: Run frontend tests
command: | # command: |
mkdir -p ~/build/coverage/frontend # mkdir -p ~/build/coverage/frontend
~/tmp/cc-test-reporter before-build # ~/tmp/cc-test-reporter before-build
pnpm run test:coverage # pnpm run test:coverage
- run: # - run:
name: Code Climate Test Coverage (Frontend) # name: Code Climate Test Coverage (Frontend)
command: | # command: |
~/tmp/cc-test-reporter format-coverage -t lcov -o "~/build/coverage/frontend/codeclimate.frontend_$CIRCLE_NODE_INDEX.json" # ~/tmp/cc-test-reporter format-coverage -t lcov -o "~/build/coverage/frontend/codeclimate.frontend_$CIRCLE_NODE_INDEX.json"
# Run backend tests # Run backend tests
- run: - run:
@@ -175,17 +175,17 @@ jobs:
-- ${TESTFILES} -- ${TESTFILES}
no_output_timeout: 30m no_output_timeout: 30m
- run: # - run:
name: Code Climate Test Coverage (Backend) # name: Code Climate Test Coverage (Backend)
command: | # command: |
~/tmp/cc-test-reporter format-coverage -t simplecov -o "~/build/coverage/backend/codeclimate.$CIRCLE_NODE_INDEX.json" # ~/tmp/cc-test-reporter format-coverage -t simplecov -o "~/build/coverage/backend/codeclimate.$CIRCLE_NODE_INDEX.json"
- run: # - run:
name: List coverage directory contents # name: List coverage directory contents
command: | # command: |
ls -R ~/build/coverage # ls -R ~/build/coverage
- persist_to_workspace: # - persist_to_workspace:
root: ~/build # root: ~/build
paths: # paths:
- coverage # - coverage
+14 -10
View File
@@ -1,12 +1,16 @@
require 'rails_helper' require 'rails_helper'
describe Webhooks::InstagramEventsJob, :serial do describe Webhooks::InstagramEventsJob do
subject(:instagram_webhook) { described_class } subject(:instagram_webhook) { described_class }
before do before do
stub_request(:post, /graph\.facebook\.com/) stub_request(:post, /graph\.facebook\.com/)
stub_request(:get, 'https://www.example.com/test.jpeg') stub_request(:get, 'https://www.example.com/test.jpeg')
.to_return(status: 200, body: '', headers: {}) .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 end
let!(:account) { create(:account) } let!(:account) { create(:account) }
@@ -206,16 +210,16 @@ describe Webhooks::InstagramEventsJob, :serial do
end end
# skip failing test # skip failing test
# it 'creates incoming message with correct contact info in the instagram direct inbox' do it 'creates incoming message with correct contact info in the instagram direct inbox' do
# instagram_webhook.perform_now(message_events[:dm][:entry]) instagram_webhook.perform_now(message_events[:dm][:entry])
# instagram_inbox.reload instagram_inbox.reload
# expect(instagram_inbox.contacts.count).to eq 1 expect(instagram_inbox.contacts.count).to eq 1
# expect(instagram_inbox.contacts.last.additional_attributes['social_instagram_user_name']).to eq 'some_user_name' expect(instagram_inbox.contacts.last.additional_attributes['social_instagram_user_name']).to eq 'some_user_name'
# expect(instagram_inbox.conversations.count).to eq 1 expect(instagram_inbox.conversations.count).to eq 1
# expect(instagram_inbox.messages.count).to eq 1 expect(instagram_inbox.messages.count).to eq 1
# expect(instagram_inbox.messages.last.content_attributes['is_unsupported']).to be_nil expect(instagram_inbox.messages.last.content_attributes['is_unsupported']).to be_nil
# end end
it 'sets correct instagram attributes on contact' do it 'sets correct instagram attributes on contact' do
instagram_webhook.perform_now(message_events[:dm][:entry]) instagram_webhook.perform_now(message_events[:dm][:entry])