Admin Operation Already in Progress

When running all test from the Org Credential records in Copado, the Apex Test Results’ related list in the Org Credential’s record might contain the error below:

"Unknown Exception - Admin operation already in progress."

Steps to reproduce:

1. Navigate to an Org Credential record.
2. Click on the button Run All Test.
3. Wait for the Apex Test Results record to be generated.
4. Open the Apex Test Results and check the Details field.
5. This message is displayed: Unknown Exception - Admin operation already in progress.

If you log into the affected org and run the test directly, the error is not returned. This is expected and it's documented by Salesforce in the document below:

When trying to runAllTests via DevConsole or UI (in salesforce), the Org lock is not required. However when running the test via Tooling API / Metadata Soap API, it's considered as a Deployment and the Org Lock is Required. That is the reason why you do not see the same behaviour when running the test with Copado and when running the test directly from the org.

Copado is using the #2: Tests run with code coverage enabled will take a compile lock.

If you have any question regarding this behaviour or the information provided on the Salesforce article, we recommend you to contact Salesforce directly.

How did we do?