Skip to content
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

INVALID_OPERATION: testLevel of NoTestRun cannot be used in production organizations #2105

Closed
Sebastian-Axenon opened this issue May 3, 2023 · 9 comments
Labels
feature Issue or pull request for a new feature

Comments

@Sebastian-Axenon
Copy link

Summary

When deploying Custom Fields to a production org with sf project deploy start command, following error is returned:
Error (1): INVALID_OPERATION: testLevel of NoTestRun cannot be used in production organizations

Steps To Reproduce:

Run sf project deploy start targeting a production org and only deploying a custom field

@Sebastian-Axenon Sebastian-Axenon added the investigating We're actively investigating this issue label May 3, 2023
@github-actions
Copy link

github-actions bot commented May 3, 2023

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.

@pgonzaleznetwork
Copy link

@Sebastian-Axenon I'm not from sf but I'm curious what were you expecting, the default behaviour where all local tests are run?

@Sebastian-Axenon
Copy link
Author

Hi @pgonzaleznetwork, as the documentation state, the default value is NoTestRun.
Previous I've have not encountered enforcement to include Apex Tests when deploying fields only.

@mshanemc
Copy link
Contributor

mshanemc commented May 4, 2023

the old commands (force:source:deploy) would omit the testLevel from the deploy request unless specified. The metadata API interprets that as "let the org decide what it should do" which means it may or may not run tests depending on what the org requires (ex: apex tests have to run on a prod org but only if there's components in the deploy that require it, but a sandbox would not run the tests given the same deployment).

Would you want an option that means "do not specify" to delegate to the org's default behavior?

@mshanemc mshanemc added feature Issue or pull request for a new feature and removed investigating We're actively investigating this issue labels May 9, 2023
@github-actions
Copy link

github-actions bot commented May 9, 2023

Thank you for filing this feature request. We appreciate your feedback and will review the feature at our next grooming or sprint planning session. We prioritize feature requests with more upvotes and comments.

@git2gus
Copy link

git2gus bot commented May 9, 2023

This issue has been linked to a new work item: W-13176087

@marshallvaughn
Copy link

the old commands (force:source:deploy) would omit the testLevel from the deploy request unless specified. The metadata API interprets that as "let the org decide what it should do" which means it may or may not run tests depending on what the org requires (ex: apex tests have to run on a prod org but only if there's components in the deploy that require it, but a sandbox would not run the tests given the same deployment).

Would you want an option that means "do not specify" to delegate to the org's default behavior?

This issue impacts my team as well. I'm currently able to specify NoTestRun using the legacy sfdx CLI, but not sf. I frequently used that for things like PermissionSet updates, CustomField deployments, Layout hotfixes, etc. For things like that, there is no Apex Class built that will validate it, and it's not worth it to build one.

We can build a workaround by having it run an empty test class, but that seems a bit wonky as a permanent solution.

@ps-carl-bussema
Copy link

Agreed, this is a problematic gap. You can actually specify a non-existent test class: --testlevel RunSpecifiedTests --tests FakeClassName will work, but it's very annoying to have to do that when previously "let the org decide" was the default and there is no equivalent. I sometimes script low-risk or emergency deployments across multiple orgs, some sandbox and some production, and just letting the org decide would be ideal here.

@shetzel
Copy link
Contributor

shetzel commented Nov 7, 2023

This issue was fixed with this PR to the deploy-retrieve plugin: salesforcecli/plugin-deploy-retrieve#611

Please reopen if you have steps that reproduce the problem.

@shetzel shetzel closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issue or pull request for a new feature
Projects
None yet
Development

No branches or pull requests

6 participants