Skip to content

Bugfix: Fixed UNABLE_TO_LOCK_ROW failures in LoggerEmailSender_Tests - #1045

Draft
jasonsiders wants to merge 3 commits into
jongpie:mainfrom
jasonsiders:bugfix/logger-email-sender-tests-row-lock
Draft

jasonsiders wants to merge 3 commits into
jongpie:mainfrom
jasonsiders:bugfix/logger-email-sender-tests-row-lock

Conversation

@jasonsiders

Copy link
Copy Markdown

Fixes #1044: LoggerEmailSender_Tests fails with UNABLE_TO_LOCK_ROW in orgs that run all Apex tests in parallel.

  • The static block no longer updates the running user's Email, which locked that user's row in all 8 test methods
  • The 2 tests that send email insert a dedicated user with the gmail.com address and call sendErrorEmail inside System.runAs
  • The other 6 tests need no verified sender, because they never reach Messaging.sendEmail
  • @IsTest(IsParallel=false) stays, but it doesn't serialize tests across classes, so it never prevented the lock
  • Package version isn't bumped because only tests changed; CI's version check may flag it, and I can add one

LoggerEmailSender_Tests updated the running user's Email in a static
block. When other test classes run in parallel as the same user, that
update can fail with UNABLE_TO_LOCK_ROW. The tests now insert a
dedicated user with the fake gmail.com address and run as that user.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LoggerEmailSender_Tests fails with UNABLE_TO_LOCK_ROW when tests run in parallel

1 participant