This repository was archived by the owner on Mar 18, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 18, 2024. It is now read-only.
Validate do not run test for source package #1417
Copy link
Copy link
Closed
Labels
analysisTo be decided on how to solution/fix
Description
Describe the bug
during a validate, source package are deployed without running test
To Reproduce
Steps to reproduce the behavior:
package descriptor:
{
"package": "be-legacy",
"type": "source",
"path": "./src/be-legacy",
"preDeploymentScript": "scripts/core/pre.sh",
"isOptimizedDeployment": false,
"skipDeployOnOrgs": ["prod-fr", "st-fr", "prod-de", "st-de"],
"versionNumber": "1.5.8.NEXT",
"dependencies": [
{
"package": "[email protected]"
},
{
"package": "Asperato [email protected]"
},
{
"package": "Nebula [email protected]"
}
]Expected behavior
during validate, metadata should be deploy and test should be launched
Screenshots
If applicable, add screenshots to help explain your problem.
Platform Details (please complete the following information):
- OS: docker ghcr.io/dxatscale/sfpowerscripts:24.5.0-6246479439
- Version sfp -- The DX@Scale CLI -Version:24.5.0 -Release:August 23
- Salesforce CLI(sfdx cli) Version:
- CI Platform:
Additional context
complete log:
------------------------------------Installing Package------------------------------------
Name: be-legacy
Type: source
Version Number: 1.5.8.1
Optimized Deployment: false
Contains Apex Classes/Triggers: true
Metadata to be deployed: 4723
------------------------------------------------------------------------------------------
Installing package dependencies of this be-legacy in [email protected]
Resolved external package dependencies:
Order Package Version Subscriber Version Id
0 [email protected] N/A 04t3Z000000LdW6QAK
1 Asperato [email protected] N/A 04t1n000001pI4AAAU
2 Nebula [email protected] N/A 04t5Y000001TsZAQA0
Checking whether package [email protected] with ID 04t3Z000000LdW6QAKis installed in [email protected]
Package to be installed was found in the target org [email protected]
Skipping Installing of package [email protected] in [email protected]
Checking whether package Asperato [email protected] with ID 04t1n000001pI4AAAUis installed in [email protected]
Package to be installed was found in the target org [email protected]
Skipping Installing of package Asperato [email protected] in [email protected]
Checking whether package Nebula [email protected] with ID 04t5Y000001TsZAQA0is installed in [email protected]
Package to be installed was found in the target org [email protected]
Skipping Installing of package Nebula [email protected] in [email protected]
Successfully completed external dependencies of this be-legacy in [email protected]
Checking status of permission sets group..
Proceeding with deployment, as no PermissionSetGroups are being updated
Executing preDeployment script
Executing command.. sh -e .sfpowerscripts/unzippedArtifacts/nSiRQ7Xf/be-legacy_sfpowerscripts_artifact/source/scripts/preDeployment be-legacy [email protected] [email protected] .sfpowerscripts/unzippedArtifacts/nSiRQ7Xf/be-legacy_sfpowerscripts_artifact/source ./src/be-legacy
Executing Pre Deployers
Executing Field History Tracking Analyzer
Executing Feed Tracking Analyzer
Executing Picklist Analyzer
Pre Deployer Picklist Enabler skipped or not enabled
Attempt to delete components mentioned in destructive manifest
Deploying Destructive Changes with ID 0Af7Y00002BTFpxSAH to [email protected]
Polling for Deployment Status
Polling for Deployment Status
We attempted a deletion of components, However we are not successful. Either the components are already deleted or there are components which have dependency to components in the manifest. Please check whether this manifest works! Acutal Error Observed: -------------------------------------- Unable to deploy the Destructive Changes: [...]
The following metadata will be deployed:
[...]
Deploying to [email protected] with id:0Af7Y00002BTFs8SAH
Status: Pending Progress: 0/0
Status: InProgress Progress: 700/4432
Status: InProgress Progress: 700/4432
Status: InProgress Progress: 701/4432
Status: InProgress Progress: 1799/4432
Status: InProgress Progress: 3009/4432
Status: InProgress Progress: 3130/4432
Status: InProgress Progress: 3457/4432
Status: InProgress Progress: 3576/4432
Status: InProgress Progress: 3659/4432
Status: InProgress Progress: 3659/4432
Status: InProgress Progress: 3659/4432
Status: InProgress Progress: 4203/4432
Status: InProgress Progress: 4264/4432
Status: InProgress Progress: 4264/4432
Status: InProgress Progress: 4424/4432
Succesfully Deployed 4386 components in 00:08:15.590
Executing Post Deployers
Post Deployer Field History Tracking Enabler skipped or not enabled
Post Deployer Feed Tracking Enabler skipped or not enabled
Existing artifact record id for be-legacy in Org for 1.5.8.1: [...]
Updated Org with new Artifact be-legacy 1.5.8.1 [...]
Package be-legacy installation took 00:08:50.779
Metadata
Metadata
Assignees
Labels
analysisTo be decided on how to solution/fix
Activity
azlam-abdulsalam commentedon Oct 8, 2023
@alanjaouen Its is an expected behaviour, tests are run after deployment in validate, Isnt if running in that mod
alanjaouen commentedon Oct 8, 2023
@azlam-abdulsalam the validate end with success right after the deployment, without running tests for this package
previously (in 21.1.0) for source package with
isOptimizedDeploymenttofalse, tests where run during deploymentalanjaouen commentedon Oct 24, 2023
I tried to find what changed between 21.1.0 related and current, but didn't find anything relevant :/
https://github.com/dxatscale/sfpowerscripts/compare/@dxatscale/[email protected]...@dxatscale/[email protected]
nabondance commentedon Nov 1, 2023
After deep diving in the code, I found something:
This is the line specifying to not run the apex tests when optimized deployment is false
sfpowerscripts/packages/sfpowerscripts-cli/src/impl/validate/ApexTestValidator.ts
Lines 38 to 43 in ab1a369
But the tests doesn't run previously because the only moment they can run is when the package is deployed
In the DeployImpl, it specify to not skip the tests during a validate of a source package without optimized deployment:
sfpowerscripts/packages/sfpowerscripts-cli/src/impl/deploy/DeployImpl.ts
Lines 747 to 762 in ab1a369
Then it regenerate of the settings of the deploy here:
sfpowerscripts/packages/core/src/package/packageInstallers/InstallSourcePackageImpl.ts
Lines 70 to 77 in ab1a369
And then, when setting up the deploy, it specify that there is no tests to run in the case of a source package deployed on a Scratch Org for validation:
We go in this else because
this.options.isInstallingForValidation == true:sfpowerscripts/packages/core/src/package/packageInstallers/InstallPackage.ts
Lines 471 to 478 in ab1a369
And because we deploy in SO, we have
orgDetails.isSandbox == trueThis is the explanation of the issue I was able to find
I can't understand why it was working previously
Possible ways to fix:
if (this.sfpPackage.packageDescriptor.isOptimizedDeployment == false), probably not the best solutionazlam-abdulsalam commentedon Nov 7, 2023
wow! great investigation @nabondance . Very helpful! Let me have a look into it