-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sfdx force:apex:test:run hangs and provides no response #212
Comments
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support. |
Hi @stuartgrieve thanks for reporting this! Do you mind sharing how long these tests usually run for in Jenkins? And do you get any error messages? |
Hi @AnanyaJha we're seeing the spinner (shown in the screenshot) for as long as our pipeline is set to time out. So right now if it takes 20 minutes to run prior stages, the command to run tests will hang with no response for 2hr40. We see no error message from the CLI whatsoever. Just the output from Jenkins to say the timeout has been met and it is interrupting the current process. I've tested this command pointing at a developer sandbox and also see the same behaviour - with no signs of tests being triggered in the UI. |
Thanks @stuartgrieve can you try running the command with the username set explicitly? And with only one or two tests if possible? I'd like to see if it has to do with the size of the test run or if all test runs are failing in your Jenkins builds. |
Hi @AnanyaJha, See below for command with the username set explicitly:
And the logs when specifying one test only:
|
@stuartgrieve If you go to the org's setup page -> Apex Test Execution, do you see the test execution results? Want to confirm if this is an issue with the CLI client receiving the test result status. |
Hey @xyc, seeing no executions triggered in 'Apex Test Execution'. |
Thanks so it looks like the tests are not submitted to Salesforce.
|
Hi @xyc, just to confirm - the output you're referring to was from executing a singular test on a sandbox (as requested by AnanyaJha). Dumping logs from a job which does use a scratch org:
|
Hi @stuartgrieve could you share what plugin version you're currently using? We released a fix for part of the "hanging" issue with the latest release of the Apex plugin. You can find the version number by running |
Hi @AnanyaJha, I've been looking at this issue along with Stuart. It looks like we are currently using version 0.2.3 of the apex plugin, After running
|
@AnanyaJha Any update on this one? I'm getting a similar issue using Bamboo as a CI tool. In my case I'm running all tests against a Sandbox with a deployment. Build jobs are stuck as no response is received. Commands are working if executed locally just as @stuartgrieve described.
|
Hi @AnanyaJha Any update on this issue? We are facing the same issue with the latest CLI version and running in Jenkins CI. CLI Version :
sfdx-cli/7.121.8
Architecture:
linux-x64
Node Version :
node-v14.18.0
Plugin Version:
@oclif/plugin-autocomplete 0.3.0 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.2.3 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.10.1 (core)
@oclif/plugin-update 1.5.0 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
alias 1.1.21 (core)
apex 0.3.0 (core)
auth 1.7.2 (core)
config 1.2.40 (core)
custom-metadata 1.0.12 (core)
data 0.6.2 (core)
generator 1.2.0 (core)
limits 1.2.2 (core)
org 1.8.1 (core)
salesforce-alm 52.5.0 (core)
schema 1.0.8 (core)
sfdx-cli 7.121.8 (core)
source 1.2.2 (core)
telemetry 1.2.6 (core)
templates 52.3.0 (core)
trust 1.0.8 (core)
user 1.5.0 (core)
OS and Version:
Linux 5.4.0-88-generic When running tests, we don't get any output/no timeout sfdx force:apex:test:run --testlevel RunLocalTests --codecoverage --resultformat tap --wait 2 --targetusername myorg It seems that the --wait parameter is not working. The command is running till all the tests are complete running in the org. Combined with #211 above command is not working in our CI system. Is there any ETA on resolving this issue? |
Hi @AnanyaJha When we use |
Hi @AnanyaJha linked issue #211 is already closed. We are facing this issue. Any updates on this ? |
I tried this Large number of apex tests causing CICD failures and worked. But I would like to know if there is any command to clear test data to automate this in cicd. |
This issue is occurring for us as well. Here's my observations On running the below cli Observations
My inference is, since the cli is looking for codecoverage to get calculated, and apex test execution is not actually able to complete that task in the 20 mins Next Observation:
So Workaround is to Clear the test data, now like @viriatis mentioned, need to figure how to clear test data in our ci pipeline (via apex or cli scripts) |
Summary
We have nightly regression job run using Jenkins, which includes pushing our source to a scratch org and reporting on unit tests.
When we run
sfdx force:apex:test:run --testlevel RunLocalTests --targetusername RegressionScratchOrg --json
the command hangs and we receive no response. If the build is not aborted, it hits the timeout (currently 3 hours). All other sfdx commands work as expected, andsfdx force:apex:test:run -h
outputs usage documentation. We've tried with and without the --json flag, but neither scenario is producing a response.I'm unable to replicate this when running the command locally, and this user can execute apex tests through the UI.
Steps To Reproduce:
Repository to reproduce: N/A (private repository)
sfdx force:apex:test:run --testlevel RunLocalTests --targetusername RegressionScratchOrg
Expected result
Jenkins logs output details run ID, e.g.
Run "sfdx force:apex:test:report -i 7032z000007S0o9" to retrieve test results.
Actual result
Jenkins hangs waiting for a response.
Additional information
SFDX CLI Version(to find the version of the CLI engine run sfdx --version):
sfdx-cli/7.107.0 linux-x64 node-v14.17.1
SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core):
@oclif/plugin-autocomplete 0.3.0 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.2.2 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.10.0 (core)
@oclif/plugin-update 1.4.0-3 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
@salesforce/sfdx-scanner 2.9.2
@salesforce/sfdx-trust 3.6.0 (core)
alias 1.1.10 (core)
apex 0.2.2 (core)
auth 1.6.1 (core)
config 1.2.8 (core)
custom-metadata 1.0.12 (core)
data 0.4.12 (core)
generator 1.1.7 (core)
limits 1.2.1 (core)
org 1.6.7 (core)
salesforce-alm 52.0.2 (core)
schema 1.0.7 (core)
sfdx-cli 7.107.0 (core)
sfdx-git-delta 4.6.1
telemetry 1.2.2 (core)
templates 52.0.0 (core)
user 1.3.0 (core)
OS and version: Linux
The text was updated successfully, but these errors were encountered: