Skip to content

force:apex:test:run does not seem to take the wait parameter into account  #270

@mcartoixa

Description

@mcartoixa

Summary

We have an old organization with a lot of integration tests that take a while to execute (say between 40' and 60' on the main org). We have set up a Continuous Integration process based on the Saleforce CLI so that these tests are executed (on a Scratch Org) every time a commit is pushed to our repository. As our tests take a long time we use the wait parameter on the force:apex:test:run command to avoid a timeout (-w120 so that we have some leeway).

Lately (but I sadly cannot pinpoint from when exactly) our tests have been failing consistently:

  • the message for failure is "Your request exceeded the time limit for processing. connection was cancelled here" on ~80% of the failing tests.
  • the execution time of the force:apex:test:run command is exactly 60' every time.

We have tried to set a much larger value to the wait parameter but the tests get cancelled at the same point. We have tried to set the wait parameter to a very short value (1') and the command still seems to execute for a very long time.

Steps To Reproduce:

  1. Set up a Scratch Org with tests.
  2. Execute the tests on the Scratch Org: sfdx force:apex:test:run -w1 -lRunLocalTests

Expected result

  • sfdx force:apex:test:run -w1 -lRunLocalTests should cancel the run after ~1'.
  • sfdx force:apex:test:run -w120 -lRunLocalTests should execute all tests.

Actual result

The tests execute for what seems to be a default amount of time (60') whatever the value of wait.

Additional information

Apex library Version:

{
        "cliVersion": "sfdx-cli/7.131.0",
        "architecture": "linux-x64",
        "nodeVersion": "node-v16.13.1",
        "pluginVersions": [
                "@oclif/plugin-autocomplete 0.3.0 (core)",
                "@oclif/plugin-commands 1.3.0 (core)",
                "@oclif/plugin-help 3.2.10 (core)",
                "@oclif/plugin-not-found 1.2.4 (core)",
                "@oclif/plugin-plugins 1.10.10 (core)",
                "@oclif/plugin-update 1.5.0 (core)",
                "@oclif/plugin-warn-if-update-available 1.7.3 (core)",
                "@oclif/plugin-which 1.0.3 (core)",
                "@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
                "alias 1.2.0 (core)",
                "apex 0.5.0 (core)",
                "auth 1.8.0 (core)",
                "config 1.3.2 (core)",
                "custom-metadata 1.0.12 (core)",
                "data 0.6.6 (core)",
                "generator 1.2.1 (core)",
                "info 1.1.4 (core)",
                "limits 1.3.0 (core)",
                "org 1.11.0 (core)",
                "salesforce-alm 53.6.0 (core)",
                "schema 1.1.0 (core)",
                "sfdx-cli 7.131.0 (core)",
                "source 1.6.2 (core)",
                "telemetry 1.4.0 (core)",
                "templates 52.6.0 (core)",
                "trust 1.1.0 (core)",
                "user 1.7.0 (core)"
        ],
        "osVersion": "Linux 5.8.0-1043-azure"
}

OS and version:

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions